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

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: rgba(30, 30, 55, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #e8e8f0;
  --text-secondary: #9d9dba;
  --text-muted: #6b6b8a;
  --accent-primary: #6c5ce7;
  --accent-secondary: #a29bfe;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --success: #00cec9;
  --warning: #fdcb6e;
  --positive: #00b894;
  --negative: #e17055;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
}

html { font-size: 16px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(at 20% 0%, rgba(108, 92, 231, 0.15) 0px, transparent 50%),
    radial-gradient(at 80% 100%, rgba(0, 206, 201, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
}

.container { max-width: 1280px; margin: 0 auto; padding: 32px 24px 80px; }

/* Nav */
.nav-back { margin-bottom: 24px; }
.nav-back__link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-secondary); text-decoration: none;
  font-size: 0.9rem; font-weight: 500;
  padding: 8px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}
.nav-back__link:hover { color: var(--text-primary); border-color: var(--accent-primary); }

/* Header */
.header { text-align: center; margin-bottom: 48px; }
.header__icon { font-size: 3rem; margin-bottom: 12px; }
.header__title { font-size: 2.4rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.header__subtitle { color: var(--text-secondary); font-size: 1rem; }

/* Step */
.step {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  backdrop-filter: blur(12px);
}
.step__header { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 24px; }
.step__number {
  flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: grid; place-items: center;
  font-weight: 700; color: white;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.step__title { font-size: 1.25rem; font-weight: 600; margin-bottom: 2px; }
.step__hint { color: var(--text-secondary); font-size: 0.9rem; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

/* Form */
.label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 8px;
}
.input, .textarea, .select {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit; font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition-fast);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

/* Dropzone */
.dropzone {
  position: relative;
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-glass);
  transition: var(--transition-fast);
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent-primary);
  background: rgba(108, 92, 231, 0.08);
}
.dropzone--small { padding: 28px 16px; }
.dropzone__icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.dropzone__text { font-weight: 600; margin-bottom: 4px; }
.dropzone__hint { color: var(--text-muted); font-size: 0.85rem; }
.dropzone__input { display: none; }

/* File info */
.file-info {
  display: none;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(0, 206, 201, 0.08);
  border: 1px solid rgba(0, 206, 201, 0.25);
  border-radius: var(--radius-sm);
}
.file-info.visible { display: flex; }
.file-info__icon { font-size: 1.2rem; }
.file-info__name { font-weight: 600; font-size: 0.92rem; }
.file-info__meta { font-size: 0.8rem; color: var(--text-muted); }

/* File list */
.file-list { list-style: none; margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.file-list__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.file-list__icon { color: var(--accent-secondary); }
.file-list__name { flex: 1; }
.file-list__remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem;
  padding: 0 6px;
}
.file-list__remove:hover { color: var(--negative); }
.file-list__pwd {
  width: 180px;
  padding: 6px 10px;
  font-family: inherit; font-size: 0.85rem;
  color: var(--text-primary);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  outline: none;
  transition: var(--transition-fast);
}
.file-list__pwd::placeholder { color: var(--text-muted); }
.file-list__pwd:focus { border-color: var(--accent-primary); }

/* Action row */
.action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 32px 0;
  flex-wrap: wrap;
}
.action-row__hint { color: var(--text-muted); font-size: 0.88rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  font-family: inherit; font-size: 0.92rem; font-weight: 600;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition-fast);
}
.btn--primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}
.btn--primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}
.btn--secondary:hover { border-color: var(--accent-primary); }
.btn--lg { padding: 14px 28px; font-size: 1rem; }
.btn--sm { padding: 6px 12px; font-size: 0.82rem; }

/* Diff box */
.diff-box {
  margin-top: -4px; margin-bottom: 8px;
  padding: 14px 16px;
  background: rgba(108, 92, 231, 0.05);
  border: 1px solid rgba(108, 92, 231, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
.diff-box__resumo { color: var(--text-secondary); font-style: italic; margin-bottom: 8px; }
.diff-box__sec { margin: 8px 0; }
.diff-box__list { list-style: none; padding-left: 0; margin: 6px 0; }
.diff-box__list li { padding: 4px 0; line-height: 1.5; }
.diff-box__list label { cursor: pointer; }
.diff-box__list input[type="checkbox"] { margin-right: 6px; }

/* Spinner */
.spinner {
  display: none; flex-direction: column; align-items: center; gap: 14px;
  margin: 32px 0;
}
.spinner.visible { display: flex; }
.spinner__circle {
  width: 40px; height: 40px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner__text { color: var(--text-secondary); font-size: 0.95rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 768px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.stat-card__value { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; color: var(--text-primary); }
.stat-card__value--positive { color: var(--positive); }
.stat-card__value--warning { color: var(--warning); }
.stat-card__value--negative { color: var(--negative); }
.stat-card__label { color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* Conferência */
.conf {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
}
.conf__title {
  font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-secondary);
  font-weight: 600; margin-bottom: 10px;
}
.conf__list { display: flex; flex-direction: column; gap: 8px; }
.conf__row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
@media (max-width: 768px) {
  .conf__row { grid-template-columns: 1fr 1fr; }
}
.conf__row--ok { border-color: rgba(0, 184, 148, 0.35); }
.conf__row--divergente { border-color: rgba(225, 112, 85, 0.45); background: rgba(225, 112, 85, 0.05); }
.conf__file { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conf__cell-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.conf__cell-val { font-weight: 600; }
.conf__diff--neg { color: var(--negative); }
.conf__diff--pos { color: var(--warning); }
.conf__status {
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.conf__status--ok { background: rgba(0, 184, 148, 0.15); color: var(--positive); }
.conf__status--divergente { background: rgba(225, 112, 85, 0.18); color: var(--negative); }
.conf__status--sem { background: var(--bg-glass); color: var(--text-muted); }

/* Toolbar */
.toolbar {
  display: flex; gap: 14px; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar__search { position: relative; flex: 1; min-width: 220px; }
.toolbar__search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
}
.toolbar__search-input {
  width: 100%; padding: 10px 14px 10px 40px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit; font-size: 0.92rem;
  outline: none;
}
.toolbar__search-input:focus { border-color: var(--accent-primary); }
.toolbar__actions { display: flex; gap: 10px; }

/* Table */
.table-wrapper {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow-x: auto;
  max-height: 600px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  position: sticky; top: 0;
  background: var(--bg-secondary);
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}
.data-table tr:hover td { background: rgba(108, 92, 231, 0.04); }
.data-table .cell-input,
.data-table .cell-select {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit; font-size: 0.85rem;
  outline: none;
}
.data-table .cell-select { min-width: 180px; }
.data-table .cell-input:focus,
.data-table .cell-select:focus { border-color: var(--accent-primary); }

.value--positive { color: var(--positive); font-weight: 600; white-space: nowrap; }
.value--negative { color: var(--negative); font-weight: 600; white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge--alta { background: rgba(0, 184, 148, 0.15); color: var(--positive); }
.badge--media { background: rgba(253, 203, 110, 0.15); color: var(--warning); }
.badge--baixa { background: rgba(225, 112, 85, 0.15); color: var(--negative); }
.badge--pagar { background: rgba(225, 112, 85, 0.12); color: var(--negative); }
.badge--receber { background: rgba(0, 184, 148, 0.12); color: var(--positive); }

.row-delete {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem;
}
.row-delete:hover { color: var(--negative); }

/* Footer */
.footer {
  text-align: center; margin-top: 48px;
  color: var(--text-muted); font-size: 0.85rem;
}

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  padding: 12px 22px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.92rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  opacity: 0; pointer-events: none;
  transition: var(--transition-normal);
  z-index: 1000;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--success { border-color: var(--success); color: var(--success); }
.toast--error { border-color: var(--negative); color: var(--negative); }
