:root {
    --bg: #f0f2f5;
    --card: #ffffff;
    --muted: #6c757d;
    --text: #212529;
    --primary: #007bff;
    --primary-600: #0069d9;
    --success: #28a745;
    --danger: #dc3545;
    --border: #dee2e6;
    --accent: #ffc107;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
                 "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", Arial, sans-serif;
}

.site-header, .site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(6px);
}
.site-footer {
    border-top: 1px solid var(--border);
    border-bottom: none;
    font-size: 12px;
    color: var(--muted);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-logo { font-size: 20px; }
.brand-name { letter-spacing: 0.5px; }

.nav { display: flex; gap: 8px; }
.nav-btn {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
}
.nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.nav-btn .badge { margin-left: 6px; background: var(--primary); color: white; border-radius: 6px; padding: 2px 6px; }

.container {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
}

.toolbar {
    display: grid;
    grid-template-columns: 1fr 160px 160px;
    gap: 12px;
    margin-bottom: 16px;
}
.toolbar input, .toolbar select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
}

.view { display: none; }
.view.active { display: block; }

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .grid { grid-template-columns: 1fr; } }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #f8f9fa;
}
.card-content { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.card-title { font-size: 16px; font-weight: 600; }
.card-desc { font-size: 13px; color: var(--muted); height: 34px; overflow: hidden; }
.card-meta { display: flex; align-items: center; justify-content: space-between; }
.price { color: var(--danger); font-weight: 700; }
.badges { display: flex; gap: 8px; font-size: 12px; color: var(--muted); }

.card-actions { display: flex; gap: 8px; margin-top: 8px; }
.btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-600); }
.btn.secondary { border-color: var(--border); color: var(--text); }
.btn.secondary:hover { border-color: var(--primary); color: var(--primary); }

.empty {
    padding: 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--muted);
    text-align: center;
}

#cart-items { display: flex; flex-direction: column; gap: 10px; }
.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
}
.cart-item img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }
.cart-item h4 { margin: 0; font-size: 15px; }
.cart-item .muted { color: var(--muted); font-size: 12px; }

.qty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 6px;
}
.qty button {
    background: transparent;
    color: var(--text);
    border: none;
    cursor: pointer;
    font-size: 16px;
}
.qty input {
    width: 40px;
    text-align: center;
    background: transparent;
    color: var(--text);
    border: none;
}

.cart-summary {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: var(--card);
}
.cart-summary .line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}
.cart-summary .line.total { border-bottom: none; font-weight: 700; }
.cart-summary .actions { display: flex; gap: 8px; margin-top: 12px; }

.form-row { display: grid; gap: 8px; margin-bottom: 12px; }
.form-row input, .form-row textarea, .form-row select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
}
.form-row textarea { min-height: 80px; resize: vertical; }

.success {
    padding: 16px;
    border-radius: 12px;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
}
.hidden { display: none; }

.pill-tabs { display: inline-flex; gap: 8px; margin: 8px 0 16px; }
.pill {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: 20px;
    cursor: pointer;
}
.pill.active { border-color: var(--primary); color: var(--primary); background: rgba(0,123,255,0.1); }

.user-status { margin-left: 8px; color: var(--muted); }

.btn.danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn.danger:hover { filter: brightness(0.95); }