/* ================================================
   SINISTRO FLOW — Stylesheet
   Profissional / Institucional (Seguros)
   ================================================ */

:root {
  --primary: #0f2a4a;
  --primary-light: #1e3a5f;
  --primary-dark: #08182b;
  --accent: #f97316;
  --accent-light: #fdba74;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --info: #3b82f6;
  --info-bg: #dbeafe;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 4px 12px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, .10);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 180ms ease;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ LAYOUT ============ */

body {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ============ SIDEBAR ============ */

.sidebar {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #cbd5e1;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255,255,255,.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 .5rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 1.5rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: white;
  box-shadow: 0 4px 12px rgba(249, 115, 22, .35);
}

.brand-logo svg { width: 24px; height: 24px; }

.brand-text h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: white;
  letter-spacing: -.02em;
}

.brand-text span {
  font-size: .75rem;
  color: #94a3b8;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem .85rem;
  color: #cbd5e1;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: .9rem;
  transition: var(--transition);
}

.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: white;
  text-decoration: none;
}

.nav-item.active {
  background: rgba(249, 115, 22, .15);
  color: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding-left: calc(.85rem - 3px);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

.user-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem;
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #c2410c 100%);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 1rem;
}

.user-info strong { display: block; color: white; font-size: .9rem; }
.user-info span { font-size: .75rem; color: #94a3b8; }

/* ============ MAIN ============ */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem;
  color: var(--text);
}

.menu-toggle svg { width: 20px; height: 20px; }

.topbar-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: .5rem;
}

/* ============ VIEWS ============ */

.view {
  display: none;
  padding: 2rem;
  flex: 1;
}

.view.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.page-header h2 {
  margin: 0 0 .25rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: .9rem;
}

/* ============ STATS ============ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }
.stat-blue   { background: var(--info-bg);    color: var(--info); }
.stat-orange { background: #ffedd5;          color: var(--accent); }
.stat-green  { background: var(--success-bg); color: var(--success); }
.stat-purple { background: #ede9fe;          color: #7c3aed; }

.stat-label {
  display: block;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .15rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

/* ============ CARDS ============ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.card-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: .88rem;
  margin: -.5rem 0 1rem;
}

.link { font-weight: 500; font-size: .85rem; }

/* ============ BADGES ============ */

.badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
}

.badge-blue   { background: var(--info-bg);    color: var(--info);    border-color: transparent; }
.badge-orange { background: #ffedd5;          color: var(--accent);  border-color: transparent; }
.badge-green  { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge-red    { background: var(--danger-bg);  color: var(--danger);  border-color: transparent; }
.badge-yellow { background: var(--warning-bg); color: var(--warning); border-color: transparent; }

/* ============ BUTTONS ============ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .88rem;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

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

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

.btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--surface-2); border-color: #cbd5e1; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

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

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #dc2626; }

/* ============ TABLES ============ */

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.data-table th {
  text-align: left;
  padding: .75rem 1rem;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-2); }

.data-table .empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem 1rem;
}

.row-actions {
  display: flex;
  gap: .35rem;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.icon-btn svg { width: 16px; height: 16px; }

/* ============ TYPE CARDS (New Analysis) ============ */

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.type-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.type-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.type-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
}

.type-icon svg { width: 28px; height: 28px; }
.type-blue   { background: var(--info-bg); color: var(--info); }
.type-orange { background: #ffedd5; color: var(--accent); }

.type-card h3 {
  margin: 0 0 .5rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.type-card p {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: .9rem;
  line-height: 1.6;
}

.type-cta {
  display: inline-block;
  color: var(--primary);
  font-weight: 600;
  font-size: .88rem;
}

/* ============ STEPPER ============ */

.stepper {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.step {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: .9rem;
  flex: 1;
  white-space: nowrap;
}

.step span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: .8rem;
  font-weight: 700;
}

.step.active {
  background: var(--info-bg);
  color: var(--info);
}

.step.active span {
  background: var(--info);
  color: white;
  border-color: var(--info);
}

.step.done {
  color: var(--success);
}

.step.done span {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

/* ============ STEP CONTENT ============ */

.step-content {
  display: none;
}

.step-content.active {
  display: block;
}

/* ============ FORMS ============ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem 1.25rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.form-field.full { grid-column: 1 / -1; }

.form-field label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}

.form-field input,
.form-field textarea,
.form-field select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem .75rem;
  font-size: .9rem;
  background: var(--surface);
  color: var(--text);
  transition: var(--transition);
  width: 100%;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px var(--info-bg);
}

.form-field textarea { resize: vertical; min-height: 80px; }

/* ============ UPLOAD ============ */

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  transition: var(--transition);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: #fff7ed;
}

.upload-inner svg {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
  margin-bottom: .5rem;
}

.upload-inner p {
  margin: .25rem 0;
  color: var(--text);
}

.upload-inner span {
  color: var(--text-muted);
  font-size: .82rem;
}

.files-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
}

.file-item .file-icon {
  width: 32px;
  height: 32px;
  background: var(--info-bg);
  color: var(--info);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.file-item .file-icon svg { width: 16px; height: 16px; }

.file-item .file-name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item .file-size {
  color: var(--text-muted);
  font-size: .78rem;
}

.file-item .file-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: .25rem;
  border-radius: var(--radius-sm);
}

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

.file-item .file-remove svg { width: 16px; height: 16px; }

.ocr-controls {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.ocr-controls .hint {
  font-size: .82rem;
  color: var(--text-muted);
}

.ocr-result {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.ocr-result h4 {
  margin: 0 0 .5rem;
  font-size: .9rem;
}

.ocr-result textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem .75rem;
  font-family: 'Menlo', 'Monaco', monospace;
  font-size: .82rem;
  margin-bottom: .75rem;
  resize: vertical;
}

/* ============ EXTRACT BANNER ============ */

.extract-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--info-bg);
  border: 1px solid #93c5fd;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.extract-banner.loading { background: var(--info-bg); border-color: #93c5fd; }
.extract-banner.success { background: var(--success-bg); border-color: #6ee7b7; }
.extract-banner.warning { background: var(--warning-bg); border-color: #fcd34d; }
.extract-banner.error   { background: var(--danger-bg);  border-color: #fca5a5; }

.extract-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: white;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--info);
}

.extract-banner.loading .extract-banner-icon { color: var(--info); }
.extract-banner.success .extract-banner-icon { color: var(--success); }
.extract-banner.warning .extract-banner-icon { color: var(--warning); }
.extract-banner.error   .extract-banner-icon { color: var(--danger); }

.extract-banner.loading .extract-banner-icon svg {
  animation: spin 1.2s linear infinite;
}

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

.extract-banner-icon svg { width: 22px; height: 22px; }

.extract-banner-body {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
}

.extract-banner-body strong {
  font-size: .95rem;
  color: var(--text);
}

.extract-banner-body span {
  font-size: .82rem;
  color: var(--text-muted);
}

.extract-banner-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ============ READONLY / NOT-IDENTIFIED FIELDS ============ */

.form-field input[readonly],
.form-field textarea[readonly],
.form-field select[disabled] {
  background: var(--surface-2);
  color: var(--text);
  cursor: default;
  border-color: var(--border);
}

.form-field input[readonly]:focus,
.form-field textarea[readonly]:focus {
  outline: none;
  box-shadow: none;
  border-color: var(--border);
}

.form-field.not-identified input,
.form-field.not-identified textarea,
.form-field.not-identified select {
  background: var(--warning-bg) !important;
  border-color: var(--warning) !important;
  color: #92400e;
  font-style: italic;
}

.form-field.not-identified label::after {
  content: ' • Não identificado';
  font-size: .72rem;
  font-weight: 500;
  color: var(--warning);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-left: .3rem;
}

.form-field.identified input,
.form-field.identified textarea,
.form-field.identified select {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.form-field.identified label::after {
  content: ' ✓';
  font-weight: 700;
  color: var(--success);
  margin-left: .25rem;
}

/* ============ EDIT MODE ============ */

body.edit-mode .form-field input[readonly],
body.edit-mode .form-field textarea[readonly] {
  background: var(--surface);
  cursor: text;
}

body.edit-mode .form-field.not-identified input,
body.edit-mode .form-field.not-identified textarea {
  background: white !important;
  font-style: normal;
}

/* ============ LOGIN OVERLAY ============ */

.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: grid;
  place-items: center;
  padding: 1.5rem;
  z-index: 1000;
}

.login-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(249, 115, 22, 0.15) 0, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.15) 0, transparent 50%);
  pointer-events: none;
}

.login-card {
  position: relative;
  background: white;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.25rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  background: var(--accent);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: white;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.4);
}

.login-logo svg { width: 32px; height: 32px; }

.login-brand h1 {
  margin: 0 0 .25rem;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
}

.login-brand p {
  margin: 0;
  font-size: .88rem;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form .btn {
  width: 100%;
  justify-content: center;
  margin-top: .5rem;
}

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  border: 1px solid var(--danger);
}

.login-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
}

/* ============ LOGOUT BUTTON ============ */

.logout-btn {
  margin-top: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .5rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-size: .82rem;
  font-weight: 500;
  transition: var(--transition);
}

.logout-btn:hover {
  background: rgba(239,68,68,.15);
  color: #fca5a5;
  border-color: rgba(239,68,68,.3);
}

.logout-btn svg { width: 14px; height: 14px; }

/* Hide app shell while not logged in */
body.not-authenticated > .sidebar,
body.not-authenticated > .main {
  display: none !important;
}

/* ============ ENVIRONMENT WARNING BANNER ============ */

.env-banner {
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.env-banner.critical {
  background: #fef2f2;
  border: 2px solid var(--danger);
}

.env-banner.warning {
  background: var(--warning-bg);
  border: 2px solid var(--warning);
}

.env-problem {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.env-icon {
  width: 44px;
  height: 44px;
  background: white;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.env-banner.critical .env-icon { color: var(--danger); }
.env-banner.warning  .env-icon { color: var(--warning); }

.env-icon svg { width: 22px; height: 22px; }

.env-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.env-content strong {
  display: block;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: .25rem;
}

.env-content span {
  font-size: .88rem;
  color: var(--text);
  line-height: 1.55;
}

/* ============ PROGRESS PANEL ============ */

.progress-panel {
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--info-bg);
  border: 1px solid #93c5fd;
  border-radius: var(--radius);
}

.progress-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.progress-spinner {
  width: 42px;
  height: 42px;
  background: white;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--info);
  flex-shrink: 0;
}

.progress-spinner svg {
  width: 22px;
  height: 22px;
  animation: spin 1.2s linear infinite;
}

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

.progress-info strong {
  display: block;
  font-size: .95rem;
  color: var(--text);
}

.progress-info span {
  font-size: .82rem;
  color: var(--text-muted);
}

.progress-percent {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--info);
  letter-spacing: -.02em;
}

.progress-bar {
  height: 8px;
  background: rgba(255,255,255,.6);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--info), var(--primary));
  border-radius: 4px;
  width: 0;
  transition: width 220ms ease;
}

.progress-log {
  margin-top: 1rem;
  max-height: 140px;
  overflow-y: auto;
  font-family: 'Menlo', 'Monaco', monospace;
  font-size: .78rem;
  color: var(--text-muted);
  background: rgba(255,255,255,.5);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
}

.progress-log:empty { display: none; }

.progress-log-line {
  padding: .15rem 0;
  display: flex;
  gap: .5rem;
}

.progress-log-line .log-time {
  color: #94a3b8;
  flex-shrink: 0;
}

.progress-log-line.log-error { color: var(--danger); font-weight: 500; }
.progress-log-line.log-success { color: var(--success); font-weight: 500; }

/* ============ DATA PANEL (colapsável) ============ */

.data-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-panel summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .95rem;
  user-select: none;
  transition: var(--transition);
}

.data-panel summary::-webkit-details-marker { display: none; }

.data-panel summary:hover { background: var(--surface-2); }

.data-panel summary svg {
  width: 18px;
  height: 18px;
  transition: transform 220ms ease;
  color: var(--text-muted);
}

.data-panel[open] summary svg {
  transform: rotate(180deg);
}

.data-panel summary strong { flex: 1; }

.data-panel-body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.data-panel-body .card {
  border: 1px solid var(--border);
  box-shadow: none;
}

/* ============ COVERAGE CHECKS DISPLAY ============ */

.coverage-checks {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .5rem;
}

.coverage-check {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

.coverage-check.ok      { background: #ecfdf5; border-color: #6ee7b7; }
.coverage-check.fail    { background: #fef2f2; border-color: var(--danger); }
.coverage-check.unknown { background: var(--surface-2); border-color: var(--border); }

.coverage-check .check-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.coverage-check.ok      .check-icon { color: var(--success); }
.coverage-check.fail    .check-icon { color: var(--danger); }
.coverage-check.unknown .check-icon { color: var(--text-muted); }

.coverage-check .check-icon svg { width: 22px; height: 22px; }

.coverage-check .check-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.coverage-check .check-body strong {
  font-size: .9rem;
}

.coverage-check.fail .check-body strong { color: var(--danger); }
.coverage-check.ok .check-body strong { color: #065f46; }

.coverage-check .check-body span {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .15rem;
}

/* ============ FRAUD FLAGS DISPLAY ============ */

.fraud-flag-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .5rem;
}

.fraud-flag {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  font-size: .9rem;
}

.fraud-flag .flag-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--warning);
}

.fraud-flag .flag-icon svg { width: 22px; height: 22px; }

.fraud-clear {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  color: #065f46;
  font-weight: 500;
}

.fraud-clear svg {
  width: 22px;
  height: 22px;
  color: var(--success);
  flex-shrink: 0;
}

.fraud-decision-display {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.fraud-decision-display .label {
  font-weight: 600;
  font-size: .9rem;
}

.fraud-decision-badge {
  padding: .4rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .04em;
}

.fraud-decision-badge.sim {
  background: var(--danger-bg);
  color: var(--danger);
}

.fraud-decision-badge.nao {
  background: var(--success-bg);
  color: var(--success);
}

/* ============ BUTTON SIZES ============ */

.btn-sm {
  padding: .4rem .75rem;
  font-size: .8rem;
}

.btn-sm svg { width: 14px; height: 14px; }

/* ============ BIG CTA ============ */

.btn-lg {
  padding: .85rem 1.5rem;
  font-size: .95rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(15, 42, 74, .25);
}

.btn-lg:hover { box-shadow: 0 6px 18px rgba(15, 42, 74, .35); }

.actions-cta {
  align-items: center;
}

.actions-cta .btn-primary.btn-lg {
  font-weight: 700;
}

/* ============ CHECKLIST (Fraud) ============ */

.checklist {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
}

.checklist-item:hover {
  border-color: var(--accent);
  background: #fff7ed;
}

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  margin-top: 1px;
  flex-shrink: 0;
}

.checklist-item.checked {
  background: var(--warning-bg);
  border-color: var(--warning);
}

.checklist-item .item-text {
  font-size: .9rem;
  color: var(--text);
}

.fraud-summary {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.fraud-classification strong {
  display: block;
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: .25rem;
}

.fraud-classification #fraudClassText {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.fraud-decision {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.fraud-decision label {
  font-size: .85rem;
  font-weight: 600;
}

.toggle-group {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.toggle-btn {
  background: transparent;
  border: none;
  padding: .5rem 1rem;
  font-weight: 600;
  font-size: .85rem;
  color: var(--text-muted);
  transition: var(--transition);
}

.toggle-btn:hover { background: var(--surface-2); }

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

/* ============ REPORT ============ */

.report-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.report-preview {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: .85rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 600px;
  overflow-y: auto;
  color: var(--text);
}

/* ============ ACTIONS BAR ============ */

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ============ SEARCH BAR ============ */

.search-bar input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .85rem;
  font-size: .88rem;
  min-width: 280px;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px var(--info-bg);
}

/* ============ TOAST ============ */

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text);
  color: white;
  padding: .85rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-weight: 500;
  font-size: .88rem;
  transform: translateY(120%);
  transition: transform 300ms cubic-bezier(.4, 0, .2, 1);
  z-index: 100;
}

.toast.show { transform: translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ============ RESPONSIVE ============ */

@media (max-width: 1024px) {
  body { grid-template-columns: 220px 1fr; }
}

@media (max-width: 768px) {
  body { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    width: 260px;
    transform: translateX(-100%);
    z-index: 100;
    transition: transform 220ms ease;
  }

  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: grid; }
  .view { padding: 1.25rem; }
  .topbar { padding: 1rem 1.25rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.3rem; }
  .type-grid { grid-template-columns: 1fr; }
  .fraud-summary { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-actions .btn span,
  .topbar-actions .btn { font-size: .8rem; padding: .5rem .75rem; }
  .step { padding: .4rem .65rem; font-size: .8rem; }
  .step span { width: 22px; height: 22px; font-size: .72rem; }
}

/* ============ PRINT ============ */

@media print {
  .sidebar, .topbar, .actions, .stepper, .card-header .report-actions { display: none !important; }
  body { display: block; background: white; }
  .view { padding: 0; display: block !important; }
  .view:not(#view-analysis) { display: none !important; }
  .step-content { display: none !important; }
  #step-4 { display: block !important; }
  .card { box-shadow: none; border: none; }
  .report-preview { background: white; border: none; padding: 0; }
}
