/* ============================================
   RESET & BASE
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.6;
}

/* ============================================
   LOGIN
   ============================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 24px;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.login-header p {
    color: #86868b;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e5e7;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: #667eea;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: #86868b;
    font-size: 13px;
}

.alert-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ============================================
   HEADER
   ============================================ */
header {
    background: #fff;
    border-bottom: 1px solid #e5e5e7;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    font-size: 20px;
}

header nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    color: #86868b;
    font-size: 14px;
}

/* ============================================
   MAIN
   ============================================ */
main {
    max-width: 900px;
    margin: 24px auto;
    padding: 0 20px;
}

footer {
    text-align: center;
    padding: 24px;
    color: #86868b;
    font-size: 13px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: #fff;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f2;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #667eea;
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.card-body {
    padding: 20px 24px;
}

.card-body p {
    color: #515154;
    font-size: 15px;
    margin-bottom: 16px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #5a6fd6;
}

.btn-success {
    background: #34c759;
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: #2db84e;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: #fff;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ============================================
   UPLOAD AREA
   ============================================ */
.upload-area {
    border: 2px dashed #d2d2d7;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f8ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #eef0ff;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.upload-area p {
    margin-bottom: 4px !important;
}

.upload-hint {
    color: #86868b !important;
    font-size: 13px !important;
}

.file-name {
    margin-top: 8px;
    font-size: 14px;
    color: #667eea;
    font-weight: 600;
}

/* ============================================
   STATUS & INFO
   ============================================ */
.status-msg {
    margin-top: 12px;
    font-size: 14px;
}

.status-msg.loading {
    color: #667eea;
}

.status-msg.success {
    color: #34c759;
}

.status-msg.error {
    color: #ff3b30;
}

.info-box {
    background: #f0f0f2;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    font-size: 14px;
}

.info-safe {
    background: #e8f8ec;
    color: #1a7a2e;
}

/* ============================================
   TABLE
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    background: #f5f5f7;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #515154;
    border-bottom: 2px solid #e5e5e7;
    white-space: nowrap;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f2;
}

tr:hover {
    background: #fafafe;
}

td.arrow {
    color: #667eea;
    font-weight: bold;
    text-align: center;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-ok { background: #e8f8ec; color: #1a7a2e; }
.badge-warn { background: #fff3cd; color: #856404; }
.badge-change { background: #e8eeff; color: #4a5ac7; }
.badge-same { background: #f0f0f2; color: #86868b; }

/* ============================================
   PROGRESS
   ============================================ */
.progress-bar-container {
    background: #e5e5e7;
    border-radius: 8px;
    height: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

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

.progress-text {
    text-align: center;
    color: #515154;
    font-size: 14px;
    margin-bottom: 16px;
}

.progress-log {
    background: #1d1d1f;
    color: #a0ffa0;
    border-radius: 10px;
    padding: 16px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 13px;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.8;
}

.log-ok { color: #34c759; }
.log-warn { color: #ffcc00; }
.log-err { color: #ff3b30; }
.log-skip { color: #86868b; }

/* ============================================
   RESULTADO
   ============================================ */
.resultado-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.resultado-item {
    background: #f5f5f7;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.resultado-item .numero {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.resultado-item .label {
    font-size: 13px;
    color: #86868b;
    margin-top: 4px;
}

.resultado-item.sucesso { background: #e8f8ec; }
.resultado-item.sucesso .numero { color: #1a7a2e; }
.resultado-item.erro { background: #fee; }
.resultado-item.erro .numero { color: #c33; }
.resultado-item.aviso { background: #fff3cd; }
.resultado-item.aviso .numero { color: #856404; }

.action-bar {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
    .card-body { padding: 16px; }
    .header-content { padding: 0 16px; }
    main { padding: 0 12px; }
    .btn-lg { padding: 14px 20px; font-size: 15px; }
    table { font-size: 12px; }
    th, td { padding: 8px 6px; }
    .resultado-grid { grid-template-columns: repeat(2, 1fr); }
}
