/* ============================================
   EXPORTADOR MULTI-BANCO — Automação Contábil
   ============================================ */

:root {
  --primary: #2563EB;
  --primary-light: #EFF6FF;
  --primary-hover: #1D4ED8;
  --success: #16A34A;
  --success-light: #F0FDF4;
  --success-bg: #DCFCE7;
  --danger: #DC2626;
  --danger-light: #FEF2F2;
  --danger-bg: #FEE2E2;
  --warning: #D97706;
  --warning-light: #FFFBEB;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --white: #FFFFFF;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.04);
  --transition: 0.18s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Page Header ─────────────────────────── */
.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 1px;
}

.btn-reset {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  color: var(--gray-500);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-reset:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-light);
}

/* ── Main Layout ─────────────────────────── */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* ── Section Card ────────────────────────── */
.section-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}

.section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .step-badge {
  width: 22px;
  height: 22px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-body {
  padding: 20px;
}

/* ── Drop Zone ───────────────────────────── */
.drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--gray-50);
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-icon {
  font-size: 36px;
  margin-bottom: 10px;
  display: block;
  opacity: 0.5;
}

.drop-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.drop-hint {
  font-size: 12px;
  color: var(--gray-400);
}

.drop-formats {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.format-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.format-badge.ofx {
  background: #EEF2FF;
  color: #4338CA;
}

.format-badge.xlsx {
  background: #F0FDF4;
  color: #15803D;
}

.format-badge.xls {
  background: #F0FDF4;
  color: #15803D;
}

/* ── File List ───────────────────────────── */
.file-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.file-item.processing {
  border-color: var(--primary);
  background: var(--primary-light);
}

.file-item.success {
  border-color: #BBF7D0;
  background: var(--success-light);
}

.file-item.error {
  border-color: #FECACA;
  background: var(--danger-light);
}

.file-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.file-icon.ofx { background: #EEF2FF; color: #4338CA; }
.file-icon.xlsx,
.file-icon.xls { background: #F0FDF4; color: #15803D; }

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 1px;
}

.file-status {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.file-status.ok { color: var(--success); }
.file-status.err { color: var(--danger); }
.file-status.proc { color: var(--primary); }

.file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  line-height: 1;
  transition: color var(--transition);
  display: flex;
  align-items: center;
}

.file-remove:hover { color: var(--danger); }

/* ── Progress Bar ────────────────────────── */
.progress-wrap {
  margin-top: 14px;
  display: none;
}

.progress-wrap.visible { display: block; }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 6px;
}

.progress-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ── Stats Bar ───────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.5px;
}

.stat-value.green { color: var(--success); }
.stat-value.red { color: var(--danger); }

/* ── Table ───────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  width: 100%;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

thead th {
  background: var(--gray-50);
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

tbody td {
  padding: 9px 12px;
  vertical-align: middle;
  color: var(--gray-700);
  white-space: nowrap;
}

/* ── Row colors ─────────────────────────── */
tbody tr.row-entrada {
  background: rgba(220, 252, 231, 0.35);
}

tbody tr.row-saida {
  background: rgba(254, 226, 226, 0.35);
}

tbody tr.row-entrada:hover { background: rgba(220, 252, 231, 0.6); }
tbody tr.row-saida:hover { background: rgba(254, 226, 226, 0.6); }

.valor-entrada {
  color: #15803D;
  font-weight: 600;
}

.valor-saida {
  color: #DC2626;
  font-weight: 600;
}

/* ── Badges ──────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.badge-entrada {
  background: var(--success-bg);
  color: #15803D;
}

.badge-saida {
  background: var(--danger-bg);
  color: #DC2626;
}

/* ── Category select in table ────────────── */
.cat-select {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 3px 7px;
  font-size: 12px;
  color: var(--gray-700);
  cursor: pointer;
  transition: border-color var(--transition);
  max-width: 170px;
  width: 100%;
}

.cat-select:hover { border-color: var(--primary); }
.cat-select:focus { outline: none; border-color: var(--primary); }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-success {
  background: var(--success);
  color: var(--white);
}

.btn-success:hover {
  background: #15803D;
  box-shadow: var(--shadow-md);
}

.btn-success:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

.btn-outline {
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
}

.btn-outline:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

/* ── Action Row ──────────────────────────── */
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Empty State ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}

.empty-state svg {
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 14px;
}

/* ── Toast ───────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--gray-900);
  color: var(--white);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.25s ease;
  min-width: 260px;
  max-width: 360px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(6px); }
}

/* ── Filter Row ──────────────────────────── */
.filter-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-row select,
.filter-row input[type="text"] {
  padding: 7px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--gray-700);
  background: var(--white);
  transition: border-color var(--transition);
}

.filter-row select:focus,
.filter-row input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}

.filter-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  white-space: nowrap;
  align-self: center;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 640px) {
  .page-header { padding: 16px; }
  .main-content { padding: 16px 12px 48px; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .action-row { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; }
}

/* ── Botão compacto no topo da tabela ──────── */
.btn-sm-top {
  padding: 7px 14px;
  font-size: 12px;
  gap: 5px;
  margin-left: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-sm-top:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
  box-shadow: none;
}

/* Filtros: alinhar verticalmente com botão */
.filter-row {
  align-items: center;
}
