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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    color: #2d3748;
    min-height: 100vh;
}

/* ─── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 700;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-user {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

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

.admin-link {
    background: rgba(250, 204, 21, 0.2);
    color: #fcd34d;
    font-weight: 600;
}

.admin-link:hover {
    background: rgba(250, 204, 21, 0.35);
    color: #fde68a;
}

/* ─── Homepage ─────────────────────────────────────────────────────────── */
.home-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.section-subtitle {
    text-align: center;
    color: #a0aec0;
    margin-bottom: 3rem;
    font-size: 1.05rem;
}

.feature-card .feature-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
}


/* ─── Container ─────────────────────────────────────────────────────────── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ─── Flash Messages ────────────────────────────────────────────────────── */
.flash-messages {
    margin-bottom: 1.5rem;
}

.flash {
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    animation: slideIn 0.3s ease;
    transition: opacity 0.5s;
}

.flash.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

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

/* ─── Auth Pages ────────────────────────────────────────────────────────── */
.auth-card {
    max-width: 420px;
    margin: 4rem auto;
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.auth-card h1 {
    color: #667eea;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card .subtitle {
    text-align: center;
    color: #718096;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #4a5568;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"] {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: #f7fafc;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.btn-primary {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    padding: 0.6rem 1.2rem;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: #718096;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

/* ─── Page Header ───────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    color: #2d3748;
}

.page-header .subtitle {
    color: #718096;
    margin-top: 0.3rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* ─── Dashboard ─────────────────────────────────────────────────────────── */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.file-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.file-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.file-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #edf2f7;
}

.file-icon {
    font-size: 1.8rem;
}

.file-name {
    font-weight: 700;
    color: #2d3748;
    font-size: 1.1rem;
}

.file-info p {
    color: #718096;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.file-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-small {
    padding: 0.35rem 0.8rem;
    border: 1px solid #e2e8f0;
    background: #f7fafc;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    color: #4a5568;
    transition: all 0.2s;
    display: inline-block;
}

.btn-small:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.btn-small.btn-info { background: #ebf4ff; color: #4299e1; border-color: #bee3f8; }
.btn-small.btn-info:hover { background: #4299e1; color: white; }
.btn-small.btn-warn { background: #fef5e7; color: #dd6b20; border-color: #fbd38d; }
.btn-small.btn-warn:hover { background: #dd6b20; color: white; }
.btn-small.btn-danger { background: #fff5f5; color: #e53e3e; border-color: #fed7d7; }
.btn-small.btn-danger:hover { background: #e53e3e; color: white; border-color: #e53e3e; }

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h2 {
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #718096;
    margin-bottom: 2rem;
}

/* ─── Upload Page ───────────────────────────────────────────────────────── */
.upload-container {
    max-width: 700px;
    margin: 0 auto;
}

.upload-container h1 {
    margin-bottom: 0.5rem;
}

.upload-container .subtitle {
    color: #718096;
    margin-bottom: 2rem;
}

.upload-form {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.file-drop {
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: border-color 0.2s;
    cursor: pointer;
}

.file-preview {
    margin-top: 1rem;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.5rem;
}

.auto-hint {
    color: #a0aec0;
    font-weight: 400;
    font-size: 0.85em;
}

.drop-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.file-drop input[type="file"] {
    display: none;
}

.file-drop p {
    color: #4a5568;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.file-drop small {
    color: #a0aec0;
}

.format-hint {
    background: white;
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.format-hint h3 {
    color: #4a5568;
    margin-bottom: 0.8rem;
}

.format-hint ul {
    list-style: none;
    padding: 0;
}

.format-hint li {
    padding: 0.3rem 0;
    color: #718096;
    font-size: 0.9rem;
}

.format-hint li::before {
    content: "✓ ";
    color: #48bb78;
    font-weight: bold;
}

/* ─── Analysis Page ─────────────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    text-align: center;
    border-top: 4px solid #667eea;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
}

.kpi-label {
    color: #4a5568;
    font-weight: 600;
    margin: 0.3rem 0;
}

.kpi-sub {
    color: #a0aec0;
    font-size: 0.85rem;
}

/* Bottleneck Banner */
.bottleneck-banner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.bottleneck-cpu { background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%); border-left: 5px solid #e53e3e; }
.bottleneck-gpu { background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%); border-left: 5px solid #eab308; }
.bottleneck-balanced { background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%); border-left: 5px solid #ea580c; }
.bottleneck-none { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-left: 5px solid #22c55e; }

.bn-icon {
    font-size: 3rem;
}

.bn-content {
    flex: 1;
    min-width: 280px;
}

.bn-content h3 {
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.bn-content p {
    color: #4a5568;
    margin-bottom: 0.8rem;
}

.bn-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.bn-stats .warn {
    color: #e53e3e;
    font-weight: 600;
}

/* Charts */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.chart-card h3 {
    color: #4a5568;
    margin-bottom: 1rem;
}

/* Stats Table */
.stats-table-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

.stats-table-card h3 {
    color: #4a5568;
    margin-bottom: 1rem;
}

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

.stats-table th,
.stats-table td {
    padding: 0.7rem 1rem;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
}

.stats-table th {
    background: #f7fafc;
    color: #4a5568;
    font-weight: 600;
}

.stats-table tr:hover {
    background: #f7fafc;
}

/* Recommendations */
.recs-section {
    margin-bottom: 2rem;
}

.recs-section h3 {
    color: #4a5568;
    margin-bottom: 1rem;
}

.recs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.rec-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    border-left: 5px solid #667eea;
}

.rec-card.priority-high { border-left-color: #e53e3e; }
.rec-card.priority-medium { border-left-color: #f39c12; }
.rec-card.priority-low { border-left-color: #48bb78; }

.rec-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.rec-category {
    background: #ebf4ff;
    color: #4299e1;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

.rec-priority {
    font-size: 0.85rem;
}

.rec-card h4 {
    color: #2d3748;
    margin-bottom: 0.8rem;
}

.rec-card ul {
    list-style: none;
    padding: 0;
}

.rec-card li {
    padding: 0.4rem 0;
    color: #4a5568;
    font-size: 0.9rem;
    padding-left: 1.2rem;
    position: relative;
}

.rec-card li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #667eea;
}

/* ─── Hardware Page ──────────────────────────────────────────────────────── */
.verdict-card {
    display: flex;
    gap: 1.5rem;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.verdict-cpu { background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%); }
.verdict-gpu { background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%); }
.verdict-balanced { background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%); }
.verdict-none { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); }

.verdict-icon {
    font-size: 4rem;
}

.verdict-content {
    flex: 1;
    min-width: 300px;
}

.verdict-content h2 {
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.verdict-desc {
    color: #4a5568;
    margin-bottom: 1.5rem;
}

.verdict-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.vm-item {
    background: white;
    padding: 0.8rem 1rem;
    border-radius: 8px;
}

.vm-label {
    display: block;
    color: #718096;
    font-size: 0.85rem;
}

.vm-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0.3rem 0;
}

.vm-bar {
    background: #edf2f7;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.vm-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s;
}

.verdict-warnings {
    margin-top: 1rem;
}

.warning-item {
    background: #fff5f5;
    color: #c53030;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Upgrade Guide */
.upgrade-guide {
    margin-bottom: 2rem;
}

.upgrade-guide h2 {
    color: #2d3748;
    margin-bottom: 1.5rem;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.guide-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.guide-card h3 {
    color: #667eea;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid #edf2f7;
}

.tier {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f7fafc;
}

.tier:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tier h4 {
    color: #4a5568;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.tier ul {
    list-style: none;
    padding: 0;
}

.tier li {
    padding: 0.3rem 0;
    color: #4a5568;
    font-size: 0.88rem;
    padding-left: 1.2rem;
    position: relative;
}

.tier li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

/* ─── Footer ────────────────────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 2rem;
    color: #a0aec0;
    font-size: 0.85rem;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }

    .nav-links {
        gap: 0.8rem;
    }

    .container {
        padding: 1rem;
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }

    .verdict-card {
        flex-direction: column;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
/* ─── Admin / Account pages ──────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-card .stat-num {
    font-size: 1.8rem;
    font-weight: 700;
    color: #667eea;
}

.stat-card .stat-label {
    color: #a0aec0;
    font-size: 0.85rem;
}

.admin-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.admin-menu-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

.admin-menu-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.menu-icon {
    font-size: 2rem;
}

.admin-menu-card h3 {
    color: #2d3748;
    margin-bottom: 0.2rem;
}

.admin-menu-card p {
    color: #a0aec0;
    font-size: 0.85rem;
}

.menu-arrow {
    margin-left: auto;
    color: #cbd5e0;
    font-size: 1.2rem;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: #fef3c7;
    color: #b45309;
}

.badge-user {
    background: #edf2f7;
    color: #4a5568;
}

.mapping-add-form {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.mapping-add-form input {
    flex: 1;
    min-width: 200px;
}

.mapping-inline-form {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.mapping-inline-form input {
    width: auto;
}

.mapping-tip {
    color: #a0aec0;
    font-size: 0.8rem;
}

.upload-progress {
    margin-top: 1rem;
}

.progress-bar {
    height: 10px;
    background: #edf2f7;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 5px;
    transition: width 0.2s ease;
}

.progress-text {
    margin-top: 0.5rem;
    color: #a0aec0;
    font-size: 0.85rem;
    text-align: center;
}

.invite-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700;
    letter-spacing: 2px;
    color: #4c51bf;
}

.required {
    color: #e53e3e;
    margin-left: 0.2rem;
}
