:root {
    --bg: #f5f6f8;
    --surface: #fff;
    --primary: #4f6ef7;
    --primary-hover: #3b54d4;
    --text: #2c3e50;
    --text-secondary: #6b7d8e;
    --border: #e2e7ed;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --radius: 10px;
    --radius-sm: 6px;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --font: 'Segoe UI','PingFang SC','Microsoft YaHei','Helvetica Neue',sans-serif;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}
.navbar .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}
.navbar .logo .icon {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
}
.logo-text { display: inline; }
.nav-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.nav-actions select {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-family: var(--font);
    background: var(--surface);
    cursor: pointer;
    min-width: 160px;
}
.nav-actions .btn { padding: 6px 12px; font-size: 0.85rem; }

@media (max-width: 700px) {
    .navbar {
        height: auto;
        padding: 10px 15px;
    }
    .logo-text { display: none; }
    .nav-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 8px;
    }
    .nav-actions select {
        min-width: 120px;
        flex: 1;
    }
    .nav-actions .btn {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}

.main-container {
    flex: 1;
    padding: 24px 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafbfc;
}
.card-body { padding: 20px; flex: 1; }
.card-body.no-padding { padding: 0; }

.dataset-content {
    display: flex;
    flex-direction: column;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
table th, table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table th {
    background: #f8f9fb;
    font-weight: 700;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    text-transform: uppercase;
    font-size: 0.8rem;
}
table tbody tr:hover { background: #f8faff; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-ready { background: #dcfce7; color: #166534; }
.badge-info { background: #dbeafe; color: #1e40af; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
}
.empty-state .icon-big { font-size: 4rem; margin-bottom: 16px; }
.empty-state h2 { color: var(--text); margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; font-size: 0.9rem; }
.hint-text { font-size: 0.78rem; color: #999; margin-top: 12px; line-height: 1.6; }

.btn {
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline {
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid transparent;
}
.btn-ghost:hover { background: #f0f2f5; color: var(--text); }
.btn-warning { background: var(--warning); color: #1a1a1a; }
.btn-success { background: var(--success); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

/* 数据处理按钮新样式 */
.btn-analyze {
    background: #6c5ce7; color: #fff;
}
.btn-analyze:hover { background: #5a4ac9; }
.btn-predict {
    background: #00b894; color: #fff;
}
.btn-predict:hover { background: #009b7d; }
.btn-ai {
    background: #e17055; color: #fff;
}
.btn-ai:hover { background: #c55a42; }
.btn-save {
    background: #0984e3; color: #fff;
    margin-left: auto;
}
.btn-save:hover { background: #0866c2; }

.action-row-left {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.status-text {
    margin-top: 12px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-align: left;
}
.loading-text, .placeholder-text {
    color: var(--text-secondary);
    text-align: center;
    padding: 30px;
}

.results-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform:translateY(30px); opacity:0; } to { transform:translateY(0); opacity:1; } }
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    background: #fafbfc;
    border-radius: var(--radius) var(--radius) 0 0;
}
.modal-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { background: #f0f2f5; color: var(--text); }
.modal-body { padding: 20px 22px; }
.upload-option-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.upload-option-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    flex: 1;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.upload-option-row label:has(input:checked) {
    border-color: var(--primary);
    background: #f8faff;
    color: var(--primary);
}
.file-list {
    list-style: none;
    margin: 10px 0;
    max-height: 200px;
    overflow-y: auto;
}
.file-list li {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #f0f2f5;
}
.progress-bar-wrap {
    background: #e5e7eb;
    border-radius: 10px;
    height: 8px;
    margin: 10px 0;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}
.progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}
.modal-actions button { flex: 1; justify-content: center; }

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    background: #1f2937;
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    animation: slideIn 0.3s ease;
    max-width: 420px;
}
@keyframes slideIn { from { transform: translateX(120%); opacity:0; } to { transform: translateX(0); opacity:1; } }
.toast.error { border-left: 4px solid var(--danger); }
.toast.success { border-left: 4px solid var(--success); }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 10px;
}
.metric-item {
    background: #f8f9fb;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    text-align: center;
    border: 1px solid var(--border);
}
.metric-item .metric-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
}
.metric-item .metric-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 4px;
}
.ai-text {
    line-height: 1.8;
    font-size: 0.9rem;
    color: #374151;
    background: #fdfcf0;
    border-left: 4px solid var(--warning);
    padding: 16px 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    white-space: pre-wrap;
}