* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f4f7fb;
    color: #1f2937;
}
a { color: #374151; text-decoration: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 14px; }

.topbar {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
}
.brand { font-size: 20px; font-weight: 700; color: #111827; }
.nav-links { display: flex; gap: 18px; font-size: 14px; }
.nav-links a {
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.18s ease;
}
.nav-links a:hover {
    background: #f3f4f6;
    color: #111827;
}
.nav-links a.active {
    background: #e0e7ff;
    color: #3730a3;
    font-weight: 600;
}
.actions { display: flex; align-items: center; gap: 8px; }
.menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    font-size: 20px;
    line-height: 1;
    padding: 0;
}
.search-bar input {
    width: 220px;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 0 14px;
}
.btn-ghost, .btn-primary {
    width: auto;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
}
.btn-ghost {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
}
.btn-primary {
    background: #2563eb;
    color: #fff;
    border: 1px solid #2563eb;
}
.btn-mini {
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.5;
}

.page { padding: 16px 0 24px; }
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(17, 24, 39, 0.05);
}
.notice { padding: 16px; margin-bottom: 14px; }
.notice-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.notice h3 { margin: 0; font-size: 17px; }
.notice p { margin: 4px 0; line-height: 1.6; color: #374151; }
#noticeBody.collapsed { display: none; }
.notice-markdown h1,
.notice-markdown h2,
.notice-markdown h3 { margin: 8px 0; }
.notice-markdown ul { margin: 8px 0 8px 18px; padding: 0; }
.notice-markdown li { margin-bottom: 4px; }
.notice-markdown p { margin: 6px 0; }
.notice-markdown a { color: #2563eb; }
.notice-markdown code {
    background: #eef2ff;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    padding: 2px 6px;
}
.notice-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}
.notice-icon {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 3px;
}
.notice-alert {
    margin-top: 8px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 600;
    font-size: 14px;
}
.ok { color: #059669; font-weight: 600; }
.error { color: #dc2626; font-weight: 600; }
.warn { color: #b45309; font-weight: 600; }

.section-title { margin: 14px 0 10px; font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
    padding: 6px 12px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 13px;
    border: 1px solid #c7d2fe;
    cursor: pointer;
    transition: all 0.18s ease;
}
.chip:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
}
.chip.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.product-card {
    padding: 14px;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-link {
    display: block;
    color: inherit;
}
.card-link:hover .info-panel {
    box-shadow: 0 10px 26px rgba(17, 24, 39, 0.1);
}
.product-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
}
.info-panel,
.form-panel {
    padding: 16px;
}
.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(17, 24, 39, 0.1);
}
.product-cover {
    height: 120px;
    border-radius: 10px;
    background: linear-gradient(135deg, #eef2ff, #dbeafe);
    border: 1px solid #dbeafe;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.product-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.product-cover span {
    font-size: 30px;
    color: #3730a3;
    font-weight: 700;
    letter-spacing: 1px;
}
.badges {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.badge {
    font-size: 11px;
    border-radius: 999px;
    padding: 3px 8px;
    font-weight: 600;
}
.badge-auto {
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #6ee7b7;
}
.badge-safe {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fcd34d;
}
.product-name { font-size: 20px; font-weight: 700; margin: 0 0 6px; color: #111827; }
.meta { color: #6b7280; font-size: 13px; margin-bottom: 4px; }
.price { color: #dc2626; font-size: 24px; font-weight: 700; margin: 8px 0 10px; }
.stats-row {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 10px;
}
.stat-item {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}
.stat-item.stock {
    color: #065f46;
    border-color: #a7f3d0;
    background: #ecfdf5;
}
.stat-item.sold {
    color: #9a3412;
    border-color: #fed7aa;
    background: #fff7ed;
}

form.inline-form { display: grid; gap: 8px; }
label { font-size: 13px; color: #4b5563; }
input, select, button, textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 9px 10px;
    background: #fff;
    color: #111827;
}
input[type="number"] { max-width: 120px; }
button {
    width: auto;
    background: #2563eb;
    color: #fff;
    border: 0;
    font-weight: 600;
    cursor: pointer;
    padding: 9px 16px;
    transition: all 0.18s ease;
}
button:hover { background: #1d4ed8; }
form.inline-form button {
    width: 100%;
    background: linear-gradient(90deg, #1d4ed8, #7e22ce);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    padding: 11px 16px;
}
form.inline-form button:hover {
    background: linear-gradient(90deg, #1e40af, #6b21a8);
}

.btn-login::before,
.btn-register::before {
    display: inline-block;
    margin-right: 6px;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    content: "";
    vertical-align: -2px;
}
.btn-login::before {
    background: rgba(107, 114, 128, 0.2);
}
code {
    background: #eef2ff;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    padding: 2px 6px;
}

.query-wrap { margin-top: 14px; }
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
th, td {
    border-bottom: 1px solid #eef2f7;
    padding: 9px;
    text-align: left;
}
th {
    background: #f8fafc;
    color: #334155;
}
.qrcode-group { display: flex; gap: 22px; flex-wrap: wrap; }
.qrcode-group img { max-width: 220px; border: 1px solid #d1d5db; border-radius: 8px; }

@media (max-width: 860px) {
    .topbar-inner { flex-wrap: wrap; }
    .menu-toggle { display: inline-block; order: 2; }
    .nav-links {
        display: none;
        width: 100%;
        order: 4;
        margin-top: 6px;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 6px;
        flex-direction: column;
        gap: 4px;
    }
    .nav-links.open { display: flex; }
    .search-bar input { width: 180px; }
    .actions { width: auto; margin-left: auto; order: 3; }
    .product-cover {
        height: 130px;
    }
}

@media (max-width: 1024px) {
    .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .product-grid { grid-template-columns: 1fr; }
}
