/* ==================== 乐高零件管家 - 完整样式 ==================== */
:root {
    --blue: #2a6cb6;
    --blue-dark: #1d5290;
    --blue-light: #e9f2fa;
    --blue-gradient: linear-gradient(135deg, #1d5290 0%, #2a6cb6 50%, #3b82f6 100%);
    --yellow: #f5a623;
    --yellow-dark: #d4891a;
    --yellow-light: #fef7ed;
    --yellow-gradient: linear-gradient(135deg, #f5a623 0%, #fbbf24 100%);
    --bg: #f4f6f9;
    --surface: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f0f1f3;
    --success: #10b981;
    --success-light: #ecfdf5;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    --radius: 10px;
    --radius-sm: 7px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 28px rgba(0,0,0,0.08);
    --shadow-xl: 0 12px 36px rgba(0,0,0,0.10);
    --header-h: 58px;
    --max-width: 1280px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-top: var(--header-h);
}

a { color: var(--blue); text-decoration: none; transition: color var(--transition); }

/* ==================== Top Header ==================== */
.header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--header-h);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    display: flex; align-items: center;
    animation: headerIn 0.4s ease;
}
@keyframes headerIn { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.header-inner {
    width: 100%; max-width: var(--max-width);
    margin: 0 auto; padding: 0 28px;
    display: flex; align-items: center;
}
.header-logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 16px; font-weight: 700; color: var(--text);
    letter-spacing: -0.3px; flex-shrink: 0;
    margin-right: 32px; text-decoration: none;
    transition: opacity var(--transition);
}
.header-logo:hover { text-decoration: none; opacity: 0.8; }
.header-logo .logo-icon {
    width: 34px; height: 34px;
    background: var(--blue-gradient);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; color: #fff; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(42,108,182,0.25);
}

.header-nav { display: flex; align-items: center; gap: 3px; flex: 1; }
.header-nav a {
    padding: 7px 16px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; color: var(--text-secondary);
    transition: all var(--transition); white-space: nowrap;
    position: relative;
}
.header-nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.header-nav a.active {
    background: var(--blue-light); color: var(--blue); font-weight: 600;
}

.header-right {
    display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.header-user {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 500; color: var(--text);
}
.header-avatar {
    width: 30px; height: 30px;
    background: var(--yellow-gradient);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
    box-shadow: 0 2px 6px rgba(245,166,35,0.25);
}
.header-logout {
    font-size: 12px; color: var(--text-muted); padding: 5px 10px;
    border-radius: var(--radius-sm); transition: all var(--transition);
}
.header-logout:hover { background: var(--danger-light); color: var(--danger); text-decoration: none; }

/* ==================== Main Content ==================== */
.main-content {
    width: 100%; max-width: var(--max-width);
    margin: 0 auto; padding: 28px 28px 48px;
    min-height: calc(100vh - var(--header-h));
    animation: contentIn 0.5s ease;
}
@keyframes contentIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ==================== Auth Pages ==================== */
.auth-layout {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(150deg, #e9f2fa 0%, #f4f6f9 40%, #fef7ed 100%);
    padding: 20px; padding-top: 0;
}
.auth-layout::before {
    content: ''; position: fixed; top: -200px; right: -200px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(42,108,182,0.06) 0%, transparent 70%);
    pointer-events: none; animation: authGlow 8s ease infinite;
}
.auth-layout::after {
    content: ''; position: fixed; bottom: -150px; left: -150px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(245,166,35,0.06) 0%, transparent 70%);
    pointer-events: none; animation: authGlow 8s ease infinite 4s;
}
@keyframes authGlow { 0%,100% { transform:scale(1);opacity:0.6; } 50% { transform:scale(1.2);opacity:1; } }
.auth-container { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.auth-card {
    background: var(--surface); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl); padding: 42px;
    border: 1px solid var(--border);
    animation: authIn 0.5s ease;
}
@keyframes authIn { from { opacity:0;transform:scale(0.94) translateY(20px); } to { opacity:1;transform:scale(1) translateY(0); } }
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-header .auth-logo {
    width: 56px; height: 56px;
    background: var(--blue-gradient);
    border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 26px; color: #fff; margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(42,108,182,0.2);
}
.auth-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.3px; }
.auth-header p { font-size: 14px; color: var(--text-secondary); }
.auth-footer { text-align: center; margin-top: 24px; font-size: 14px; color: var(--text-secondary); }
.auth-footer a { color: var(--blue); font-weight: 600; }

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 20px; font-size: 13px; font-weight: 500;
    border-radius: var(--radius-sm); border: none;
    cursor: pointer; transition: all var(--transition); font-family: inherit;
    letter-spacing: 0.1px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(42,108,182,0.2);
}
.btn-primary:hover { background: var(--blue-dark); box-shadow: 0 4px 14px rgba(42,108,182,0.3); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e5e7eb; border-color: #d1d5db; }
.btn-outline { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:hover { background: var(--blue-light); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 2px 8px rgba(239,68,68,0.2); }
.btn-danger:hover { background: #dc2626; box-shadow: 0 4px 14px rgba(239,68,68,0.3); }
.btn-yellow {
    background: var(--yellow-gradient);
    color: #fff;
    box-shadow: 0 2px 10px rgba(245,166,35,0.25);
}
.btn-yellow:hover { background: var(--yellow-dark); box-shadow: 0 4px 16px rgba(245,166,35,0.35); }
.btn-sm { padding: 5px 13px; font-size: 12px; }
.btn-block { width: 100%; }

/* ==================== Forms ==================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 10px 14px; font-size: 14px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    transition: all var(--transition); font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none; border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(42,108,182,0.08);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.required { color: var(--danger); }

/* ==================== Page Header ==================== */
.page-header {
    display: flex; align-items: flex-start; gap: 16px;
    margin-bottom: 26px;
    animation: fadeIn 0.5s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-header-left { flex: 1; }
.page-header h1 { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.4px; }
.page-header .page-desc { color: var(--text-secondary); font-size: 13px; margin-top: 5px; line-height: 1.6; }
.page-actions { display: flex; gap: 8px; margin-left: auto; flex-shrink: 0; }
.page-badge {
    font-size: 11px; font-weight: 600; padding: 4px 12px;
    border-radius: 20px; letter-spacing: 0.3px;
    background: var(--yellow-light); color: var(--yellow-dark);
    display: inline-flex; align-items: center; gap: 4px;
}
.page-stats { color: var(--text-secondary); font-size: 13px; margin-bottom: 14px; }

/* ==================== Welcome Banner ==================== */
.welcome-banner {
    background: var(--blue-gradient);
    border-radius: var(--radius-lg);
    padding: 38px 42px; margin-bottom: 28px;
    color: #fff; position: relative; overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.5s ease 0.05s both;
}
.welcome-banner::before {
    content: ''; position: absolute;
    right: -80px; top: -80px;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    pointer-events: none;
}
.welcome-banner::after {
    content: ''; position: absolute;
    right: 100px; bottom: -40px;
    width: 160px; height: 160px;
    background: var(--yellow);
    border-radius: 50%; opacity: 0.08; pointer-events: none;
}
.welcome-banner h2 { font-size: 25px; font-weight: 700; position: relative; z-index: 1; }
.welcome-banner p { font-size: 14px; opacity: 0.75; margin-top: 4px; position: relative; z-index: 1; }
.welcome-banner .banner-stats { display: flex; gap: 44px; margin-top: 22px; position: relative; z-index: 1; }
.banner-stat {
    animation: statPop 0.6s ease both;
}
.banner-stat:nth-child(1) { animation-delay: 0.2s; }
.banner-stat:nth-child(2) { animation-delay: 0.35s; }
.banner-stat:nth-child(3) { animation-delay: 0.5s; }
@keyframes statPop {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}
.banner-stat .banner-stat-value { font-size: 32px; font-weight: 800; }
.banner-stat .banner-stat-label { font-size: 12px; opacity: 0.65; margin-top: 2px; }

/* ==================== Quick Actions ==================== */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 28px; }
.action-card {
    background: var(--surface); border-radius: var(--radius);
    padding: 24px 26px; box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    cursor: pointer; transition: all var(--transition);
    display: flex; align-items: flex-start; gap: 16px;
    text-decoration: none; color: var(--text);
    animation: fadeIn 0.5s ease both;
    position: relative; overflow: hidden;
}
.action-card:nth-child(1) { animation-delay: 0.1s; }
.action-card:nth-child(2) { animation-delay: 0.2s; }
.action-card:nth-child(3) { animation-delay: 0.3s; }
.action-card::after {
    content: ''; position: absolute;
    top: -20px; right: -20px;
    width: 80px; height: 80px;
    border-radius: 50%; opacity: 0.04; transition: all var(--transition);
    pointer-events: none;
}
.action-card:nth-child(1)::after { background: var(--blue); }
.action-card:nth-child(2)::after { background: var(--success); }
.action-card:nth-child(3)::after { background: var(--yellow); }
.action-card:hover { box-shadow: var(--shadow-md); border-color: #cbd5e1; text-decoration: none; transform: translateY(-2px); }
.action-card:hover::after { opacity: 0.08; transform: scale(1.4); }
.action-card .action-icon {
    width: 48px; height: 48px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.action-icon.warehouse { background: var(--blue-light); }
.action-icon.query { background: var(--success-light); }
.action-icon.compare { background: var(--yellow-light); }
.action-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.action-card p { font-size: 13px; color: var(--text-secondary); }

/* ==================== Stats Grid ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px; margin-bottom: 28px;
}
.stat-card {
    background: var(--surface); border-radius: var(--radius);
    padding: 20px 24px; box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
    animation: fadeIn 0.5s ease both;
}
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.15s; }
.stat-card:nth-child(3) { animation-delay: 0.25s; }
.stat-card:nth-child(4) { animation-delay: 0.35s; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card .stat-icon {
    width: 40px; height: 40px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; margin-bottom: 12px;
}
.stat-card.blue .stat-icon { background: var(--blue-light); }
.stat-card.yellow .stat-icon { background: var(--yellow-light); }
.stat-card.green .stat-icon { background: var(--success-light); }
.stat-card.purple .stat-icon { background: var(--purple-light); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ==================== Section Title ==================== */
.section-title {
    font-size: 13px; font-weight: 700; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.8px;
    margin-bottom: 14px;
    animation: fadeIn 0.4s ease;
}

/* ==================== Search Bar ==================== */
.search-bar { margin-bottom: 18px; animation: fadeIn 0.5s ease 0.05s both; }
.search-input {
    width: 100%; max-width: 420px;
    padding: 10px 18px 10px 40px;
    font-size: 14px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: 14px center;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.search-input:focus {
    outline: none; border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(42,108,182,0.08);
    max-width: 500px;
}
.search-input::placeholder { color: var(--text-muted); }

/* ==================== Data Table ==================== */
.table-container {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden;
    border: 1px solid var(--border);
    animation: fadeIn 0.5s ease 0.1s both;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px;
    font-size: 11px; font-weight: 700; color: var(--text-secondary);
    background: #fafbfc; border-bottom: 1.5px solid var(--border);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.data-table td {
    padding: 11px 16px; font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}
.data-table tbody tr {
    transition: all var(--transition);
    animation: rowIn 0.4s ease both;
}
.data-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.08s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.11s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.14s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.17s; }
.data-table tbody tr:nth-child(6) { animation-delay: 0.20s; }
.data-table tbody tr:nth-child(7) { animation-delay: 0.23s; }
.data-table tbody tr:nth-child(8) { animation-delay: 0.26s; }
.data-table tbody tr:nth-child(9) { animation-delay: 0.29s; }
.data-table tbody tr:nth-child(10) { animation-delay: 0.32s; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
.data-table tbody tr:hover { background: #fafcfd; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td:first-child { width: 120px; text-align: center; padding: 6px 8px; }
.data-table td:first-child img {
    border-radius: 7px; transition: transform var(--transition);
}
.data-table td:first-child img:hover { transform: scale(1.08); }
.data-table .actions-cell { display: flex; gap: 5px; }
.data-table .highlight-qty {
    display: inline-block; padding: 2px 10px;
    background: var(--blue-light); color: var(--blue);
    border-radius: 12px; font-weight: 600; font-size: 12px;
}
.table-empty td { text-align: center; color: var(--text-secondary); padding: 56px 16px; font-size: 14px; }
.table-empty td::before { content: '📦'; display: block; font-size: 40px; margin-bottom: 10px; }

/* ==================== Modal ==================== */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--surface); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl); width: 100%;
    max-width: 580px; max-height: 90vh;
    display: flex; flex-direction: column;
    animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.94) translateY(14px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-lg { max-width: 820px; }
.modal-sm { max-width: 420px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.modal-close {
    background: none; border: none;
    font-size: 22px; cursor: pointer; color: var(--text-muted);
    padding: 4px 8px; border-radius: 5px; transition: all var(--transition);
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; }

/* ==================== Upload ==================== */
.upload-area {
    border: 2px dashed #d1d5db; border-radius: var(--radius);
    padding: 48px 24px; text-align: center; cursor: pointer;
    transition: all var(--transition); background: #fafbfc;
}
.upload-area:hover, .upload-area.drag-over {
    border-color: var(--blue); background: var(--blue-light);
    transform: scale(1.01);
}
.upload-icon { font-size: 44px; margin-bottom: 10px; }

/* ==================== Image Upload (Form) ==================== */
.image-upload-area {
    border: 2px dashed #d1d5db; border-radius: var(--radius-sm);
    width: 120px; height: 120px; cursor: pointer;
    transition: all var(--transition); background: #fafbfc;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.image-upload-area:hover { border-color: var(--blue); background: var(--blue-light); }
.image-upload-preview { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.image-upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-upload-preview span { font-size: 12px; color: var(--text-muted); text-align: center; padding: 8px; }
.upload-hint p { color: var(--text-secondary); font-size: 14px; }
.upload-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ==================== CSV Preview ==================== */
.csv-preview {
    overflow-x: auto; max-height: 320px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.csv-preview table { width: 100%; border-collapse: collapse; font-size: 12px; }
.csv-preview th, .csv-preview td { padding: 7px 12px; border: 1px solid var(--border-light); text-align: left; }
.csv-preview th { background: #fafbfc; font-weight: 600; color: var(--text-secondary); position: sticky; top: 0; }
.csv-preview tr:nth-child(even) { background: #fafbfc; }
.import-config-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; font-size: 13px; }
.import-config-bar input[type="number"] {
    width: 80px; padding: 7px 10px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px;
}
.import-file-name { color: var(--text-secondary); font-size: 13px; }

/* ==================== Mapping Grid ==================== */
.mapping-grid {
    display: grid; grid-template-columns: 1fr 2fr;
    gap: 9px 16px; align-items: center;
    margin-bottom: 18px; padding: 16px 20px;
    background: #fafbfc; border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.mapping-label { font-size: 13px; font-weight: 600; color: var(--text); }
.mapping-grid select {
    padding: 8px 12px; font-size: 13px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); transition: border-color var(--transition);
}
.mapping-grid select:focus { outline: none; border-color: var(--blue); }

/* ==================== Parts Grid ==================== */
.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 16px;
    animation: fadeIn 0.5s ease 0.1s both;
}
.part-card {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    overflow: hidden; cursor: pointer; transition: all var(--transition);
    animation: cardIn 0.4s ease both;
}
.part-card:nth-child(1) { animation-delay: 0.02s; }
.part-card:nth-child(2) { animation-delay: 0.04s; }
.part-card:nth-child(3) { animation-delay: 0.06s; }
.part-card:nth-child(4) { animation-delay: 0.08s; }
.part-card:nth-child(5) { animation-delay: 0.10s; }
.part-card:nth-child(6) { animation-delay: 0.12s; }
.part-card:nth-child(7) { animation-delay: 0.14s; }
.part-card:nth-child(8) { animation-delay: 0.16s; }
@keyframes cardIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
.part-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--blue);
}
.part-card-image {
    width: 100%; aspect-ratio: 1;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecf1 100%);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 14px; overflow: hidden;
    position: relative;
}
.part-card-image::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.02) 100%);
    pointer-events: none;
}
.part-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.part-card:hover .part-card-image img { transform: scale(1.05); }
.part-card-body { padding: 14px 16px; }
.part-card-model { font-size: 14px; font-weight: 700; color: var(--blue); }
.part-card-name {
    font-size: 12px; color: var(--text-secondary); margin-top: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.part-card-qty {
    font-size: 11px; color: var(--text-muted); margin-top: 6px;
    display: inline-flex; align-items: center; gap: 4px;
}
.part-card-qty::before { content: '📦'; font-size: 11px; }
.grid-empty { grid-column: 1 / -1; text-align: center; padding: 64px 20px; color: var(--text-secondary); font-size: 14px; }

/* ==================== Detail Modal ==================== */
.detail-layout { display: flex; gap: 24px; margin-bottom: 16px; }
.detail-image { flex: 0 0 200px; }
.detail-image-placeholder {
    width: 200px; height: 200px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecf1 100%);
    border-radius: var(--radius); display: flex;
    align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 14px; overflow: hidden;
}
.detail-image-placeholder img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { flex: 1; }
.detail-info dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 20px; }
.detail-info dt { font-size: 11px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; padding-top: 10px; }
.detail-info dd { font-size: 15px; color: var(--text); padding-top: 10px; font-weight: 500; }
.detail-info dd .model-highlight { color: var(--blue); font-weight: 700; }

/* ==================== Card ==================== */
.card {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    margin-bottom: 20px; transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 24px; }

/* ==================== Compare ==================== */
.compare-summary {
    display: grid; grid-template-columns: repeat(5, 1fr);
    gap: 12px; margin-bottom: 24px;
    animation: fadeIn 0.5s ease;
}
.summary-card {
    padding: 22px 26px; border-radius: var(--radius);
    text-align: center; border: 1px solid transparent;
    transition: all var(--transition);
    animation: statPop 0.6s ease both;
}
.summary-card:nth-child(1) { animation-delay: 0.1s; }
.summary-card:nth-child(2) { animation-delay: 0.25s; }
.summary-card:nth-child(3) { animation-delay: 0.4s; }
.summary-card:hover { transform: translateY(-2px); }
.summary-card .summary-num { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
.summary-card .summary-label { font-size: 13px; margin-top: 4px; font-weight: 500; }
.summary-sufficient { background: var(--success-light); border-color: #a7f3d0; }
.summary-sufficient .summary-num { color: #059669; }
.summary-sufficient .summary-label { color: #047857; }
.summary-insufficient { background: var(--yellow-light); border-color: #fde68a; }
.summary-insufficient .summary-num { color: #d97706; }
.summary-insufficient .summary-label { color: #b45309; }
.summary-missing { background: var(--danger-light); border-color: #fecaca; }
.summary-missing .summary-num { color: var(--danger); }
.summary-missing .summary-label { color: #b91c1c; }

.compare-tabs {
    display: flex; gap: 0; border-bottom: 2px solid var(--border);
    background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}
.compare-tab {
    padding: 12px 24px; font-size: 14px; font-weight: 500;
    border: none; background: none; cursor: pointer;
    color: var(--text-secondary); border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all var(--transition); font-family: inherit;
    position: relative;
}
.compare-tab:hover { color: var(--text); background: #fafbfc; }
.compare-tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.tab-count {
    display: inline-block; min-width: 22px; padding: 2px 8px;
    border-radius: 10px; font-size: 11px; font-weight: 600;
    background: var(--bg); margin-left: 6px;
}
.tab-warn { background: var(--yellow-light); color: #b45309; }
.tab-danger { background: var(--danger-light); color: #b91c1c; }

.compare-panels {
    background: var(--surface); border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border); border-top: none;
}
.compare-panel { display: none; }
.compare-panel.active { display: block; animation: fadeIn 0.35s ease; }

/* ==================== Toast ==================== */
.toast-container { position: fixed; top: 70px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; border-radius: var(--radius-sm); font-size: 13px;
    color: #fff; box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 380px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--blue); }
@keyframes slideIn { from { transform: translateX(130%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ==================== Flash ==================== */
.flash-messages { margin-bottom: 18px; }
.flash-msg {
    padding: 12px 18px; border-radius: var(--radius-sm);
    font-size: 14px; margin-bottom: 8px;
    animation: fadeIn 0.35s ease;
}
.flash-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }

/* ==================== Misc ==================== */
h4 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.hint-text { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.import-result { text-align: center; padding: 24px; animation: fadeIn 0.4s ease; }
.import-result .result-icon { font-size: 52px; margin-bottom: 12px; }
.import-result .result-title { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.import-result .result-stats { display: flex; gap: 36px; justify-content: center; margin-top: 20px; }
.import-result .result-stat-num { font-size: 28px; font-weight: 700; color: var(--blue); }
.import-result .result-stat-label { font-size: 13px; color: var(--text-secondary); }
.import-errors {
    text-align: left; margin-top: 18px; font-size: 12px;
    color: var(--danger); background: var(--danger-light);
    padding: 12px 16px; border-radius: var(--radius-sm);
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .header-logo { margin-right: 12px; font-size: 14px; }
    .header-nav a { padding: 6px 10px; font-size: 12px; }
    .header-inner { padding: 0 14px; }
    .main-content { padding: 20px 14px 40px; }
    .form-row, .detail-layout { flex-direction: column; gap: 0; }
    .compare-summary { grid-template-columns: 1fr; }
    .parts-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .stats-grid, .quick-actions { grid-template-columns: 1fr; }
    .welcome-banner { padding: 24px 22px; }
    .welcome-banner h2 { font-size: 20px; }
    .welcome-banner .banner-stats { flex-wrap: wrap; gap: 16px; }
    .page-header { flex-direction: column; }
    .page-actions { margin-left: 0; }
}
