/* ==========================================================================
   价格采集管理台 - 样式
   设计目标：紧凑 / 平静 / 商品列表优先 / 桌面+移动响应式
   ========================================================================== */

:root {
    --bg: #f4f7f8;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #dbe3ea;
    --dark: #172033;
    --blue: #1d4ed8;
    --green: #047857;
    --red: #dc2626;
    --amber: #b45309;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 16px 34px rgba(15, 23, 42, .06);
    --soft-blue: #eaf2ff;
    --soft-green: #e8f7ef;
    --soft-red: #fff0f0;
    --soft-amber: #fef3c7;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    color: var(--text);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
    background:
        linear-gradient(180deg, rgba(222, 239, 242, .88) 0, rgba(244, 247, 248, .96) 300px),
        var(--bg);
    overflow-x: hidden;
}

.page {
    width: min(100%, 1720px);
    margin: 0 auto;
    padding: 22px 28px 34px;
}

/* ---------- Hero ---------- */

.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
}

.hero h1 {
    margin: 0 0 6px;
    font-size: 28px;
    letter-spacing: 0;
}

.hero p {
    margin: 0;
    max-width: 860px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 13px;
    border-radius: 8px;
    background: var(--dark);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.2;
    font-weight: 700;
    box-shadow: 0 1px 1px rgba(15, 23, 42, .08);
    transition: transform .12s ease, opacity .12s ease, background .12s ease;
}

.page-link:hover {
    transform: translateY(-1px);
    opacity: .94;
}

.page-link.light {
    background: #eef4ff;
    color: #1e3a8a;
}

.admin-session-pill {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    max-width: 240px;
    padding: 8px 11px;
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #f8fbff;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hero-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

body.products-page .hero {
    align-items: flex-start;
}

.hero-stat {
    min-width: 100px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}

.hero-stat .label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hero-stat .value {
    font-size: 20px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.hero-stat.good .value { color: var(--green); }
.hero-stat.warn .value { color: var(--amber); }
.hero-stat.bad  .value { color: var(--red); }

/* ---------- Card / Grid ---------- */

.grid {
    display: grid;
    gap: 16px;
    align-items: start;
}

.grid.three-cards {
    grid-template-columns: minmax(470px, 1.12fr) minmax(390px, 0.94fr) minmax(420px, 1fr);
    margin-bottom: 18px;
}

.grid.three-cards > article { min-width: 0; }

.card {
    margin-bottom: 16px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef2f5;
}

.card-title h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.25;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

#shopCount {
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 0;
    background: transparent;
}

.shop-count-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.shop-count-pill.good {
    background: var(--soft-green);
    color: var(--green);
}

.shop-count-pill.bad {
    background: var(--soft-red);
    color: var(--red);
}

/* ---------- Forms ---------- */

.form-grid {
    display: grid;
    grid-template-columns: minmax(150px, 0.72fr) minmax(250px, 1.28fr);
    gap: 12px;
}

.form-grid.three {
    grid-template-columns: minmax(210px, 1.4fr) minmax(116px, 0.72fr) minmax(140px, 0.78fr);
}

.grid.three-cards > article:nth-child(2) .form-grid {
    grid-template-columns: minmax(0, 1fr) minmax(132px, auto);
}

label {
    display: block;
    margin-bottom: 6px;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid #d7e0e8;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea {
    min-height: 56px;
    resize: vertical;
}

input:focus, select:focus, textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, .22);
}

.field { margin-bottom: 11px; }

/* ---------- Buttons ---------- */

button {
    min-height: 38px;
    padding: 9px 13px;
    border: none;
    border-radius: 8px;
    background: var(--dark);
    color: #fff;
    font-size: 13px;
    line-height: 1.2;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 1px rgba(15, 23, 42, .08);
    transition: transform .12s ease, opacity .12s ease, background .12s ease;
}

button:hover { transform: translateY(-1px); opacity: .94; }
button:active { transform: none; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

button.primary { background: var(--blue); }
button.secondary { background: #293548; }
button.light { background: #eef4ff; color: #1e3a8a; }
button.green { background: var(--green); }
button.danger { background: var(--red); }
button.red { background: var(--red); }

button.small {
    min-height: 30px;
    padding: 6px 9px;
    border-radius: 7px;
    font-size: 12px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

/* ---------- Toolbar ---------- */

.toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.15fr) minmax(220px, 1.15fr) minmax(140px, 0.7fr) minmax(180px, 0.85fr) minmax(140px, 0.7fr) minmax(150px, 0.7fr) auto auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid #e1e8ee;
    border-radius: 8px;
    background: #f8fafc;
}

/* ---------- Table ---------- */

.table-wrap {
    max-height: 720px;
    overflow: auto;
    border: 1px solid #d9e2ea;
    border-radius: 8px;
    background: #fff;
}

table {
    width: 100%;
    min-width: 1160px;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfdff; }
tbody tr.row-favorite { background: #fffdf3; }

.table-wrap th:nth-child(1), .table-wrap td:nth-child(1) { width: 5.2%; }
.table-wrap th:nth-child(2), .table-wrap td:nth-child(2) { width: 36.5%; }
.table-wrap th:nth-child(3), .table-wrap td:nth-child(3),
.table-wrap th:nth-child(8), .table-wrap td:nth-child(8) { width: 7.2%; text-align: center; }
.table-wrap th:nth-child(4), .table-wrap td:nth-child(4),
.table-wrap th:nth-child(5), .table-wrap td:nth-child(5),
.table-wrap th:nth-child(6), .table-wrap td:nth-child(6),
.table-wrap th:nth-child(7), .table-wrap td:nth-child(7) { width: 7%; white-space: nowrap; }
.table-wrap th:nth-child(9), .table-wrap td:nth-child(9) { width: 8.4%; }
.table-wrap th:nth-child(10), .table-wrap td:nth-child(10) { width: 15%; }

.name-cell strong {
    display: block;
    max-width: 560px;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.name-cell .muted {
    display: inline;
    margin-right: 12px;
}

.name-cell .muted:last-child {
    display: block;
    margin-top: 3px;
    margin-right: 0;
}

/* ---------- Tags / Pills ---------- */

.muted {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 700;
}

.link:hover { text-decoration: underline; }

.rank-pill {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 42px;
    height: 28px;
    border-radius: 999px;
    background: var(--soft-blue);
    color: var(--blue);
    font-weight: 800;
    white-space: nowrap;
}

.tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.tag.green { background: var(--soft-green); color: var(--green); }
.tag.red { background: var(--soft-red); color: var(--red); }
.tag.blue { background: var(--soft-blue); color: var(--blue); }
.tag.amber { background: var(--soft-amber); color: var(--amber); }
.tag.warn { background: var(--soft-amber); color: var(--amber); }

.money {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.diff-high { color: var(--red); font-weight: 800; }
.diff-low { color: var(--green); font-weight: 800; }
.diff-ok { color: #4b5563; font-weight: 800; }

/* ---------- Category / Shop List ---------- */

.category-list {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}

.grid.three-cards .category-list {
    max-height: 240px;
    overflow: auto;
    padding-right: 4px;
    align-content: start;
}

.category-list::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.records-box::-webkit-scrollbar {
    width: 8px; height: 8px;
}

.category-list::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.records-box::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #cbd5e1;
}

.category-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfdff;
}

.category-item strong {
    display: block;
    line-height: 1.35;
}

/* ---- 两级分类树 ---- */
.category-group {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #fff;
}
.category-group .category-item {
    border: 0;
    border-radius: 0;
}
.category-item.parent {
    background: #eef3ff;
    border-bottom: 1px solid var(--border);
}
.category-children {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px 12px 22px;
}
.category-item.leaf {
    background: #fbfdff;
}
.leaf-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}
.leaf-actions .mig {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: #fff;
}
.leaf-actions .mig select {
    max-width: 180px;
}
@media (max-width: 720px) {
    .leaf-actions { justify-content: flex-start; }
    .leaf-actions .mig { width: 100%; justify-content: space-between; }
    .leaf-actions .mig select { flex: 1; max-width: none; }
}

.inline-edit {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}

.inline-edit input { width: 148px; }

/* ---------- Link Audit ---------- */

.link-audit {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid #e1e8ee;
    border-radius: 8px;
    background: #f8fafc;
}

.audit-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.audit-summary span {
    padding: 4px 8px;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid #e2e8f0;
}

.audit-list {
    display: grid;
    gap: 6px;
}

.audit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, .9fr);
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
}

.audit-row strong,
.audit-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Source Shop Audit ---------- */

.source-audit {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #d9e2ea;
    border-radius: 8px;
    background: #f8fafc;
}

.source-audit-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    margin-bottom: 10px;
}

.source-audit-sources,
.source-audit-list {
    display: grid;
    gap: 8px;
}

.source-audit-sources {
    margin-bottom: 12px;
}

.source-audit-source,
.source-audit-missing {
    display: grid;
    gap: 10px;
    align-items: center;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid #e1e8ee;
    border-radius: 8px;
    background: #fff;
}

.source-audit-source {
    grid-template-columns: minmax(0, 1fr) repeat(4, auto);
    font-size: 12px;
}

.source-audit-source.failed {
    border-color: #fecaca;
    background: var(--soft-red);
}

.source-audit-source .good { color: var(--green); font-weight: 800; }
.source-audit-source .bad { color: var(--red); font-weight: 800; }

.source-audit-list-title {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.source-audit-missing {
    grid-template-columns: minmax(0, 1fr) minmax(240px, .9fr);
}

.source-audit-missing > div {
    min-width: 0;
}

.source-audit-missing .link {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Shop Import ---------- */

.shop-import {
    margin-top: 12px;
}

.import-url-grid {
    grid-template-columns: minmax(0, 1fr) auto;
}

.shop-import-panel {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #dbe3ea;
    border-radius: 8px;
    background: #fbfdff;
}

.import-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.mapping-list {
    display: grid;
    gap: 8px;
    max-height: 220px;
    overflow: auto;
    padding-right: 4px;
}

.mapping-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, .85fr);
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}

.import-error {
    padding: 8px;
    border-left: 3px solid var(--red);
    background: var(--soft-red);
}

/* ---------- Empty / Loading ---------- */

.empty {
    padding: 28px;
    text-align: center;
    color: var(--muted);
}

.loading-skeleton {
    height: 14px;
    margin: 6px 0;
    border-radius: 4px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- Action Buttons (table row) ---------- */

.action-cell { vertical-align: middle; }

.row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    min-width: 164px;
}

.row-actions button {
    width: 100%;
    white-space: nowrap;
}

.row-actions button.star {
    background: #fef3c7;
    color: #b45309;
}

/* ---------- Records ---------- */

.records-box {
    max-height: 460px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.records-box table { min-width: 720px; }

.sparkline {
    display: block;
    width: 120px;
    height: 30px;
}

/* ---------- Modal ---------- */

.modal-mask {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(17, 24, 39, .45);
    z-index: 99;
}

.modal-mask[hidden] { display: none; }

.modal {
    width: min(620px, 100%);
    padding: 22px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.modal-head h3 {
    margin: 0;
    font-size: 18px;
}

/* ---------- Toast ---------- */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 240px;
    max-width: 420px;
    padding: 12px 16px;
    border-left: 4px solid var(--blue);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .15);
    font-size: 13px;
    line-height: 1.5;
    color: #1f2937;
    animation: toast-in .25s ease;
}

.toast.success { border-left-color: var(--green); }
.toast.warning { border-left-color: var(--amber); }
.toast.error   { border-left-color: var(--red); }
.toast.info    { border-left-color: var(--blue); }

.toast .title {
    font-weight: 700;
    margin-bottom: 2px;
}

.toast.removing {
    animation: toast-out .2s ease forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(8px); }
}

/* ---------- Responsive ---------- */

@media (max-width: 1320px) {
    .grid.three-cards {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .grid.three-cards > article:first-child {
        grid-column: 1 / -1;
    }
    .grid.three-cards .category-list { max-height: 260px; }
}

@media (max-width: 980px) {
    .page { padding: 16px; }
    .hero {
        display: grid;
        align-items: stretch;
        gap: 12px;
    }
    .hero-stats { justify-content: flex-start; }
    .grid.three-cards,
    .form-grid,
    .form-grid.three,
    .grid.three-cards > article:nth-child(2) .form-grid,
    .toolbar {
        grid-template-columns: 1fr;
    }
    .grid.three-cards > article:first-child { grid-column: auto; }
    .grid.three-cards .category-list { max-height: 320px; }
    .import-url-grid,
    .mapping-row,
    .import-head,
    .source-audit-head,
    .source-audit-source,
    .source-audit-missing { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .page { padding: 12px; }
    .hero h1 { font-size: 24px; }
    .card { padding: 14px; }
    .card-title { align-items: flex-start; flex-wrap: wrap; }
    .actions button { width: 100%; }
    .category-item { grid-template-columns: 1fr; }
    .inline-edit { justify-content: stretch; }
    .inline-edit input, .inline-edit button { width: 100%; }
    table { min-width: 1080px; }
}

/* ==========================================================================
   登录页
   ========================================================================== */

body.login-page {
    min-height: 100dvh;
    background:
        linear-gradient(180deg, rgba(232, 241, 255, .92), rgba(248, 250, 252, .98) 48%),
        repeating-linear-gradient(90deg, rgba(30, 64, 175, .04) 0 1px, transparent 1px 86px),
        #f8fafc;
}

.login-shell {
    display: grid;
    min-height: 100dvh;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(100%, 440px);
    padding: 24px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
}

.login-brand {
    margin-bottom: 20px;
}

.login-page .product-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1e40af;
    font-size: 12px;
    font-weight: 800;
}

.login-brand h1 {
    margin: 10px 0 6px;
    color: #0f172a;
    font-size: 26px;
    line-height: 1.2;
}

.login-brand p {
    margin: 0;
    color: #475569;
    font-size: 14px;
}

.login-form {
    display: grid;
    gap: 14px;
}

.password-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.password-field button {
    min-width: 68px;
}

.login-error {
    padding: 10px 12px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fff1f2;
    color: #991b1b;
    font-size: 13px;
    line-height: 1.5;
}

.login-submit {
    min-height: 44px;
}

@media (max-width: 520px) {
    .login-shell {
        align-items: stretch;
        padding: 14px;
    }

    .login-panel {
        align-self: center;
        padding: 18px;
    }
}

/* ==========================================================================
   v3 新增样式：Tab / 规则引擎 / 同步弹窗
   ========================================================================== */

.version-tag {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--soft-blue);
    color: var(--blue);
    margin-left: 8px;
    vertical-align: middle;
    font-weight: 500;
}

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin: 6px 0 18px;
    overflow-x: auto;
}

.tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s ease;
}

.tab:hover { color: var(--text); }
.tab.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
    font-weight: 600;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.grid.two-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 1024px) {
    .grid.two-cards { grid-template-columns: 1fr; }
}

.hint {
    margin: 8px 0 12px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.import-url-grid {
    grid-template-columns: 2fr 1.2fr auto !important;
    gap: 10px;
    align-items: stretch;
}
@media (max-width: 768px) {
    .import-url-grid { grid-template-columns: 1fr !important; }
}

.shop-import-panel {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfcfe;
}

.import-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border);
    margin-bottom: 10px;
}

.import-error {
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--soft-red);
    color: var(--red);
}

.mapping-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 460px;
    overflow-y: auto;
    padding-right: 4px;
}

.mapping-row {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    align-items: center;
}

.mapping-row select {
    width: 100%;
}

.preview-table {
    width: 100%;
    margin-top: 12px;
    border-collapse: collapse;
    font-size: 13px;
}
.preview-table th, .preview-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

/* ---------- 规则引擎 ---------- */

.rules-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 10px 0 14px;
}
.rules-toolbar select { min-width: 160px; }

.section-title {
    margin: 18px 0 8px;
    font-size: 15px;
    color: var(--text);
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rule-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    align-items: center;
}

.rule-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.rule-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    color: var(--muted);
    background: #f8fafc;
}
.rule-badge.kind-shop { background: var(--soft-blue); color: var(--blue); border-color: transparent; }
.rule-badge.kind-product { background: var(--soft-green); color: var(--green); border-color: transparent; }
.rule-badge.src-builtin { background: #ede9fe; color: #6d28d9; border-color: transparent; }
.rule-badge.src-llm { background: var(--soft-amber); color: var(--amber); border-color: transparent; }
.rule-badge.src-manual { background: #f3f4f6; color: #4b5563; border-color: transparent; }

.rule-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rule-actions { display: flex; gap: 6px; }

.rule-result {
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    overflow: auto;
    max-height: 360px;
    font-size: 12px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 10px;
}

textarea.code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12px;
    background: #f8fafc;
}

.modal.big { width: min(960px, 96vw); }

/* ---------- 用户管理 ---------- */

.user-admin-layout {
    display: grid;
    grid-template-columns: minmax(310px, .74fr) minmax(620px, 1.26fr);
    gap: 14px;
    align-items: start;
}

.user-panel {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfcfe;
}

.user-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.user-panel-head h3 {
    margin: 0;
    font-size: 15px;
}

.user-form-grid {
    grid-template-columns: minmax(180px, 1.1fr) minmax(116px, .68fr) minmax(116px, .68fr);
}

.user-password-grid {
    grid-template-columns: minmax(180px, .86fr) minmax(220px, 1.14fr);
}

.user-table {
    min-width: 760px;
}

.user-name-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.user-current {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 20px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--soft-blue);
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
}

.user-role-pill,
.user-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.user-role-pill.role-admin {
    background: #ede9fe;
    color: #6d28d9;
}

.user-role-pill.role-user {
    background: var(--soft-blue);
    color: var(--blue);
}

.user-status-pill.status-active {
    background: var(--soft-green);
    color: var(--green);
}

.user-status-pill.status-disabled {
    background: #f1f5f9;
    color: #64748b;
}

.user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.user-actions button[disabled] {
    opacity: .45;
    cursor: not-allowed;
}

@media (max-width: 1120px) {
    .user-admin-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .user-form-grid,
    .user-password-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- 店铺同步 ---------- */

.sync-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 70vh;
    overflow-y: auto;
}

.sync-section { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.sync-section h4 { margin: 0 0 8px; font-size: 14px; }
.sync-section.added { border-color: #34d399; background: #ecfdf5; }
.sync-section.removed { border-color: #f87171; background: #fff1f2; }
.sync-section.kept { border-color: var(--border); }

.sync-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
}
.sync-row:last-child { border-bottom: none; }
.sync-row .name { font-weight: 500; }
.sync-row .meta { font-size: 12px; color: var(--muted); }

button.small { padding: 4px 10px; font-size: 12px; }

/* ==========================================================================
   商品查询单页优化
   ========================================================================== */

body.products-page {
    --product-primary: #1e3a5f;
    --product-accent: #059669;
    --product-ink: #0f172a;
    --product-soft: #f8fafc;
    --product-line: #d9e5ef;
    background:
        linear-gradient(180deg, rgba(238, 247, 249, .96) 0, rgba(248, 250, 252, .98) 360px),
        repeating-linear-gradient(90deg, rgba(30, 58, 95, .035) 0 1px, transparent 1px 88px),
        #f8fafc;
}

body.products-page .page--products {
    width: min(100%, 1480px);
    padding: 26px 28px 44px;
}

body.products-page .product-hero {
    position: relative;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    padding: 12px 14px;
    overflow: hidden;
    border: 1px solid rgba(30, 58, 95, .14);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(240, 249, 246, .9)),
        #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

body.products-page .product-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(30, 58, 95, .08) 1px, transparent 1px),
        linear-gradient(180deg, rgba(30, 58, 95, .06) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(90deg, transparent, #000 18%, #000 72%, transparent);
    opacity: .42;
}

body.products-page .hero-copy,
body.products-page .hero-stats {
    position: relative;
    z-index: 1;
}

body.products-page .hero-copy {
    flex: 1 1 430px;
    min-width: 0;
}

body.products-page .product-session {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

body.products-page .session-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    max-width: 220px;
    padding: 7px 10px;
    overflow: hidden;
    border: 1px solid rgba(30, 58, 95, .14);
    border-radius: 999px;
    background: rgba(255, 255, 255, .86);
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.products-page .session-logout {
    min-width: 60px;
}

body.products-page .hero-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    align-items: center;
}

body.products-page .product-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin: 0;
    padding: 3px 9px;
    border: 1px solid rgba(30, 58, 95, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .78);
    color: var(--product-primary);
    font-size: 12px;
    font-weight: 800;
}

body.products-page .product-hero h1 {
    margin: 0;
    color: var(--product-ink);
    font-size: 22px;
    line-height: 1.2;
}

body.products-page .product-hero p {
    max-width: none;
    margin-top: 5px;
    color: #475569;
    font-size: 13px;
}

body.products-page .page-link,
body.products-page button {
    min-height: 40px;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease, opacity .18s ease;
}

body.products-page button:focus-visible,
body.products-page .page-link:focus-visible,
body.products-page .link:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .28);
    outline-offset: 2px;
}

body.products-page button.small {
    min-height: 34px;
    padding: 7px 10px;
}

body.products-page .hero-stats {
    display: flex;
    flex: 1 1 560px;
    flex-wrap: wrap;
    gap: 6px;
    align-content: center;
    justify-content: flex-end;
    width: auto;
    max-width: 720px;
}

body.products-page .hero-stat {
    position: relative;
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
    min-width: 0;
    padding: 6px 9px;
    overflow: hidden;
    border-color: rgba(30, 58, 95, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
    white-space: nowrap;
}

body.products-page .hero-stat::before {
    content: none;
}

body.products-page .hero-stat.good::before { background: var(--product-accent); }
body.products-page .hero-stat.warn::before { background: #d97706; }
body.products-page .hero-stat.bad::before { background: #dc2626; }

body.products-page .hero-stat .label {
    font-size: 11px;
    letter-spacing: 0;
    text-transform: none;
}

body.products-page .hero-stat .value {
    display: inline;
    margin-top: 0;
    font-size: 15px;
}

body.products-page .card {
    border-color: var(--product-line);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .07);
}

body.products-page .card-title {
    align-items: flex-start;
    margin-bottom: 16px;
}

body.products-page .card-title-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

body.products-page .card-title h2 {
    font-size: 18px;
}

body.products-page .badge {
    background: #eef6ff;
    color: var(--product-primary);
}

body.products-page .badge--readonly {
    background: #fff7ed;
    color: #9a3412;
}

body.products-page .product-filter-panel {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
    padding: 12px;
    border-color: rgba(30, 58, 95, .12);
    border-radius: 8px;
    background: linear-gradient(180deg, #fbfdff, #f6f9fc);
}

body.products-page .product-search-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(240px, .8fr);
    gap: 10px;
}

body.products-page .product-filter-row {
    display: grid;
    grid-template-columns:
        minmax(150px, .72fr)
        minmax(220px, .96fr)
        minmax(136px, .62fr)
        minmax(150px, .68fr)
        minmax(360px, auto);
    gap: 10px;
    align-items: end;
}

body.products-page .filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin: 0;
}

body.products-page .filter-field span {
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

body.products-page .filter-field input,
body.products-page .filter-field select {
    min-height: 44px;
    border-color: #d4e0ea;
    background-color: #fff;
    font-size: 14px;
}

body.products-page .filter-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 34px;
    color: #475569;
    font-size: 12px;
}

body.products-page .summary-text {
    font-weight: 800;
    color: #334155;
}

body.products-page .summary-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1e3a8a;
    font-weight: 800;
}

body.products-page .summary-chip--page {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #047857;
}

body.products-page .product-actions {
    align-self: end;
    justify-content: flex-end;
    gap: 6px;
    margin: 0;
    padding: 0;
}

body.products-page .product-actions button {
    min-height: 44px;
    white-space: nowrap;
}

body.products-page .product-query-card .table-wrap {
    min-height: 360px;
    max-height: calc(100dvh - 260px);
    margin-top: 14px;
    border-color: var(--product-line);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85);
}

body.products-page table {
    min-width: 1080px;
}

body.products-page .product-query-card .table-wrap th:nth-child(1),
body.products-page .product-query-card .table-wrap td:nth-child(1) { width: 7%; }
body.products-page .product-query-card .table-wrap th:nth-child(2),
body.products-page .product-query-card .table-wrap td:nth-child(2) { width: 38%; }
body.products-page .product-query-card .table-wrap th:nth-child(3),
body.products-page .product-query-card .table-wrap td:nth-child(3) { width: 8%; text-align: center; }
body.products-page .product-query-card .table-wrap th:nth-child(4),
body.products-page .product-query-card .table-wrap td:nth-child(4) { width: 8%; white-space: nowrap; }
body.products-page .product-query-card .table-wrap th:nth-child(5),
body.products-page .product-query-card .table-wrap td:nth-child(5) { width: 10%; white-space: nowrap; }
body.products-page .product-query-card .table-wrap th:nth-child(6),
body.products-page .product-query-card .table-wrap td:nth-child(6) { width: 13%; white-space: nowrap; }
body.products-page .product-query-card .table-wrap th:nth-child(7),
body.products-page .product-query-card .table-wrap td:nth-child(7) { width: 16%; white-space: normal; }

body.products-page th {
    background: #eef4f7;
    color: #334155;
}

body.products-page td {
    padding: 14px 12px;
}

body.products-page tbody tr {
    transition: background-color .18s ease, box-shadow .18s ease;
}

body.products-page tbody tr:hover {
    background: #f8fbff;
}

body.products-page tbody tr.row-favorite {
    background: #fffdf4;
}

body.products-page tbody tr.row-favorite td:first-child {
    box-shadow: inset 3px 0 0 #d97706;
}

body.products-page .rank-stack {
    display: grid;
    gap: 6px;
    justify-items: center;
}

body.products-page .rank-pill {
    height: 30px;
    min-width: 48px;
    background: #e8f1ff;
}

body.products-page .name-cell strong {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    max-width: none;
    margin-bottom: 7px;
    font-size: 15px;
}

body.products-page .product-title-text {
    min-width: 0;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

body.products-page .fav-mark {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 800;
}

body.products-page .product-meta,
body.products-page .product-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    min-width: 0;
    max-width: 100%;
}

body.products-page .product-meta span,
body.products-page .product-details span {
    min-width: 0;
    max-width: 100%;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

body.products-page .product-details {
    margin-top: 4px;
}

body.products-page .product-key {
    display: inline-flex;
    max-width: 100%;
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow-wrap: anywhere;
}

body.products-page .money {
    color: #0f766e;
    font-size: 14px;
}

body.products-page .tag {
    border: 1px solid transparent;
}

body.products-page .tag.green {
    border-color: rgba(4, 120, 87, .12);
}

body.products-page .tag.red {
    border-color: rgba(220, 38, 38, .12);
}

body.products-page .tag.warn {
    border-color: rgba(180, 83, 9, .14);
}

body.products-page .row-actions {
    min-width: 176px;
}

body.products-page .row-actions button {
    box-shadow: none;
}

body.products-page .product-empty {
    padding: 42px 24px;
}

body.products-page .product-empty strong,
body.products-page .product-empty span {
    display: block;
}

body.products-page .product-empty strong {
    margin-bottom: 6px;
    color: #334155;
    font-size: 15px;
}

body.products-page .table-loading {
    display: grid;
    gap: 8px;
    padding: 14px;
}

body.products-page .loading-skeleton {
    display: block;
    max-width: 680px;
    margin: 0;
}

body.products-page .loading-skeleton.short {
    max-width: 360px;
}

body.products-page .product-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #dbe5ee;
    border-radius: 8px;
    background: #fbfdff;
}

body.products-page .pager-status {
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}

body.products-page .pager-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

body.products-page .pager-controls button {
    min-height: 36px;
    padding: 7px 10px;
}

body.products-page .pager-controls .pager-page {
    min-width: 36px;
    padding-inline: 8px;
}

body.products-page .pager-page.is-current,
body.products-page .pager-page.is-current:disabled {
    background: var(--product-primary);
    color: #fff;
    opacity: 1;
}

body.products-page .pager-gap {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    color: #64748b;
    font-weight: 800;
}

body.products-page .link-audit {
    border-color: #cfe0ec;
    background: #f7fbfd;
}

body.products-page.modal-open {
    overflow: hidden;
}

body.products-page .history-modal-mask {
    z-index: 220;
    padding: 20px;
    background: rgba(15, 23, 42, .55);
}

body.products-page .history-modal {
    display: flex;
    flex-direction: column;
    width: min(980px, calc(100vw - 32px));
    max-height: min(760px, calc(100dvh - 36px));
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 8px;
}

body.products-page .history-modal-head {
    gap: 16px;
    margin: 0;
    padding: 16px 18px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #fbfdff, #f7fafc);
}

body.products-page .modal-kicker {
    display: inline-flex;
    margin-bottom: 4px;
    color: var(--product-primary);
    font-size: 12px;
    font-weight: 800;
}

body.products-page .history-modal h3 {
    color: var(--product-ink);
}

body.products-page .history-modal-subtitle {
    max-width: 760px;
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

body.products-page .modal-close {
    flex: 0 0 auto;
    min-width: 40px;
    width: 40px;
    padding: 0;
    font-size: 24px;
    line-height: 1;
}

body.products-page .history-modal .records-box {
    flex: 1 1 auto;
    min-height: 260px;
    max-height: none;
    overflow: auto;
    border: 0;
    border-radius: 0;
}

body.products-page .history-modal .records-box table {
    width: 100%;
    min-width: 620px;
}

body.products-page .record-trend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid var(--product-line);
    background: #fbfdff;
}

body.products-page .record-trend .sparkline {
    width: 260px;
    max-width: 100%;
    height: 50px;
}

@media (max-width: 1180px) {
    body.products-page .product-hero {
        display: grid;
    }

    body.products-page .product-session {
        justify-content: flex-start;
    }

    body.products-page .hero-stats {
        justify-content: flex-start;
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 980px) {
    body.products-page .product-search-row {
        grid-template-columns: 1fr;
    }

    body.products-page .product-filter-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.products-page .product-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    body.products-page .page--products {
        padding: 12px;
    }

    body.products-page .product-hero {
        padding: 12px;
    }

    body.products-page .product-hero h1 {
        font-size: 22px;
    }

    body.products-page .hero-stats {
        justify-content: flex-start;
    }

    body.products-page .product-filter-panel {
        padding: 10px;
    }

    body.products-page .product-filter-row {
        grid-template-columns: 1fr;
    }

    body.products-page .product-actions {
        justify-content: stretch;
    }

    body.products-page .product-actions button {
        width: 100%;
    }

    body.products-page .product-pagination {
        align-items: flex-start;
    }

    body.products-page .pager-controls {
        justify-content: flex-start;
    }

    body.products-page .history-modal-mask {
        padding: 10px;
    }

    body.products-page .history-modal {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 20px);
    }

    body.products-page .history-modal-head {
        align-items: flex-start;
        padding: 14px;
    }

    body.products-page .card-title-meta,
    body.products-page .product-session {
        justify-content: flex-start;
    }

    body.products-page .record-trend {
        padding: 12px;
    }

    body.products-page .product-query-card .table-wrap {
        min-height: 0;
        max-height: none;
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    body.products-page .product-query-card table {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 10px;
    }

    body.products-page .product-query-card thead {
        display: none;
    }

    body.products-page .product-query-card tbody {
        display: grid;
        gap: 10px;
        width: 100%;
        max-width: 100%;
    }

    body.products-page .product-query-card tr {
        display: grid;
        width: 100%;
        max-width: 100%;
        padding: 12px;
        border: 1px solid var(--product-line);
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
    }

    body.products-page .product-query-card td {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 12px;
        align-items: start;
        width: auto !important;
        min-width: 0;
        padding: 8px 0;
        border-bottom: 1px dashed #e2e8f0;
        text-align: left !important;
        white-space: normal !important;
    }

    body.products-page .product-query-card td:last-child {
        border-bottom: 0;
    }

    body.products-page td[data-label]::before {
        content: attr(data-label);
        color: #64748b;
        font-size: 12px;
        font-weight: 800;
    }

    body.products-page td[colspan],
    body.products-page td.empty {
        display: block;
    }

    body.products-page td[colspan]::before,
    body.products-page td.empty::before {
        content: none;
    }

    body.products-page .rank-stack {
        justify-items: start;
    }

    body.products-page .row-actions {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.products-page .row-actions button {
        min-width: 0;
    }

    body.products-page .name-cell,
    body.products-page .name-cell strong,
    body.products-page .product-title-text,
    body.products-page .product-key {
        min-width: 0;
        max-width: 100%;
    }

    body.products-page .product-key {
        white-space: normal;
    }

    body.products-page button.small {
        min-height: 40px;
    }
}

@media (max-width: 460px) {
    body.products-page .hero-stats {
        display: grid;
        grid-template-columns: 1fr;
    }

    body.products-page .product-query-card td {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.products-page *,
    body.products-page *::before,
    body.products-page *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
