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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 32px;
    max-width: 1280px;
    width: 100%;
}

.header { text-align: center; margin-bottom: 24px; }
.header h1 { color: #333; font-size: 2.3rem; margin-bottom: 10px; }
.header p { color: #666; font-size: 1.05rem; }

.tabs { display: flex; gap: 12px; margin-bottom: 20px; }
.tab-button {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    background: #f7f8ff;
    color: #4a5d92;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tab-button.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(102, 126, 234, 0.25);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: #333; font-weight: 700; font-size: 1.02rem; }
.form-group select, .form-group input[type="text"] {
    width: 100%;
    padding: 14px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s ease;
}
.form-group select:focus, .form-group input[type="text"]:focus { outline: none; border-color: #667eea; }

.file-upload { position: relative; display: inline-block; width: 100%; }
.file-upload input[type="file"] { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.file-upload-area {
    border: 3px dashed #e1e5e9;
    border-radius: 15px;
    padding: 28px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}
.file-upload-area:hover, .file-upload-area.dragover { border-color: #667eea; background: #f0f2ff; }
.file-icon { font-size: 2.6rem; color: #667eea; margin-bottom: 12px; }
.file-text { color: #666; font-size: 1rem; margin-bottom: 8px; }
.file-selected { color: #667eea; font-weight: 700; font-size: 0.95rem; }

.buttons { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.btn {
    flex: 1;
    min-width: 160px;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.btn-success { background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%); color: white; }
.btn-info { background: linear-gradient(135deg, #36d1dc 0%, #5b86e5 100%); color: white; }
.btn-outline { background: #f5f6ff; color: #4a5d92; border: 1px solid #d7dbff; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(102, 126, 234, 0.2); }

.callout { background: #f5f7ff; border: 1px solid #e4e7ff; color: #3f4d7e; padding: 12px 14px; border-radius: 10px; margin: 14px 0; }

.error-message, .success-message {
    padding: 14px;
    border-radius: 10px;
    margin-top: 10px;
    display: none;
}
.error-message { background: #fee; border: 1px solid #fcc; color: #c33; }
.success-message { background: #efe; border: 1px solid #cfc; color: #2f7a3f; }

.loading { display: none; text-align: center; margin-top: 18px; }
.spinner { border: 3px solid #f3f3f3; border-top: 3px solid #667eea; border-radius: 50%; width: 28px; height: 28px; animation: spin 1s linear infinite; margin: 0 auto 10px; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.progress-container { display: none; margin-top: 18px; }
.progress-bar-wrapper {
    background: #f0f0f0;
    border-radius: 10px;
    height: 24px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
    position: relative;
}
.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.progress-text {
    text-align: center;
    margin-top: 8px;
    color: #666;
    font-size: 0.9rem;
}
.progress-cancel {
    margin-top: 10px;
    text-align: center;
}
.cancel-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.cancel-btn:hover {
    background: #ff5252;
    transform: translateY(-1px);
}

.results { margin-top: 18px; padding: 16px; background: #f8f9fa; border-radius: 10px; display: none; }
.results h3 { margin-bottom: 10px; color: #333; }
#excelPreview {
    max-height: 460px;
    overflow: hidden;
}
.preview-scroll { overflow: auto; margin-top: 10px; }
#excelPreview .preview-scroll { max-height: 340px; }
.table-wrapper {
    display: inline-block;
    min-width: 100%;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
table { width: auto; border-collapse: collapse; min-width: 760px; table-layout: auto; }
th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    min-width: 200px;
    vertical-align: top;
}
.cell-content {
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    max-width: 380px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
}
th { background: #667eea; color: white; }
.table-wrapper table thead tr:first-child th {
    position: sticky;
    top: 0;
    z-index: 1;
}
tr:hover { background: #f0f2ff; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; padding: 20px; visibility: hidden; opacity: 0; transition: opacity 0.25s ease, visibility 0.25s ease; z-index: 1000; }
.modal-overlay.open { visibility: visible; opacity: 1; }
.modal { background: #fff; border-radius: 14px; padding: 24px; max-width: 440px; width: 100%; box-shadow: 0 20px 40px rgba(0,0,0,0.18); }
.modal h2 { margin-bottom: 8px; color: #333; }
.modal p { margin-bottom: 14px; color: #555; line-height: 1.5; }
.modal input { width: 100%; padding: 12px; border: 2px solid #e1e5e9; border-radius: 10px; font-size: 1rem; }
.modal input:focus { outline: none; border-color: #5b86e5; }
.modal-error { margin-top: 10px; color: #c33; background: #fee; border: 1px solid #fcc; border-radius: 8px; padding: 10px 12px; display: none; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }

.preview-placeholder { color: #666; font-style: italic; text-align: center; padding: 18px; }
.mapping-select { width: 100%; padding: 8px; border-radius: 8px; border: 1px solid #d9def5; font-size: 0.9rem; }
.mapping-row th { background: #eef0ff; color: #3f4d7e; position: sticky; top: 0; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chip { background: #eef0ff; color: #3f4d7e; padding: 6px 10px; border-radius: 999px; font-size: 0.85rem; }

.skip-list { margin-top: 10px; max-height: 220px; overflow: auto; padding-right: 6px; }
.skip-item { padding: 6px 8px; border-bottom: 1px dashed #e1e5e9; color: #7a1f1f; font-size: 0.95rem; }

@media (max-width: 768px) {
    .container { padding: 18px; }
    .header h1 { font-size: 1.8rem; }
    table { min-width: 640px; }
    .buttons { flex-direction: column; }
}
