* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f7fa;
    color: #1e293b;
    line-height: 1.5;
}

/* 登录页 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}
.login-card .logo {
    width: 120px;
    margin-bottom: 20px;
}
.login-card h2 {
    margin-bottom: 20px;
    color: #1e293b;
}
.login-card input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    margin-bottom: 20px;
}
.login-card button {
    width: 100%;
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.login-card button:hover {
    background: #2563eb;
}
.error {
    color: #ef4444;
    margin-top: 15px;
    font-size: 0.9rem;
}

/* 通用头部 */
.app header {
    background: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}
.logo-area .logo {
    height: 40px;
}
.user-info {
    text-align: right;
    font-size: 0.9rem;
    background: #f1f5f9;
    padding: 8px 15px;
    border-radius: 30px;
}
.user-info strong {
    font-size: 1rem;
}

/* 主内容 */
main {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}
h1, h2 {
    margin-bottom: 20px;
    font-weight: 600;
}
.warning {
    background: #fef9c3;
    border-left: 5px solid #eab308;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 12px;
}
.warning button {
    background: #eab308;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    margin-top: 10px;
    cursor: pointer;
}

/* 产品网格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    min-height: 420px; /* 根据实际调整 */
}
.product-card:hover {
    transform: translateY(-4px);
}
.product-img img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #f1f5f9;
}
.product-info {
    padding: 15px;
}
.product-info h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}
.product-info p {
    margin: 6px 0;
    font-size: 0.9rem;
}
.quantity-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}
.quantity-control button {
    background: #e2e8f0;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    font-weight: bold;
}
.quantity-control input {
    width: 60px;
    text-align: center;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px;
    font-size: 1rem;
}
.action-bar {
    margin: 30px 0;
    text-align: right;
}
.btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 40px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}

/* 销售情况页面 */
.stats-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    flex: 1;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.big-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #3b82f6;
}
canvas {
    max-width: 100%;
    background: white;
    border-radius: 16px;
    padding: 15px;
    margin-bottom: 30px;
}
.inventory-table {
    overflow-x: auto;
}
table {
    width: 100%;
    background: white;
    border-radius: 16px;
    border-collapse: collapse;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
th {
    background: #f1f5f9;
    font-weight: 600;
}
tr:hover {
    background: #f8fafc;
}

/* 折扣选择页 */
.discount-container {
    max-width: 600px;
    margin: 80px auto;
    background: white;
    border-radius: 24px;
    padding: 30px;
    text-align: center;
}
.discount-options {
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.option {
    background: #f1f5f9;
    padding: 12px;
    border-radius: 40px;
    font-weight: 500;
}
.discount-container button {
    background: #3b82f6;
    border: none;
    padding: 12px 24px;
    border-radius: 40px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
}

/* 后台表格 */
.admin-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px;
    background: white;
    border-radius: 24px;
}
.success {
    color: #16a34a;
    background: #dcfce7;
    padding: 10px;
    border-radius: 12px;
    margin-bottom: 15px;
}

/* 响应式 */
@media (max-width: 640px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    .stats-summary {
        flex-direction: column;
    }
    .app header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .user-info {
        text-align: center;
    }
    .action-bar {
        text-align: center;
    }
}

.action-bar-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    padding: 12px 20px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    text-align: right;
}
main {
    padding-bottom: 80px;
}

.identity-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    color: white;
    text-align: center;
}
.identity-info {
    font-size: 1.2rem;
}
.identity-label {
    font-weight: 500;
}
.identity-title {
    font-size: 1.4rem;
    margin: 0 10px;
}
.identity-discount {
    font-size: 1rem;
    opacity: 0.9;
}

.action-bar-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    padding: 12px 20px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    text-align: right;
}
main {
    padding-bottom: 80px;
}
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}
.cat-btn {
    background: #f1f5f9;
    border: none;
    padding: 6px 16px;
    border-radius: 30px;
    cursor: pointer;
}
.cat-btn.active {
    background: #3b82f6;
    color: white;
}
.user-identity {
    background: #e6f7ff;
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    text-align: center;
}
.credit-info {
    margin-top: 8px;
    font-weight: bold;
    color: #2c7a4d;
    text-align: center;
}