:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --primary: #2f6fed;
    --primary-d: #245ad1;
    --text: #2c3e50;
    --text-weak: #8a94a6;
    --border: #e8eaed;
    --price: #e74c3c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ---------- 登录页 ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--card);
    border-radius: 14px;
    padding: 36px 28px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    text-align: center;
}
.login-card__title {
    margin: 0 0 6px;
    font-size: 22px;
}
.login-card__sub {
    margin: 0 0 22px;
    color: var(--text-weak);
    font-size: 14px;
}
.login-card__input {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color .2s;
}
.login-card__input:focus { border-color: var(--primary); }
.login-card__btn {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    font-size: 15px;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s;
}
.login-card__btn:hover { background: var(--primary-d); }
.alert {
    background: #fdecea;
    color: #c0392b;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 14px;
}

/* ---------- 顶栏 ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.topbar__title { font-size: 17px; font-weight: 600; }
.btn-logout {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    transition: background .2s;
}
.btn-logout:hover { background: rgba(255, 255, 255, 0.15); }

/* ---------- 容器 ---------- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

/* ---------- 搜索框 ---------- */
.search {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.search__input {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    background: var(--card);
}
.search__input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}
.search__btn {
    padding: 0 26px;
    font-size: 15px;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background .2s;
}
.search__btn:hover { background: var(--primary-d); }

/* ---------- 最近查询 ---------- */
.recent {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}
.recent__label {
    font-size: 13px;
    color: var(--text-weak);
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 200px;
    padding: 5px 10px 5px 6px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: border-color .2s, background .2s;
}
.chip:hover { border-color: var(--primary); background: #f3f7ff; }
.chip img, .chip__ph {
    width: 26px; height: 26px;
    border-radius: 50%;
    object-fit: cover;
    background: #eef0f3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.chip__t {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- 结果卡片 ---------- */
.results {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.card {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.card__head {
    display: flex;
    gap: 14px;
}
.card__img {
    width: 110px;
    height: 110px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #eef0f3;
}
.card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__img-ph {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #c2c8d0;
}
.card__info { flex: 1; min-width: 0; }
.card__title {
    margin: 0 0 10px;
    font-size: 16px;
    line-height: 1.4;
}
.meta {
    display: flex;
    font-size: 13px;
    line-height: 1.9;
}
.meta__k {
    width: 64px;
    color: var(--text-weak);
    flex-shrink: 0;
}
.meta__v { color: var(--text); word-break: break-all; }

/* ---------- SKU 表 ---------- */
.sku {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    font-size: 13px;
}
.sku th, .sku td {
    padding: 9px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.sku th {
    background: #f7f8fa;
    color: #555;
    font-weight: 600;
}
.sku__price {
    color: var(--price);
    font-weight: 600;
    white-space: nowrap;
}
.sku th:last-child { text-align: right; }
.sku__stock {
    text-align: right;
    font-weight: 600;
    color: #27ae60;
    white-space: nowrap;
}

/* ---------- 费用横幅（与管理端报表一致） ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    padding: 25px;
    border-radius: 8px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}
.stat-card.purple { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-card.pink { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-card.blue { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.stat-card.green { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.stat-card.orange { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.stat-card.cyan { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); }
.stat-card.teal { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); color: #333; }
.stat-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
}
.stat-value {
    font-size: 32px;
    font-weight: bold;
}

/* ---------- 费用提示 ---------- */
.fees {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}
.fees__item {
    font-size: 12px;
    color: var(--text-weak);
    background: #f7f8fa;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
}

/* ---------- 空态 ---------- */
.empty {
    text-align: center;
    color: var(--text-weak);
    padding: 50px 0;
    font-size: 15px;
}
.empty--sm {
    padding: 18px 0;
    font-size: 13px;
}

/* ---------- 手机端 ---------- */
@media (max-width: 768px) {
    .results { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 14px 16px; }
    .stat-value { font-size: 20px; }
    .stat-label { font-size: 12px; margin-bottom: 6px; }
    .container { padding: 14px; }
    .card__img { width: 88px; height: 88px; }
    .search__btn { padding: 0 18px; }
    .chip { max-width: 46vw; }
}
