﻿/* 基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    min-height: 100vh;
}

.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* 登录页面 */
.login-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    min-height: 100vh;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container.has-custom-background {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#loginPage {
    position: fixed;
    inset: 0;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-title {
    display: block;
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.login-subtitle {
    display: block;
    text-align: center;
    font-size: 16px;
    color: var(--muted);
    margin-bottom: 32px;
    font-weight: 500;
}

.form-label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.login-hint {
    display: block;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
    margin-top: 24px;
    line-height: 1.5;
}

.login-admin-entry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.login-admin-entry:hover {
    color: var(--primary-strong);
    transform: translateX(4px);
}

/* 主界面 */
.user-bar {
    background: linear-gradient(135deg, #1565c0, #1976d2);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.site-title-bar {
    background: #fff;
    color: #2c3e50;
    padding: 16px 20px;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.admin-entry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    color: #1d4ed8;
    background: #eff6ff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.admin-entry:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.welcome-text {
    font-size: 15px;
    opacity: 0.9;
}

.welcome-name {
    font-weight: 600;
    color: #ffca28;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* 步骤导航 */
.step-nav {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 16px;
}

.step-item {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.step-item.active .step-icon {
    background: #3498db;
    color: #fff;
}

.step-item.active .step-label {
    color: #3498db;
    font-weight: 600;
}

.step-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    border-radius: 50%;
    background: #ecf0f1;
    color: #95a5a6;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.step-label {
    font-size: 12px;
    color: #7f8c8d;
}

/* 步骤内容 */
.step-content {
    display: none;
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.step-content.active {
    display: block;
}

.form-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card-title {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ecf0f1;
}

/* 搜索模式切换 */
.search-mode-switcher {
    display: flex;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
}

.mode-item {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-size: 14px;
    color: #7f8c8d;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.mode-item.active {
    background: #fff;
    color: #3498db;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.product-search {
    width: 100%;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 16px;
    font-size: 14px;
}

.product-search:focus {
    outline: none;
    border-color: #3498db;
}

.cart-footer-btns {
    display: flex;
    gap: 14px;
    margin-top: 24px;
}

.btn-submit, .btn-clear {
    flex: 1;
    height: 50px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    letter-spacing: 0.02em;
}

.btn-submit {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-strong) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #34d399 0%, var(--green) 100%);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.btn-clear {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-strong) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-clear:hover:not(:disabled) {
    background: linear-gradient(135deg, #f87171 0%, var(--red) 100%);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.brand-filter {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    /* 为突出标签的数量角标留出空间，避免滚动容器裁切。 */
    padding-top: 12px;
    padding-right: 10px;
    padding-bottom: 14px;
    margin-bottom: 18px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.brand-filter::-webkit-scrollbar {
    height: 6px;
}

.brand-filter::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 3px;
}

.brand-filter::-webkit-scrollbar-track {
    background: var(--surface-soft);
}

.brand-chip {
    flex-shrink: 0;
    padding: 8px 18px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 999px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
}

.brand-chip:hover {
    background: var(--surface-hover);
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.brand-chip.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}
.category-filter { margin: -8px 0 18px; }
.category-filter label { display:flex; align-items:center; gap:10px; color:var(--text-secondary); font-weight:600; font-size:14px; }
.category-filter select { min-width:220px; padding:9px 12px; border:2px solid var(--line); border-radius:8px; background:var(--surface); color:var(--text-primary); font-size:14px; }
.filter-count { position: absolute; top: -7px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 10px; background: var(--red, #ef4444); color: #fff; font-size: 10px; line-height: 18px; text-align: center; }
.brand-chip { position: relative; }

/* 商品网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    padding-bottom: 28px;
}

.product-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.product-card.ordered {
    border: 2px solid #16a34a;
    background: #f0fdf4;
}

.product-card.ordered:hover {
    border-color: #15803d;
}

.product-ordered-badge {
    position: absolute;
    right: 8px;
    bottom: 58px;
    background: #16a34a;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 5px 8px;
    border-radius: 999px;
    font-weight: 700;
    box-shadow: 0 5px 12px rgba(22, 163, 74, 0.22);
    z-index: 2;
}

.product-card.hot-product {
    border-color: #fb923c;
    box-shadow: 0 5px 16px rgba(234, 88, 12, 0.2);
}

.product-hot-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 5px 9px;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, #ff6b00, #dc2626);
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.35);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
}

.product-hot-badge span {
    font-size: 14px;
    line-height: 1;
}

.modal-hot-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 4px 9px;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, #ff6b00, #dc2626);
    font-size: 12px;
    font-weight: 800;
    vertical-align: middle;
}

@media (max-width: 600px) {
    #modalProductCode {
        font-size: 19px;
    }

    .order-modal-brand {
        font-size: 12px;
    }
}

.product-img-placeholder, .product-img {
    width: 100%;
    height: 120px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #95a5a6;
    font-size: 12px;
}

.product-img {
    object-fit: cover;
}

.product-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.product-qty {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(52, 152, 219, 0.9);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.product-card-info {
    padding: 12px;
}

.product-card-code {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}

.product-card-price {
    display: block;
    font-size: 14px;
    color: #e74c3c;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
    font-size: 14px;
}

/* 购物车表格 */
.cart-search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
    width: 100%;
}

.cart-code-search {
    flex: 1;
    min-width: 0;
    height: 48px;
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    padding: 0 18px;
    font-size: 16px;
    background: var(--surface);
    font-weight: 500;
}

.cart-code-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.cart-search-clear {
    flex: 0 0 60px;
    width: 60px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0;
    background: var(--red);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.cart-search-clear:hover {
    background: var(--red-strong);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.cart-search-clear:active {
    transform: translateY(0);
}

.cart-filter-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    margin-bottom: 18px;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}

.filter-chip {
    flex-shrink: 0;
    padding: 8px 18px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 999px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
}

.filter-chip:hover {
    background: var(--surface-hover);
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.filter-chip.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.stats-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
}

.stat-label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    margin-top: 6px;
}

.stats-section {
    margin-bottom: 36px;
}

.stats-section:last-child {
    margin-bottom: 0;
}

.cart-table-container {
    overflow-x: auto;
    margin-bottom: 24px;
    border-radius: var(--radius-md);
    -webkit-overflow-scrolling: touch;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.cart-table th {
    background: var(--surface-soft);
    color: var(--text-secondary);
    padding: 14px 10px;
    text-align: center;
    font-weight: 700;
    border-bottom: 2px solid var(--line);
    position: sticky;
    top: 0;
    display: table-cell;
    font-size: 13px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.cart-table td {
    padding: 14px 10px;
    text-align: center;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    word-break: keep-all;
}

.cart-table tbody tr {
    transition: all var(--transition-fast);
}

.cart-table tbody tr:hover {
    background: var(--surface-soft);
}

.h-image { width: 64px; }
.h-code { width: 130px; }
.h-color { width: 80px; }
.h-qty { width: 60px; }
.h-amount { width: 90px; }
.h-remove { width: 60px; }

.cart-image-cell {
    padding: 8px !important;
}

.cart-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    display: block;
    margin: 0 auto;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    transition: all var(--transition-fast);
}

.cart-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.cart-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 11px;
}

.cart-code-link {
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 700;
    padding: 0;
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.cart-code-link:hover {
    color: var(--primary-strong);
    text-decoration: underline;
}

.cart-remove-icon {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #fef2f2;
    color: var(--red);
    font-size: 22px;
    line-height: 28px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.cart-remove-icon:hover {
    background: var(--red);
    color: #fff;
    transform: scale(1.1) rotate(-10deg);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.cart-row-amount {
    color: var(--red);
    font-weight: 700;
    font-size: 15px;
}

.cart-total-row td {
    font-weight: 700;
    background: var(--surface-soft);
    border-top: 3px solid var(--line-strong);
    font-size: 15px;
    padding: 16px 10px;
}

.total-label {
    text-align: right;
    padding-right: 20px !important;
    color: var(--text);
}

.total-qty, .total-amount {
    color: var(--red);
    font-weight: 800;
    font-size: 16px;
}

.cart-footer-btns {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-submit, .btn-clear {
    flex: 1;
    height: 44px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit {
    background: #27ae60;
    color: #fff;
}

.btn-submit:hover {
    background: #219653;
}

.btn-clear {
    background: #e74c3c;
    color: #fff;
}

.btn-clear:hover {
    background: #c0392b;
}

/* 统计样式 */
.stats-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    flex: 1;
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stat-num {
    font-size: 28px;
    font-weight: 700;
    color: #3498db;
    margin-bottom: 4px;
}

.stat-num-red {
    color: #e74c3c;
}

.stat-label {
    font-size: 12px;
    color: #95a5a6;
}

.stats-section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ecf0f1;
}

.pie-chart-wrap {
    height: 200px;
    margin-bottom: 16px;
    position: relative;
}

.pie-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-name {
    font-size: 12px;
    color: #666;
}

.stats-table table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th {
    background: #f8f9fa;
    color: #666;
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
    display: table-cell;
}

.stats-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    display: table-cell;
}

.stats-main-row {
    cursor: pointer;
}

.stats-main-row:hover td {
    background: #f8fbff;
}

.stats-main-row.expanded td {
    background: #eef7ff;
}

.stats-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    border-radius: 50%;
    background: #e8f4ff;
    color: #1565c0;
    font-weight: 700;
    font-size: 13px;
}

.stats-link {
    color: #1565c0;
    font-weight: 700;
    cursor: pointer;
}

.stats-link:hover {
    text-decoration: underline;
}

.stats-sort-btn {
    border: none;
    background: #e8f4ff;
    color: #1565c0;
    border-radius: 999px;
    padding: 5px 10px;
    font-weight: 700;
    cursor: pointer;
}

.stats-detail-row td {
    background: #fbfcfe;
    padding: 12px;
}

.stats-detail-content {
    text-align: left;
    overflow-x: auto;
}

.stats-detail-title {
    font-size: 13px;
    font-weight: 700;
    color: #2c3e50;
    margin: 6px 0 8px;
}

.stats-mini-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 12px;
}

.stats-mini-table th,
.stats-mini-table td {
    padding: 8px;
    border-bottom: 1px solid #edf2f7;
    text-align: center;
    white-space: nowrap;
}

.stats-mini-table th {
    background: #f1f5f9;
    color: #475569;
}

.stats-detail-empty {
    color: #95a5a6;
    font-size: 12px;
    padding: 8px 0;
}

.stats-detail-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
}

.stats-detail-filter label {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.stats-detail-filter select {
    flex: 1;
    height: 38px;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #fff;
    padding: 0 10px;
    font-size: 14px;
}

.stats-col-wide {
    text-align: left !important;
    padding-left: 16px !important;
}

.brand-clickable {
    color: #3498db;
    cursor: pointer;
    text-decoration: underline;
}

.brand-clickable:hover {
    color: #2980b9;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.order-modal, .brand-detail-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.order-modal-header, .brand-detail-header {
    background: linear-gradient(135deg, #1565c0, #1976d2);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.order-modal-title, .brand-detail-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.order-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

.order-modal-product-info {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    align-items: center;
}

.order-modal-img-placeholder, .order-modal-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #95a5a6;
    font-size: 12px;
    flex-shrink: 0;
}

.order-modal-img {
    object-fit: cover;
}

.order-modal-product-details {
    flex: 1;
}

.order-modal-brand {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 6px;
}

.order-modal-code {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: #111827;
    line-height: 1.2;
}

.order-modal-code-label {
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
}

#modalProductCode {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 0.3px;
    word-break: break-all;
}

.modal-section {
    margin-bottom: 20px;
}

.color-btn-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-btn {
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn.selected {
    background: #3498db;
    border-color: #3498db;
    color: #fff;
    font-weight: 600;
}

.store-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
}

.store-card {
    position: relative;
    padding: 12px 10px;
    background: #f8f9fa;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.store-card:hover {
    border-color: #90caf9;
}

.store-card.selected {
    background: #e3f2fd;
    border-color: #1565c0;
    box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.12);
}

.store-card-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    word-break: break-all;
}

.store-card.selected .store-card-name {
    color: #1565c0;
}

.store-card-qty {
    margin-top: 6px;
    font-size: 12px;
    color: #999;
}

.store-card.has-qty .store-card-qty {
    color: #e74c3c;
    font-weight: 600;
}

.store-card-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 20px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.store-hint {
    font-size: 12px;
    color: #999;
}

.size-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.hand-code-badge {
    background: #ffca28;
    color: #333;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.btn-hand {
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-hand:hover {
    background: #2980b9;
}

.size-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.size-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.size-label {
    font-size: 12px;
    color: #666;
}

.size-input {
    width: 100%;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 14px;
    text-align: center;
}

.order-summary {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
}

.summary-item {
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 12px;
    color: #95a5a6;
    margin-bottom: 4px;
}

.summary-value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.summary-amount {
    color: #e74c3c;
}

.modal-btn-row {
    margin-top: 20px;
}

.btn-modal-add {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: #27ae60;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-modal-add:hover:not(:disabled) {
    background: #219653;
}

.btn-modal-add:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* 品牌详情弹窗 */
.brand-detail-content {
    max-width: 600px;
}

.brand-back-btn {
    display: block;
    width: 100%;
    text-align: center;
    color: #3498db;
    font-size: 14px;
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.brand-back-btn:hover {
    background: #f8f9fa;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .stats-summary {
        flex-direction: column;
    }
    
    .cart-footer-btns {
        flex-direction: column;
    }
    
    .step-nav {
        padding: 0 8px;
    }
    
    .step-label {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .form-card {
        padding: 16px;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .size-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
}

.image-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

/* ===== Visual refresh 2026-09 Enhanced ===== */
:root {
    --bg: #f8f9fc;
    --surface: #ffffff;
    --surface-soft: #f9fafb;
    --surface-hover: #f1f3f9;
    --line: #e2e5ef;
    --line-strong: #d1d5db;
    --text: #1e293b;
    --text-secondary: #475569;
    --muted: #64748b;
    --primary: #6366f1;
    --primary-strong: #4f46e5;
    --primary-light: #818cf8;
    --primary-bg: #eef2ff;
    --teal: #14b8a6;
    --teal-light: #5eead4;
    --green: #10b981;
    --green-strong: #059669;
    --red: #ef4444;
    --red-strong: #dc2626;
    --amber: #f59e0b;
    --orange: #f97316;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 10px 24px rgba(15, 23, 42, 0.16);
    --shadow-xl: 0 20px 40px rgba(15, 23, 42, 0.20);
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background:
        linear-gradient(180deg, #fafbfe 0%, var(--bg) 300px),
        var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.login-container {
    background:
        linear-gradient(135deg, var(--primary) 0%, var(--teal) 100%),
        url('data:image/svg+xml,<svg width="400" height="400" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
    background-size: cover, 40px 40px;
}

.login-card,
.form-card,
.stat-box,
.product-card,
.order-modal,
.brand-detail-content {
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition-base);
}

.login-card {
    max-width: 440px;
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(20px);
}

.login-card:hover {
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.25);
}

.form-group {
    margin-bottom: 24px;
}

.form-input {
    width: 100%;
    height: 48px;
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    padding: 0 16px;
    font-size: 16px;
    background: var(--surface);
    color: var(--text);
    transition: all var(--transition-fast);
    font-weight: 500;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.btn-login {
    width: 100%;
    height: 50px;
    line-height: 50px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 17px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: #fff;
    cursor: pointer;
    margin-top: 12px;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.login-admin-wrap {
    margin-top: 16px;
    text-align: center;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--line);
}

.pie-chart-wrap {
    height: 220px;
    margin-bottom: 18px;
    position: relative;
}

.pie-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 16px;
    margin-bottom: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-name {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    font-size: 15px;
    font-weight: 500;
    background: var(--surface-soft);
    border-radius: var(--radius-md);
    border: 2px dashed var(--line);
}

.summary-label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.summary-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.order-modal-product-details {
    flex: 1;
    min-width: 0;
}

.order-modal-brand {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.order-modal-code {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: var(--text);
    line-height: 1.3;
}

.order-modal-code-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

#modalProductCode {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
    word-break: break-all;
}

.modal-section {
    margin-bottom: 24px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.size-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.size-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.order-summary {
    background: var(--surface-soft);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    border: 1px solid var(--line);
}

.summary-item {
    text-align: center;
    flex: 1;
}

.form-input,
.product-search,
.cart-code-search,
.size-input {
    border-color: var(--line);
    background: var(--surface);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.form-input:focus,
.product-search:focus,
.cart-code-search:focus,
.size-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
    outline: none;
    background: var(--surface);
}

.form-input:hover:not(:focus),
.product-search:hover:not(:focus),
.cart-code-search:hover:not(:focus),
.size-input:hover:not(:focus) {
    border-color: var(--line-strong);
}

.btn-login,
.btn-hand {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: all var(--transition-base);
    transform: translateY(0);
}

.btn-login:hover,
.btn-hand:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.btn-login:active,
.btn-hand:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.user-bar {
    background: var(--surface);
    color: var(--text);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    min-height: 56px;
    padding: 12px 24px;
    z-index: 130;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.welcome-name {
    color: var(--primary);
    font-weight: 700;
}

.btn-logout {
    background: var(--surface-soft);
    color: var(--text);
    border-color: var(--line);
    transition: all var(--transition-fast);
}

.btn-logout:hover {
    background: var(--line);
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.site-title-bar {
    background: linear-gradient(180deg, var(--surface) 0%, #fafbfe 100%);
    border-bottom: 1px solid var(--line);
    box-shadow: none;
    font-size: 24px;
    padding: 20px 24px;
    color: var(--text);
    font-weight: 800;
    letter-spacing: -0.02em;
}

#mainPage {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.step-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    border-top: 1px solid var(--line);
    border-bottom: none;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    padding: 10px max(20px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-right));
}

.step-item {
    padding: 8px 0 6px;
    min-width: 0;
    transition: all var(--transition-fast);
}

.step-item:active {
    transform: scale(0.96);
}

.step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--primary-bg);
    color: var(--primary);
    width: 36px;
    height: 36px;
    margin-bottom: 4px;
    transition: all var(--transition-base);
}

.step-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all var(--transition-fast);
}

.nav-cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    border: 2px solid #fff;
    font-size: 11px;
    line-height: 16px;
    font-weight: 800;
    animation: badge-pop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.step-item.active .step-icon {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.step-item.active .step-label {
    color: var(--primary);
    font-weight: 700;
}

.step-label {
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--muted);
    transition: all var(--transition-fast);
}

.step-content {
    padding: 24px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-card {
    border-radius: var(--radius-lg);
    padding: 28px;
    background: var(--surface);
    transition: all var(--transition-base);
}

.form-card:hover {
    box-shadow: var(--shadow-lg);
}

.card-title,
.section-title {
    color: var(--text);
    border-bottom-color: var(--line);
    letter-spacing: -0.01em;
}

.card-title {
    font-size: 22px;
    font-weight: 700;
}

.search-mode-switcher,
.order-summary,
.cart-total-row td,
.stats-table th,
.cart-table th {
    background: var(--surface-soft);
}

.search-mode-switcher {
    max-width: 480px;
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.05);
}

.mode-item,
.brand-chip,
.filter-chip,
.color-btn {
    border-color: var(--line);
    background: var(--surface);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.mode-item:hover,
.brand-chip:hover,
.filter-chip:hover,
.color-btn:hover {
    background: var(--surface-hover);
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.mode-item.active,
.brand-chip.active,
.filter-chip.active,
.color-btn.selected {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.order-status-chip {
    height: 36px;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.order-status-chip:hover {
    background: var(--surface-hover);
}

.order-status-chip.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.product-search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
    width: 100%;
}

.product-search-row .product-search {
    flex: 1;
    min-width: 0;
    height: 48px;
    border-radius: var(--radius-md);
    padding: 0 18px;
    font-size: 16px;
}

.product-search-clear {
    flex: 0 0 60px;
    width: 60px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0;
    background: var(--red);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.product-search-clear:hover {
    background: var(--red-strong);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.product-search-clear:active {
    transform: translateY(0);
}

.order-status-filter {
    display: inline-flex;
    gap: 6px;
    padding: 5px;
    margin-bottom: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.05);
}

.product-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 20px;
}

.product-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-base);
    border: 1px solid var(--line);
    background: var(--surface);
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-lg);
}

.product-card:active {
    transform: translateY(-2px);
}

.product-img-placeholder,
.product-img {
    height: 160px;
    background: var(--surface-soft);
}

.product-card-info {
    padding: 16px 18px 18px;
    transition: background var(--transition-fast);
}

.product-card:hover .product-card-info {
    background: var(--surface-soft);
}

.product-card-code {
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
}

.product-card-price,
.stat-num-red,
.total-amount,
.summary-amount {
    color: var(--red);
}

.product-badge {
    background: var(--amber);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.product-qty {
    background: linear-gradient(135deg, var(--teal) 0%, var(--teal-light) 100%);
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
}

.product-card.ordered {
    border-color: var(--green);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2);
}

.product-card.ordered:hover {
    box-shadow: 0 12px 32px rgba(16, 185, 129, 0.3);
}

.product-card.ordered .product-card-info {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
}

.product-card.ordered .product-card-code::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--green);
    margin-right: 6px;
    vertical-align: 1px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.image-overlay {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    animation: fadeInOverlay 0.2s ease-out;
}

.image-overlay img {
    animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.toast {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cart-table,
.stats-table table {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.cart-table tbody tr,
.stats-table tbody tr {
    transition: background var(--transition-fast);
}

.cart-table tbody tr:hover,
.stats-table tbody tr:hover {
    background: var(--surface-soft);
}

.cart-remove-icon {
    transition: all var(--transition-fast);
}

.cart-remove-icon:hover {
    transform: scale(1.1) rotate(-10deg);
}

.cart-code-link {
    transition: all var(--transition-fast);
}

.cart-code-link:hover {
    color: var(--primary);
}

/* 添加加载动画 */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--line);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 购物车数量变化动画 */
.cart-qty-change {
    animation: scaleUp 0.3s ease-out;
}

@keyframes scaleUp {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.cart-table th,
.cart-table td,
.stats-table th,
.stats-table td {
    height: 44px;
}

.cart-table th,
.stats-table th {
    color: #374151;
}

.cart-table td,
.stats-table td {
    border-bottom-color: #eef0f3;
}

.btn-submit,
.btn-modal-add {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-strong) 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: all var(--transition-base);
    transform: translateY(0);
}

.btn-submit:hover,
.btn-modal-add:hover:not(:disabled) {
    background: linear-gradient(135deg, #34d399 0%, var(--green) 100%);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.btn-submit:active,
.btn-modal-add:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-clear {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-strong) 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transition: all var(--transition-base);
    transform: translateY(0);
}

.btn-clear:hover {
    background: linear-gradient(135deg, #f87171 0%, var(--red) 100%);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.btn-clear:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-submit:disabled,
.btn-clear:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.stat-box {
    border-radius: var(--radius-lg);
    text-align: left;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.stat-box:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-num {
    color: var(--primary);
    line-height: 1.1;
    font-weight: 800;
}

.stat-box::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--teal) 100%);
}

.stat-box:nth-child(2)::before {
    background: linear-gradient(90deg, var(--red) 0%, var(--orange) 100%);
}

.back-top-btn {
    position: fixed;
    right: 20px;
    bottom: calc(98px + env(safe-area-inset-bottom));
    z-index: 190;
    width: 48px;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.98);
    color: var(--primary);
    box-shadow: var(--shadow-lg);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    backdrop-filter: blur(10px);
}

.back-top-btn.show {
    display: inline-flex;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.back-top-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.back-top-btn:active {
    transform: translateY(-2px);
}

.back-top-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.modal-overlay {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeInOverlay 0.2s ease-out;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.order-modal,
.brand-detail-content {
    border-radius: var(--radius-lg);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 85vh;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.order-modal-header,
.brand-detail-header {
    background: linear-gradient(135deg, var(--text) 0%, #0f172a 100%);
    padding: 18px 24px;
}

.order-modal-title,
.brand-detail-title {
    font-size: 19px;
    font-weight: 700;
}

.modal-close-btn {
    transition: all var(--transition-fast);
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: rotate(90deg);
}

.store-card {
    position: relative;
    padding: 14px 12px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
}

.store-card:hover {
    border-color: var(--primary-light);
    background: var(--primary-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.store-card.selected {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.store-card-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    word-break: break-all;
}

.store-card.selected .store-card-name {
    color: var(--primary);
}

.store-card-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-strong) 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    border-radius: 11px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: badge-pop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* 购物车同步失败告警：常驻页面顶部直到同步成功，避免客户错过一次性提示 */
.cart-sync-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    padding: 10px 16px;
    background: #b3261e;
    color: #fff;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .step-content {
        padding: 14px;
    }

    .form-card {
        padding: 16px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .cart-search-clear {
        flex-basis: 54px;
        width: 54px;
    }

    .product-search-clear {
        flex-basis: 54px;
        width: 54px;
    }

    .order-status-filter {
        display: flex;
        overflow-x: auto;
    }

    .order-status-chip {
        flex: 1 0 auto;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 28px 20px;
    }

    .site-title-bar {
        font-size: 17px;
        padding: 14px 12px;
    }

    .product-img-placeholder,
    .product-img {
        height: 120px;
    }
}


.order-lock-banner {
    max-width: 1180px;
    margin: 12px auto 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    font-weight: 700;
    text-align: center;
}

/* ===== Mobile comfort pass 2026-09 Enhanced ===== */
@media (max-width: 640px) {
    body {
        font-size: 14px;
        line-height: 1.5;
        overflow-x: hidden;
    }

    #mainPage {
        padding-bottom: calc(86px + env(safe-area-inset-bottom));
    }

    .user-bar {
        min-height: 52px;
        padding: 10px 16px;
    }

    .welcome-text {
        min-width: 0;
        max-width: calc(100vw - 110px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 14px;
    }

    .btn-logout {
        flex: 0 0 auto;
        padding: 8px 14px;
        font-size: 13px;
        min-height: 36px;
    }

    .site-title-bar {
        font-size: 18px;
        line-height: 1.3;
        padding: 16px 16px;
    }

    .step-nav {
        padding: 8px max(12px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
        box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.12);
    }

    .step-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 3px;
    }

    .step-icon svg {
        width: 17px;
        height: 17px;
    }

    .step-label {
        font-size: 12px;
        line-height: 1.2;
    }

    .nav-cart-badge {
        top: -5px;
        right: -7px;
        min-width: 18px;
        height: 18px;
        font-size: 10px;
        line-height: 14px;
    }

    .step-content {
        padding: 14px;
    }

    .form-card {
        padding: 18px;
        border-radius: var(--radius-md);
        margin-bottom: 14px;
    }

    .card-title {
        font-size: 19px;
        margin-bottom: 14px;
        padding-bottom: 12px;
    }

    .search-mode-switcher {
        width: 100%;
        max-width: none;
        margin-bottom: 14px;
    }

    .mode-item {
        padding: 10px 6px;
        font-size: 14px;
        min-height: 40px;
    }

    .product-search-row,
    .cart-search-row {
        gap: 8px;
        margin-bottom: 14px;
    }

    .product-search-row .product-search,
    .cart-code-search {
        height: 46px;
        border-radius: var(--radius-md);
        padding: 0 14px;
        font-size: 16px;
    }

    .product-search-clear,
    .cart-search-clear {
        flex-basis: 56px;
        width: 56px;
        height: 38px;
        font-size: 13px;
    }

    .order-status-filter,
    .brand-filter,
    .cart-filter-row {
        margin-bottom: 14px;
        padding-bottom: 8px;
        scrollbar-width: none;
    }

    .order-status-chip,
    .brand-chip,
    .filter-chip {
        height: 36px;
        padding: 0 14px;
        font-size: 13px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px; /* Better touch target */
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .product-card {
        border-radius: var(--radius-md);
        min-width: 0;
    }

    .product-img-placeholder,
    .product-img {
        height: auto;
        aspect-ratio: 1 / 1;
        min-height: 140px;
    }

    .product-card-info {
        padding: 12px 14px 14px;
    }

    .product-card-code {
        font-size: 14px;
        line-height: 1.3;
    }

    .product-card-price {
        font-size: 14px;
        margin-top: 4px;
    }

    .cart-footer-btns {
        gap: 10px;
        margin-top: 16px;
    }

    .btn-submit,
    .btn-clear {
        height: 48px;
        font-size: 15px;
        font-weight: 700;
    }

    .stats-summary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 18px;
    }

    .stat-box {
        padding: 18px 16px;
    }

    .stat-num {
        font-size: 24px;
    }

    .order-modal,
    .brand-detail-content {
        width: calc(100vw - 24px);
        max-width: none;
        max-height: calc(100dvh - 24px);
        border-radius: var(--radius-lg);
    }

    .order-modal-body {
        padding: 16px;
        max-height: calc(100dvh - 160px);
    }

    .color-btn {
        min-height: 40px;
        padding: 0 14px;
        font-size: 14px;
    }

    .size-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .size-input {
        height: 40px;
        font-size: 16px;
    }

    .btn-modal-add {
        height: 48px;
        font-size: 16px;
        font-weight: 700;
    }

    .back-top-btn {
        right: 16px;
        bottom: calc(92px + env(safe-area-inset-bottom));
        width: 44px;
        height: 44px;
    }

    /* Improved touch targets */
    button,
    .clickable {
        min-height: 44px;
        min-width: 44px;
    }

    /* Better scroll behavior */
    .cart-table-container,
    .stats-table,
    .brand-filter,
    .cart-filter-row {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

@media (max-width: 360px) {
    .step-label {
        font-size: 10px;
    }

    .step-icon {
        width: 26px;
        height: 26px;
    }

    .product-grid {
        gap: 8px;
    }

    .product-card-info {
        padding: 8px;
    }

    .product-card-code,
    .product-card-price {
        font-size: 12px;
    }

    .order-modal-product-info {
        grid-template-columns: 84px minmax(0, 1fr);
    }

    .order-modal-img-placeholder,
    .order-modal-img {
        width: 84px;
        height: 84px;
    }

    .size-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Per-color quantity in the order dialog. */
#colorList .color-btn { position: relative; overflow: visible; }
.color-qty-badge {
    position: absolute; top: -8px; right: -8px;
    min-width: 22px; height: 22px; padding: 0 6px;
    border-radius: 11px; background: #dc2626; color: #fff;
    font-size: 12px; font-weight: 700; line-height: 22px;
    text-align: center; pointer-events: none;
}
