/* ==================== 选品调研库 · 全局样式 ==================== */

* { box-sizing: border-box; }

/* hidden 属性一定要生效: 带 hidden 的元素无论平时 display 是什么都不显示 */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #f5f7fb;
    color: #2b3440;
}

/* ---------- 顶栏 ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: #1f2937;
}
.topbar .brand {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
}
.topbar nav a {
    color: #d1d5db;
    margin-left: 16px;
    text-decoration: none;
    font-size: 0.95rem;
}
.topbar nav a:hover { color: #fff; }
/* 回收站里有几条 —— 顶栏上的小红点 */
.nav-dot {
    display: inline-block; margin-left: 4px;
    background: #dc2626; color: #fff;
    border-radius: 999px; padding: 0 6px;
    font-size: 11px; font-weight: 700; vertical-align: 1px;
}

.container { max-width: 1120px; margin: 24px auto; padding: 0 16px; }

h1 { font-size: 1.5rem; margin: 8px 0 14px; }

/* ---------- 按钮 ---------- */
.btn-primary {
    display: inline-block;
    background: #2c7df0;
    color: #fff !important;
    padding: 7px 14px;
    border-radius: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}
.btn-primary:hover { background: #1e63c4; }
.btn-danger {
    background: transparent;
    color: #dc2626;
    border: 1px solid #f3b9b9;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
}
.btn-danger:hover { background: #fdecec; }
.btn-big { padding: 12px 20px; font-size: 1.05rem; margin-top: 6px; }

/* ---------- flash 提示 ---------- */
.flashes {
    list-style: none;
    max-width: 980px;
    margin: 16px auto 0;
    padding: 0 16px;
}
.flashes li {
    background: #e6f4ea;
    color: #1e7e34;
    border: 1px solid #bfe3c9;
    border-radius: 8px;
    padding: 10px 14px;
}

/* ---------- 表格(候选品列表) ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eef1f5;
    font-size: 0.92rem;
}
th { background: #f0f4fa; }
td.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.bad-now { color: #dc2626; }
.badge {
    background: #eef2ff;
    color: #3730a3;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: .82rem;
}
.empty {
    background: #fff;
    border: 1px dashed #c9d4e3;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
}
.tip { color: #6b7280; font-size: 0.85rem; line-height: 1.7; }

/* ---------- 收录表单 ---------- */
.card-form {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.card-form label {
    display: block;
    margin: 14px 0;
    font-weight: 600;
}
.card-form .hint {
    display: block;
    font-weight: 400;
    color: #6b7280;
    font-size: 0.82rem;
    margin-bottom: 4px;
}
.card-form input,
.card-form select,
.card-form textarea {
    width: 100%;
    padding: 9px 10px;
    margin-top: 4px;
    border: 1px solid #ccd4e0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 400;
}
.card-form input:focus, .card-form select:focus, .card-form textarea:focus {
    outline: none;
    border-color: #2c7df0;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) {
    .row2, .row3 { grid-template-columns: 1fr; }
}

/* ---------- 收录页的"最简模式" ----------
   手机上填十几个字段很痛苦。最简模式只留必填的那 5 个,
   其余(图片/货源链接/费率/竞争度/备注…)整块藏起来,提交时用它们的默认值。
   默认值本来就是常用值(佣金 5%、竞争 3、阶段"灵感"),所以藏起来不影响算出来的净利。 */
.mode-switch {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: #f4f8ff; border: 1px solid #cfe0f7; border-radius: 10px;
    padding: 10px 14px; margin-bottom: 16px;
}
.mode-switch button { padding: 7px 14px; font-size: .92rem; }
.mode-switch .mode-hint { color: #6b7280; font-size: .84rem; flex: 1; min-width: 180px; }
/* 最简模式:藏掉所有打了 adv 记号的块 */
.card-form.mode-simple .adv { display: none; }

/* ---------- 计算公式说明卡 ---------- */
.formula-box {
    margin-top: 18px;
    background: #fffaf0;
    border: 1px solid #f3e2bf;
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 0.95rem;
    line-height: 1.9;
}
.formula-box h3 { margin: 0 0 6px; font-size: 1rem; }

/* ---------- v1.1: 产品图 + 1688 进货 ---------- */
.prod-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.thumb {
    width: 48px; height: 48px;
    object-fit: cover;
    border-radius: 8px;
    flex: none;
    border: 1px solid #e4e9f0;
    background: #f0f4fa;
}
.prod-meta { line-height: 1.5; }
.comp { color: #6b7280; font-size: .78rem; }
.btn-1688 {
    display: inline-block;
    background: #ff5000;               /* 1688 橙 */
    color: #fff !important;
    padding: 5px 11px;
    border-radius: 6px;
    text-decoration: none;
    font-size: .85rem;
    white-space: nowrap;
}
.btn-1688:hover { background: #e04300; }
.muted { color: #c3ccd8; }
.img-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px dashed #c9d4e3;
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 2px;
}
.img-preview img { height: 72px; border-radius: 6px; }
.img-preview span { color: #6b7280; font-size: .8rem; flex: 1; }
.img-preview button { flex: none; }

/* ---------- v1.2: 筛选条 + 自动评级徽章 ---------- */
.filters {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #e7ecf3;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
}
.filters label {
    font-size: .82rem;
    color: #6b7280;
}
.filters select {
    margin-top: 3px;
    display: block;
    padding: 6px 8px;
    border: 1px solid #ccd4e0;
    border-radius: 7px;
    background: #fff;
    font-size: .9rem;
}
.filters label.chk {
    display: flex;
    align-items: center;
    gap: 6px;
    align-self: flex-end;
    padding-bottom: 6px;
    color: #2b3440;
    font-size: .9rem;
    cursor: pointer;
}
.filters .btn-clear {
    align-self: flex-end;
    padding-bottom: 7px;
    color: #6b7280;
    font-size: .88rem;
    text-decoration: none;
}
.filters .btn-clear:hover { color: #dc2626; }

.v-badge {
    display: inline-block;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: .8rem;
    white-space: nowrap;
    font-weight: 600;
}
.v-good { background: #e0f7e6; color: #1e7e34; }
.v-mid  { background: #fff3d6; color: #b45309; }
.v-bad  { background: #fdecec; color: #b91c1c; }

/* ---------- v1.3: 录入页实时净利预估卡 ---------- */
.live-result {
    margin: 6px 0 16px;
    background: #f4f8ff;
    border: 1px solid #cfe0f7;
    border-radius: 12px;
    padding: 14px 18px;
}
.lr-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;
    align-items: start;
}
.lr-cols h3 {
    margin: 0 0 8px;
    font-size: 0.98rem;
    color: #2b3440;
}
.lr-table { border-collapse: collapse; width: 100%; }
.lr-table td {
    padding: 3px 0;
    font-size: 0.9rem;
    border: none;
}
.lr-table td.num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.lr-bottom td { border-top: 1px solid #cfe0f7 !important; padding-top: 7px !important; font-size: 1rem; }
.lr-verdict-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 700px) {
    .lr-cols { grid-template-columns: 1fr; gap: 14px 0; }
}

/* ---------- v1.4: 首页表格加宽 + 大图详情弹窗 + 详情页 ---------- */
.container { max-width: 1280px; }
.thumb-box { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 88px; height: 88px; }
.thumb {
    width: 88px; height: 88px;
    border-radius: 10px;
}
.no-thumb {
    display: inline-flex; align-items: center; justify-content: center;
    width: 88px; height: 88px; border-radius: 10px;
    background: #eef1f6; color: #9aa6b5; font-size: 1.3rem; flex: none;
}
.prod-cell.clickable { cursor: pointer; }
.prod-cell.clickable:hover .thumb { outline: 3px solid #2c7df0; outline-offset: 1px; }
.p-name { font-weight: 600; color: #1f2937; }
.comp { display: block; }
.p-note {
    display: block; color: #6b7280; font-size: .78rem;
    max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-actions form { display: inline; }
.row-actions .btn-danger { font-size: .78rem; padding: 2px 8px; margin-left: 6px; }
.btn-ghost {
    background: transparent; color: #2c7df0; border: 1px solid #c9d8f5;
    border-radius: 6px; padding: 2px 8px; cursor: pointer; font-size: .8rem;
    text-decoration: none; display: inline-block;
}
.btn-ghost:hover { background: #eef4ff; }
.btn-link { color: #2c7df0; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }

/* 弹窗 */
.modal-mask[hidden] { display: none; }   /* hidden 属性优先,别让 display:flex 盖掉 */
.modal-mask {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; padding: 20px;
}
.modal-box {
    position: relative; max-width: 760px; width: 100%; max-height: 90vh; overflow: auto;
    background: #fff; border-radius: 16px; padding: 22px;
    box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.modal-x {
    position: sticky; top: 0; float: right; margin-left: 8px;
    border: none; background: #f1f4f9; color: #334155; cursor: pointer;
    width: 30px; height: 30px; border-radius: 50%; font-size: .95rem;
}
.modal-x:hover { background: #e2e8f0; }
.card-note { color: #6b7280; font-size: .9rem; line-height: 1.7; margin: 4px 0; }
.card-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
.card-img img { width: 100%; max-height: 300px; object-fit: cover; border-radius: 12px; background: #f4f6fa; }
.card-body .detail-tags { margin: 0 0 6px; }
.card-name { font-size: 1.25rem; font-weight: 700; margin: 6px 0 10px; }
.mini-table { box-shadow: none; border-radius: 8px; }
.mini-table td { font-size: .88rem; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
@media (max-width: 640px) {
    .card-grid { grid-template-columns: 1fr; }
}

/* 详情页 */
.detail-wrap { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 28px; align-items: start; }
.detail-img img {
    width: 100%; border-radius: 14px; background: #f4f6fa;
    max-height: 420px; object-fit: cover;
}
.detail-img { position: sticky; top: 16px; }
.detail-main h1 { margin: 0 0 6px; }
.detail-tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.detail-table { box-shadow: none; border-radius: 10px; margin: 6px 0 4px; max-width: 480px; }
.detail-table th { width: 130px; background: transparent; color: #6b7280; font-weight: 400; }
.detail-table td { font-weight: 600; }
.profit-rows { background: #f4f8ff; border: 1px solid #cfe0f7; border-radius: 12px; padding: 12px 16px; max-width: 480px; }
.p-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: .95rem; }
.p-row.total { border-top: 1px solid #cfe0f7; margin-top: 5px; padding-top: 8px; font-size: 1.05rem; }
.p-row .dim { color: #6b7280; font-weight: 400; }
.p-row b { font-variant-numeric: tabular-nums; }
.detail-note {
    background: #fffaf0; border: 1px solid #f3e2bf; border-radius: 10px;
    padding: 12px 16px; line-height: 1.8; max-width: 560px;
}
.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
@media (max-width: 760px) {
    .detail-wrap { grid-template-columns: 1fr; }
    .detail-img { position: static; }
}

/* ---------- 弹窗里的比价(fetch 注入卡片用) ---------- */
.card-quotes { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e2e0d5; }
.cq-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cq-table th { text-align: left; color: #8a7b52; font-size: 11.5px; font-weight: 600;
               border-bottom: 1px solid #e2e0d5; padding: 4px 5px; }
.cq-table td { border-bottom: 1px solid #f1efe7; padding: 5px; vertical-align: top; }
.cq-table tr.cq-best { background: #f6ffed; }
.cq-star { color: #237804; }
.cq-cur { display: inline-block; margin-left: 4px; background: #eef6ff; color: #1677ff;
          border: 1px solid #b6d9ff; border-radius: 999px; padding: 0 5px; font-size: 10px; }
.cq-dim { color: #8a7b52; font-size: 11.5px; }
.cq-form { display: grid; grid-template-columns: 1.4fr .8fr .8fr .8fr auto; gap: 5px; margin-top: 10px; }
.cq-form input { padding: 5px 7px; border: 1px solid #cfcabd; border-radius: 8px; font-size: 12.5px; min-width: 0; }
.cq-form button { padding: 5px 10px; font-size: 12.5px; white-space: nowrap; }
@media (max-width: 760px) {
    .cq-form { grid-template-columns: 1fr 1fr; }
}

/* ---------- 手机端:列表从 11 列表格变成一张张卡片 ----------
   桌面端横着看 11 列没问题;手机屏只有 375px 宽,横拖到"净利"那列时
   已经不知道看的是哪一行了。所以窄屏下把每行拆成一张竖着的卡片,
   每个数字前面用 data-label 补回它原来表头写的名字(不然只剩一个数字看不懂)。 */
@media (max-width: 820px) {
    .list-table thead { display: none; }        /* 表头不要了,名字下方会补 */
    .list-table { background: transparent; box-shadow: none; border-radius: 0; }
    .list-table, .list-table tbody, .list-table tr, .list-table td { display: block; width: 100%; }

    .list-table tr {
        background: #fff; border: 1px solid #e7ecf3; border-radius: 12px;
        margin-bottom: 12px; padding: 10px 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,.06);
    }
    .list-table td {
        border: none; padding: 6px 0;
        display: flex; justify-content: space-between; align-items: center; gap: 12px;
    }
    /* 每个数字前面自动补上"净利""净利率"这类小标签 */
    .list-table td::before {
        content: attr(data-label);
        color: #8a94a6; font-size: .78rem; font-weight: 600; flex: none;
    }
    /* 产品名那一格当标题用:占满整行,不加标签 */
    .list-table td.prod-cell {
        display: flex; justify-content: flex-start;
        border-bottom: 1px dashed #eef1f5; padding-bottom: 10px; margin-bottom: 2px;
    }
    .list-table td.prod-cell::before { content: none; }
    .list-table .p-name { font-size: 1.05rem; }
    .list-table .p-note { max-width: none; white-space: normal; }
    /* 删除/详情按钮靠右,同样不要标签 */
    .list-table td.row-actions { justify-content: flex-end; gap: 8px; padding-top: 10px; }
    .list-table td.row-actions::before { content: none; }

    /* 缩略图小一点,给文字腾地方 */
    .thumb-box, .thumb { width: 68px; height: 68px; }
    .no-thumb { width: 68px; height: 68px; }

    /* 筛选条在手机上竖着排,每个控件占满一行,手指好点 */
    .filters { flex-direction: column; align-items: stretch; gap: 8px; }
    .filters label, .filters label.chk { align-self: stretch; padding-bottom: 0; }
    .filters .f-search { width: 100%; }
    .filters select { width: 100%; }
    .filters .btn-clear, .filters .btn-ghost { align-self: stretch; text-align: center; }

    /* 顶栏在手机上会挤成一团,允许换行 */
    .topbar { flex-wrap: wrap; gap: 8px; }
    .topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
    .topbar nav a { margin-left: 0; }
    .container { padding: 0 10px; }

    /* 收录表单:输入框加大、字号 ≥16px —— iOS 上小于 16px 一聚焦就自动放大页面,很烦 */
    .card-form { padding: 16px 14px; }
    .card-form input, .card-form select, .card-form textarea {
        font-size: 16px; padding: 11px 10px;
    }
    .mode-switch { flex-direction: column; align-items: stretch; }
    .mode-switch button { width: 100%; padding: 11px; }
    .btn-big { width: 100%; }

    /* 测款方案那张表列太多,手机上同样拆成卡片(和首页列表一个套路) */
    .plan-tbl thead, .plan-tbl tfoot { display: none; }
    .plan-tbl, .plan-tbl tbody, .plan-tbl tr, .plan-tbl td { display: block; width: 100%; }
    .plan-tbl tr {
        background: #fff; border: 1px solid #e7ecf3; border-radius: 12px;
        margin-bottom: 12px; padding: 8px 12px;
    }
    .plan-tbl td {
        border: none; padding: 5px 0;
        display: flex; justify-content: space-between; align-items: center; gap: 12px;
    }
    .plan-tbl td::before {
        content: attr(data-label);
        color: #8a94a6; font-size: .78rem; font-weight: 600; flex: none;
    }
    .plan-tbl td.pl-no { display: none; }                    /* 序号在卡片上没意义 */
    .plan-tbl td.pl-name { border-bottom: 1px dashed #eef1f5; padding-bottom: 9px; }
    .plan-tbl td.pl-name::before { content: none; }
    .plan-tbl .why { display: block; }
    .budget-form { flex-direction: column; align-items: stretch; }
    .budget-form input { width: 100%; }
}

/* ==================== 类目:赚钱榜 + 一键填写 ==================== */
/* 数字往右靠、不折行 —— 一列数字左对齐的话根本没法竖着比大小 */
.numb { text-align: right; white-space: nowrap; }
.good { color: #1e7e34; font-weight: 700; }

/* 首页那个可折叠的"类目赚钱榜" */
.cat-board { margin: 12px 0 16px; }
.cat-board > summary { cursor: pointer; font-weight: 700; font-size: 15px; padding: 6px 0; }
.cat-board > summary:hover { color: #2c7df0; }
.cat-note { color: #6b7280; font-size: 0.85rem; line-height: 1.75; margin: 8px 0; }

/* 录入页/编辑页:点一下就填进类目输入框的小圆钮。
   鼠标停上去能看说明(title),所以它是"清单"也是"选品提示"。 */
.cat-picks > summary { cursor: pointer; font-size: 0.88rem; color: #2c7df0; padding: 2px 0; }
.cat-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0 4px; }
.cat-chip { border: 1px solid #d6d0c4; background: #fff; border-radius: 999px;
            padding: 4px 11px; font-size: 13px; cursor: pointer; color: #444;
            font-family: inherit; line-height: 1.5; }
.cat-chip:hover { border-color: #2c7df0; color: #2c7df0; background: #f4f8ff; }

/* 查价链接那一排:预售价旁边,点一下就去当地平台搜同款 */
.price-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 7px; }
.price-links a { font-size: 12.5px; padding: 3px 10px; border: 1px solid #cfe0f7;
                 background: #f4f8ff; color: #1f5fb8; border-radius: 999px;
                 text-decoration: none; white-space: nowrap; }
.price-links a:hover { background: #e5f0ff; border-color: #8fbdf0; }
.price-links .pl-note { font-size: 12px; color: #9aa2ae; }
/* display:flex 会盖掉 hidden 的效果,得显式写一条 —— 否则录入页还没打品名时
   那一整行"当地卖多少"会挂在那儿,后面跟着一串空链接 */
.price-links[hidden] { display: none; }

/* ==================== 预售价的「来源核实」 ====================
   核心是一句话:售价是估的,后面所有净利都是估的。
   所以这套样式只干一件事 —— 让"这个价到底可不可信"在页面上扎眼。 */
.src-badge { font-size: 11.5px; padding: 1px 8px; border-radius: 999px;
             margin-left: 6px; font-weight: 600; white-space: nowrap; }
.src-badge.bad { background: #fff4e5; border: 1px solid #f0c48a; color: #a35a00; }
.src-badge.ok { background: #eaf7ee; border: 1px solid #a9d9b8; color: #1e7e34; }

/* 首页顶上那条全库警示 —— 它不属于筛选条,是"地基"问题 */
.src-alert { background: #fff8e6; border: 1px solid #f0dcae; border-radius: 10px;
             padding: 10px 14px; font-size: 13.5px; line-height: 1.75; margin: 12px 0; }
.src-alert a { color: #a35a00; font-weight: 700; }

/* 详情页那个来源块 */
.src-box { border-radius: 10px; padding: 10px 14px; margin: 12px 0;
           font-size: 13.5px; line-height: 1.7;
           border: 1px solid #e2e0d5; background: #fafaf7; }
.src-box.src-bad { background: #fff8e6; border-color: #f0dcae; }
.src-box.src-ok { background: #f2faf5; border-color: #b9e0c6; }
.src-line { margin: 0 0 6px; }
.src-form { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; margin: 8px 0 0; }
.src-form label { font-size: 12.5px; color: #555; font-weight: 600; }
.src-form input, .src-form select { width: auto; min-width: 148px; padding: 6px 8px;
                                    border: 1px solid #ccd4e0; border-radius: 8px; font-size: 13px; }
.src-form button { padding: 7px 14px; font-size: 13px; }

/* 赚钱榜里"这一行一个价都没核过" → 整行压暗,提醒别照着它下判断 */
.row-unsure td { opacity: .6; }
.row-unsure td:first-child { opacity: 1; font-weight: 600; }
.numb.bad { color: #c0392b; font-weight: 700; }
