:root {
  --bg: #f3f5f9;
  --card-bg: #ffffff;
  --text: #16192b;
  --muted: #67708a;
  --primary: #2952e3;
  --primary-hover: #1f3fc0;
  --primary-soft: #eef1ff;
  --border: #e3e6ef;
  --border-strong: #cbd0e0;
  --error: #c0392b;
  --error-soft: #fdeceb;
  --warn-bg: #fff8e6;
  --warn-border: #f2cf7a;
  --success: #1a9c6b;
  --success-soft: #e9f9f2;
  --shadow: 0 1px 2px rgba(16, 24, 60, 0.04), 0 8px 24px -12px rgba(16, 24, 60, 0.12);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 480px at 15% -10%, #e9edff 0%, rgba(233, 237, 255, 0) 60%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.brand-icon svg { width: 20px; height: 20px; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-text strong {
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.brand-text span {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------- Layout ---------- */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 20px;
  line-height: 1.5;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 26px;
  box-shadow: var(--shadow);
}

.hidden { display: none; }

/* ---------- Stepper ---------- */
.stepper {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0 0 22px;
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.step-index {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  background: var(--border);
  color: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.step.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.step.is-active .step-index { background: var(--primary); color: #fff; }

.step.is-done { color: var(--success); }
.step.is-done .step-index { background: var(--success); color: #fff; }

@media (max-width: 560px) {
  .step-label { display: none; }
  .step { justify-content: center; }
}

/* ---------- Dropzones ---------- */
.dropzone-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}

@media (max-width: 620px) {
  .dropzone-grid { grid-template-columns: 1fr; }
}

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  background: #fbfcfe;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone.is-dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.01);
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-soft);
}

.dropzone-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.dropzone.has-file .dropzone-icon { background: var(--success-soft); color: var(--success); }

.dropzone-icon svg { width: 20px; height: 20px; }

.dropzone-title {
  font-weight: 600;
  font-size: 0.92rem;
  margin: 0 0 4px;
}

.dropzone-hint {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0;
}

.dropzone-file {
  margin: 10px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--success);
  word-break: break-all;
}

.dropzone-file:empty::before {
  content: attr(data-empty);
  color: var(--muted);
  font-weight: 400;
}

/* ---------- Buttons ---------- */
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.actions-center { justify-content: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

.btn .icon { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(41, 82, 227, 0.55);
}

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

.btn-primary:active { transform: translateY(1px); }

.btn-primary:disabled {
  background: #a9b3d6;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-ghost:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

.btn-small { padding: 8px 14px; font-size: 0.82rem; }

/* ---------- Loading ---------- */
.loading-box {
  text-align: center;
  padding: 18px 0 6px;
}

.loading-box .subtitle { margin-bottom: 0; }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Review table ---------- */
.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: #8a6414;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin: 0 0 16px;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
  max-height: 420px;
  overflow-y: auto;
}

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
  vertical-align: top;
}

thead th {
  position: sticky;
  top: 0;
  background: #f7f8fc;
  color: var(--muted);
  font-weight: 600;
  z-index: 1;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }

td input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.86rem;
  font-family: inherit;
  background: #fff;
}

td input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

td input.confidence-baixa {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

/* ---------- Done state ---------- */
.done-box { text-align: center; padding: 8px 0; }

.done-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
}

.done-icon svg { width: 26px; height: 26px; }

/* ---------- Misc ---------- */
.error {
  color: var(--error);
  font-size: 0.85rem;
  margin: 14px 0 0;
  white-space: pre-wrap;
}

.error:empty { display: none; }

.trust-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 22px 0 0;
}
