:root {
  --primary: #1e3a8a;
  --primary-light: #3b82f6;
  --primary-dark: #172554;
  --accent: #059669;
  --accent-light: #10b981;
  --accent-dark: #047857;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font);
  background-color: #f1f5f9;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
}

/* HEADER */
.site-header {
  background: var(--bg-gradient);
  color: white;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ================= SITE HEADER & NAVBAR EXECUTIVA ================= */
.site-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-top-bar {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-brand-logo {
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  border: none;
}

.navbar-logo-img {
  height: 44px;
  max-width: 200px;
  object-fit: contain;
  display: block;
}

.header-brand-divider {
  width: 1.5px;
  height: 34px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 0.2rem;
}

.site-title {
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.site-subtitle {
  font-size: 0.76rem;
  color: #94a3b8;
  font-weight: 400;
  display: block;
}

.header-meta-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: #cbd5e1;
}

.header-status-pill .status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-dot {
  width: 7px;
  height: 7px;
  background-color: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
}

.header-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

.btn-top-logout {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-top-logout:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ffffff;
}

/* ================= TOOLBAR NAVBAR ================= */
.site-navbar {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  padding: 0.45rem 1.5rem;
}

.navbar-content {
  max-width: 1380px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.navbar-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.navbar-group-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  font-weight: 700;
  margin-right: 0.25rem;
  white-space: nowrap;
}

.navbar-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 0.4rem;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.09);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.nav-btn-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.nav-btn-save {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  border-color: #10b981 !important;
  color: white !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}
.nav-btn-save:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* BOTOES DE IA GEMINI NA NAVBAR */
.nav-btn-ai-plano {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.3) 0%, rgba(99, 102, 241, 0.3) 100%) !important;
  border-color: rgba(167, 139, 250, 0.5) !important;
  color: #ede9fe !important;
  font-weight: 600 !important;
}
.nav-btn-ai-plano:hover {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.55) 0%, rgba(99, 102, 241, 0.55) 100%) !important;
  border-color: #c4b5fd !important;
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.4);
}

.nav-btn-ai-extrato {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.3) 0%, rgba(16, 185, 129, 0.3) 100%) !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
  color: #e0f2fe !important;
  font-weight: 600 !important;
}
.nav-btn-ai-extrato:hover {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.55) 0%, rgba(16, 185, 129, 0.55) 100%) !important;
  border-color: #7dd3fc !important;
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.4);
}

.nav-btn-ai-auditor {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(239, 68, 68, 0.25) 100%) !important;
  border-color: rgba(251, 191, 36, 0.5) !important;
  color: #fef3c7 !important;
  font-weight: 600 !important;
}
.nav-btn-ai-auditor:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.5) 0%, rgba(239, 68, 68, 0.5) 100%) !important;
  border-color: #fde68a !important;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
}

.header-user-badge {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #f1f5f9;
}

/* ================= LOGIN SCREEN ================= */
.login-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-gradient);
  padding: 1.5rem;
  z-index: 9999;
  overflow-y: auto;
}

.login-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 440px;
  margin: auto;
  padding: 2.5rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: fadeIn 0.4s ease-out;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-box {
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  border: none;
  box-shadow: none;
}

.login-logo-img {
  max-height: 64px;
  max-width: 240px;
  object-fit: contain;
  display: block;
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.login-error-msg {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.login-form .field-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
}

.login-form .field-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.login-input-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.login-input-icon {
  position: absolute;
  left: 0.95rem;
  font-size: 1.05rem;
  color: #94a3b8;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.login-input-group input {
  width: 100% !important;
  height: 48px !important;
  padding-left: 2.75rem !important;
  padding-right: 2.75rem !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: var(--radius-md) !important;
  font-size: 0.95rem !important;
  font-family: var(--font) !important;
  color: var(--text-main) !important;
  background-color: #ffffff !important;
  box-sizing: border-box !important;
  transition: all 0.2s ease !important;
}

.login-input-group input::-ms-reveal,
.login-input-group input::-ms-clear {
  display: none;
}

.login-input-group input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15) !important;
  outline: none !important;
}

.btn-toggle-pass {
  position: absolute;
  right: 0.85rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  color: #94a3b8;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: color 0.15s ease;
}

.btn-toggle-pass:hover {
  color: var(--primary);
}

.btn-login {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border: none;
  height: 48px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.login-footer {
  text-align: center;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* PROGRESS BAR */
.progress-bar-container {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.progress-steps {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text-muted);
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.step span {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.step.active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.step.active span {
  color: var(--primary);
  font-weight: 700;
}

.step.completed .step-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.step-line {
  flex: 1;
  height: 3px;
  background: #e2e8f0;
  margin: 0 0.5rem;
  margin-bottom: 1.2rem;
  transition: all 0.3s;
}

/* MAIN CONTENT */
.main-content {
  max-width: 1250px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.form-section {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.form-section.active {
  display: block;
}

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

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  background: white;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.section-icon {
  font-size: 2.2rem;
  width: 54px;
  height: 54px;
  background: #eff6ff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* CARDS & GRIDS */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  width: 100%;
}

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

.form-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
}

.form-card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.75rem;
}

.card-icon {
  margin-right: 0.5rem;
}

/* FORM FIELDS */
.field-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-sizing: border-box;
}

.field-group label {
  font-size: 0.83rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.required {
  color: #ef4444;
}

.field-hint {
  font-size: 0.74rem;
  color: #2563eb;
  margin-top: 0.35rem;
  font-weight: 500;
  line-height: 1.4;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.field-row > .field-group {
  min-width: 0;
}

@media (max-width: 640px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

/* TIMBRE BOX (CUSTOM, CLEAN, NO OVERFLOW) */
.timbre-box {
  margin-top: 0.75rem;
  background: #f8fafc;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px dashed #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.timbre-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timbre-box-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: #334155;
}

.btn-timbre-restore {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-timbre-restore:hover {
  background: #bae6fd;
}

.timbre-box-body {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.timbre-img-wrap {
  flex-shrink: 0;
  background: #ffffff;
  padding: 4px 8px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 150px;
}

.timbre-preview-img {
  max-height: 42px;
  max-width: 130px;
  object-fit: contain;
  display: block;
}

.timbre-action-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  flex: 1;
  min-width: 150px;
}

.btn-timbre-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #ffffff;
  color: #1e3a8a;
  border: 1.5px solid #cbd5e1;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-timbre-upload:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.timbre-filename-label {
  font-size: 0.74rem;
  color: #64748b;
  word-break: break-all;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: #ffffff;
  transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-highlight {
  border-color: #3b82f6 !important;
  background-color: #f0f7ff !important;
  font-weight: 600;
  color: #1e3a8a !important;
}

.input-readonly {
  background-color: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
  cursor: not-allowed;
  font-weight: 600;
}

textarea {
  resize: vertical;
}

/* TOTALS BOXES */
.totals-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 2px dashed #e2e8f0;
}

.total-box {
  background: #f8fafc;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  text-align: center;
}

.total-box span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.total-box strong {
  font-size: 1.6rem;
  color: var(--primary-dark);
  font-weight: 800;
}

/* DYNAMIC TABLE / ROWS */
.btn-add-row {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-row:hover {
  background: var(--accent-dark);
}

.dynamic-row-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.dynamic-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

.btn-remove-row {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-remove-row:hover {
  background: #dc2626;
  color: white;
}

/* NAVIGATION BUTTONS */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1rem;
}

.btn-next,
.btn-back {
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-next {
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-next:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.btn-back {
  background: white;
  color: #475569;
  border: 1.5px solid #cbd5e1;
}

.btn-back:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* STEP 5: ANEXOS GRID */
.anexos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.anexo-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.anexo-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  opacity: 0;
  transition: opacity 0.25s;
}

.anexo-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-xl);
}

.anexo-card:hover::before {
  opacity: 1;
}

.anexo-numero {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #eff6ff;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 0.65rem;
  align-self: flex-start;
}

.anexo-nome {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.45rem;
}

.anexo-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex: 1;
}

.btn-pdf {
  width: 100%;
  background: #f1f5f9;
  color: var(--primary-dark);
  border: 1.5px solid #cbd5e1;
  padding: 0.7rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.anexo-card:hover .btn-pdf {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.gerar-todos-box {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e1b4b 100%);
  padding: 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
  color: white;
  box-shadow: var(--shadow-xl);
  margin-bottom: 2rem;
}

.btn-gerar-todos {
  background: var(--accent);
  color: white;
  border: none;
  padding: 1rem 2.5rem;
  font-size: 1.15rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
}

.btn-gerar-todos:hover {
  background: var(--accent-light);
  transform: scale(1.02);
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: white;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-left: 4px solid var(--accent);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* MODAL DE HISTÓRICO */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 750px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  padding: 1.75rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 700;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.saved-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.saved-item:hover {
  background: #f8fafc;
}

.saved-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.saved-item-convenio {
  font-size: 0.95rem;
  color: var(--primary-dark);
}

.saved-item-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.saved-item-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-load-item {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-load-item:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.btn-delete-item {
  background: #fee2e2;
  color: #ef4444;
  border: 1px solid #fca5a5;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete-item:hover {
  background: #ef4444;
  color: white;
}

/* ========================================================= */
/* IMPRESSÃO & TEMPLATES OFICIAIS PARA PDF (PADRÃO ESTADO)  */
/* ========================================================= */
.pdf-page {
  width: 794px; /* A4 width at 96 DPI */
  min-height: 1120px; /* A4 height at 96 DPI (297mm) */
  box-sizing: border-box;
  background: white;
  padding: 35px 45px 25px 45px;
  font-family: Arial, 'Roboto', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 10.5pt;
  color: black;
  line-height: 1.4;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* TIMBRE INSTITUCIONAL NO TOPO DO PDF */
.pdf-timbre-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #1e293b;
  padding-bottom: 10px;
  margin-bottom: 22px;
  gap: 15px;
}

.pdf-timbre-logo {
  height: 52px;
  max-width: 220px;
  object-fit: contain;
}

.pdf-timbre-info {
  text-align: center;
  font-size: 7.8pt;
  color: #334155;
  line-height: 1.3;
  flex: 1;
}

.pdf-timbre-info strong {
  color: #0f172a;
  font-size: 8.5pt;
  display: block;
  margin-bottom: 2px;
}

.pdf-timbre-selo {
  height: 54px;
  max-width: 80px;
  object-fit: contain;
}

.pdf-header-title {
  text-align: center;
  font-weight: 800;
  font-size: 12.5pt;
  margin-bottom: 5px;
  text-transform: uppercase;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.pdf-header-sub {
  text-align: center;
  font-size: 11pt;
  margin-bottom: 18px;
  font-weight: 700;
  color: #334155;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 9pt;
  background-color: #ffffff;
}

.pdf-table th,
.pdf-table td {
  border: 1px solid #e2e8f0;
  padding: 6px 9px;
  vertical-align: middle;
  line-height: 1.35;
}

.pdf-table th {
  background-color: #f8fafc;
  font-weight: 700;
  font-size: 8.5pt;
  text-align: center;
  color: #1e293b;
  letter-spacing: 0.02em;
  border-bottom: 1.5px solid #94a3b8;
  border-top: 1px solid #cbd5e1;
}

.pdf-table tbody tr:nth-child(even) td {
  background-color: #fbfcfd;
}

.pdf-table tfoot tr td {
  background-color: #f8fafc !important;
  font-weight: 700;
  color: #0f172a;
  border-top: 1.5px solid #94a3b8;
  border-bottom: 1.5px solid #94a3b8;
  padding: 6px 9px;
}

/* TABELA DE METADADOS / CABEÇALHO DO CONVÊNIO */
.pdf-table-info {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
}

.pdf-table-info td {
  border: 1px solid #e2e8f0;
  padding: 6px 10px;
  font-size: 8.5pt;
  color: #334155;
  background-color: #f8fafc;
}

.pdf-table-info td strong {
  color: #0f172a;
  font-size: 8pt;
  letter-spacing: 0.02em;
}

.pdf-section-title {
  font-weight: 800;
  font-size: 9.5pt;
  margin-top: 14px;
  margin-bottom: 6px;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.pdf-signature-area {
  margin-top: 35px;
  margin-bottom: 12px;
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Bloco centralizado: selo digital no topo + identificação/cargo centralizados */
.pdf-signature-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  text-align: center;
  gap: 10px;
}

.pdf-signature-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 350px;
  max-width: 100%;
  margin: 0 auto;
  border-top: 1.5px solid #334155;
  padding-top: 8px;
  font-weight: 700;
  font-size: 9.5pt;
  color: #0f172a;
  text-align: center;
  line-height: 1.35;
}

/* Caixa de assinatura digital / Gov.br */
.pdf-signature-digital-box {
  width: 320px;
  max-width: 100%;
  margin: 0 auto;
  text-align: center;
}

.pdf-signature-digital-label {
  font-size: 7.5pt;
  font-weight: 700;
  color: #059669;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
  text-transform: uppercase;
  text-align: center;
}

.pdf-signature-digital-area {
  width: 100%;
  height: 65px;
  border: 1.5px dashed #1e3a8a;
  border-radius: 6px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8pt;
  color: #64748b;
  letter-spacing: 0.02em;
  margin: 0 auto;
  text-align: center;
}

/* ===== RODAPÉ X CAPITAL NOS PDFs ===== */
.pdf-footer-xcapital {
  margin-top: auto !important; /* Fixa o rodapé no final absoluto da página independente do volume de conteúdo */
  border-top: 1.5px solid #e2e8f0;
  padding-top: 10px;
  padding-bottom: 4px;
  background: #f8fafc;
  border-radius: 6px;
  width: 100%;
}

.pdf-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.pdf-footer-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  opacity: 0.92;
}

.pdf-footer-info {
  display: flex;
  flex-direction: column;
  font-size: 7.5pt;
  color: #475569;
  line-height: 1.5;
}

.pdf-footer-dev {
  font-size: 7pt;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pdf-footer-info strong {
  font-size: 8pt;
  color: #1e3a8a;
  font-weight: 700;
}

/* Selo de Assinatura Digital Real no PDF */
.pdf-signature-digital-signed {
  width: 100%;
  padding: 6px 12px;
  border: 1.5px solid #059669;
  border-radius: 6px;
  background: #f0fdf4;
  text-align: center;
  font-size: 7.2pt;
  color: #065f46;
  line-height: 1.35;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sig-signed-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #047857;
  font-weight: 800;
  font-size: 7.5pt;
  margin-bottom: 3px;
  border-bottom: 1px solid #a7f3d0;
  padding-bottom: 2px;
}

.sig-signed-name {
  font-weight: 700;
  color: #0f172a;
  font-size: 7.5pt;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-signed-info {
  color: #334155;
  font-size: 6.8pt;
}

.sig-signed-date {
  color: #475569;
  font-size: 6.5pt;
  margin-top: 2px;
}

.sig-signed-footer {
  font-size: 6pt;
  color: #059669;
  font-weight: 600;
  margin-top: 2px;
  text-transform: uppercase;
}

/* Card Seletor de Assinatura Digital no Passo 5 */
.card-signature-selector {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 22px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

.sig-selector-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.sig-selector-icon {
  font-size: 24px;
  background: #eff6ff;
  border-radius: 8px;
  padding: 6px 10px;
}

.sig-selector-title strong {
  display: block;
  font-size: 11pt;
  color: #1e3a8a;
}

.sig-selector-title p {
  font-size: 8.5pt;
  color: #64748b;
  margin: 0;
}

.sig-selector-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.sig-option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sig-option-label:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.sig-option-label:has(input[type="radio"]:checked) {
  border-color: #059669;
  background: #f0fdf4;
}

.sig-badge strong {
  display: block;
  font-size: 9pt;
  color: #0f172a;
}

.sig-badge span {
  font-size: 7.5pt;
  color: #64748b;
}

/* ================= RODAPÉ FIXO ================= */
.site-footer-fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--bg-gradient);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 0.55rem 2rem;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.18);
}

.footer-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.65);
}

.footer-brand { font-weight: 600; color: rgba(255,255,255,0.85); }
.footer-sep   { color: rgba(255,255,255,0.25); }
.footer-org   { color: rgba(255,255,255,0.65); }
.footer-tech  { color: rgba(167,139,250,0.85); font-size: 0.75rem; }

/* Compensa altura do rodapé fixo */
#app {
  padding-bottom: 3rem;
}

/* ================= BOTÃO IA NO HEADER ================= */
.btn-header-ai {
  background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
  border-color: #8b5cf6;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(139,92,246,0.4);
  animation: ai-pulse 2.5s ease-in-out infinite;
}
.btn-header-ai:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 100%);
  box-shadow: 0 0 20px rgba(139,92,246,0.6);
  transform: translateY(-2px);
}
@keyframes ai-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(139,92,246,0.35); }
  50%       { box-shadow: 0 0 22px rgba(139,92,246,0.65); }
}

/* ================= MODAL GEMINI / PLANO DE TRABALHO ================= */
.modal-ai {
  max-width: 660px;
  width: 95vw;
}

.ai-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
}

.ai-tab {
  flex: 1;
  padding: 0.7rem 1rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.ai-tab:hover { color: var(--primary); }
.ai-tab.active {
  color: #7c3aed;
  border-bottom-color: #7c3aed;
  font-weight: 600;
}

.ai-panel { padding: 0 0.25rem; }
.ai-hint  { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.85rem; }

/* Lista de planos */
.planos-lista {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.plano-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  cursor: pointer;
  transition: all 0.18s;
  font-size: 0.88rem;
}
.plano-item:hover {
  border-color: #7c3aed;
  background: #faf5ff;
}
.plano-item.selected {
  border-color: #7c3aed;
  background: #ede9fe;
}
.plano-item-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--text-main);
  word-break: break-word;
}
.plano-item-badge {
  font-size: 0.72rem;
  background: #ede9fe;
  color: #7c3aed;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  white-space: nowrap;
  font-weight: 600;
}
.plano-item-badge.vinculado {
  background: #d1fae5;
  color: #059669;
}

.plano-vinculado-badge {
  margin-top: 0.75rem;
  padding: 0.55rem 0.9rem;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: #065f46;
}

/* Upload zone */
.upload-drop-zone {
  border: 2px dashed #a78bfa;
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: #faf5ff;
  cursor: pointer;
  transition: all 0.2s;
  color: #7c3aed;
  font-size: 0.9rem;
}
.upload-drop-zone span { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }
.upload-drop-zone:hover { border-color: #7c3aed; background: #ede9fe; }
.upload-drop-zone.dragover { border-color: #6d28d9; background: #ddd6fe; }

.btn-upload-select {
  margin-top: 1rem;
  padding: 0.5rem 1.25rem;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-upload-select:hover { background: #6d28d9; }

/* Box de análise */
.ai-analise-box {
  border-top: 1.5px solid var(--border);
  margin-top: 1.25rem;
  padding-top: 1.25rem;
}

.ai-arquivo-selecionado {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.ai-arquivo-selecionado span {
  font-size: 0.88rem;
  font-weight: 500;
  color: #1e293b;
  background: #f1f5f9;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-analisar {
  padding: 0.55rem 1.2rem;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}
.btn-analisar:hover { background: linear-gradient(135deg, #6d28d9, #8b5cf6); }
.btn-analisar:disabled { opacity: 0.6; cursor: not-allowed; }

/* Loading spinner */
.ai-loading {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.25rem;
  background: #faf5ff;
  border-radius: var(--radius-md);
  color: #7c3aed;
  font-size: 0.9rem;
  font-weight: 500;
}
.ai-spinner {
  width: 28px; height: 28px;
  border: 3px solid #ddd6fe;
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Resultado */
.ai-resultado-header {
  font-size: 0.95rem;
  font-weight: 700;
  color: #059669;
  margin-bottom: 0.75rem;
}

.ai-campos-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 1.1rem;
  padding-right: 0.25rem;
}
.ai-campo-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
}
.ai-campo-item strong {
  display: block;
  color: #64748b;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}
.ai-campo-item span {
  color: #0f172a;
  font-weight: 500;
  word-break: break-word;
}
.ai-campo-item.full-col {
  grid-column: 1 / -1;
}

.ai-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-aplicar {
  padding: 0.6rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-aplicar:hover { background: var(--accent-dark); }

.btn-cancelar-ai {
  padding: 0.6rem 1.2rem;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-cancelar-ai:hover { background: #e2e8f0; }

/* ================= BANNERS CONTEXTUAIS DE IA NOS STEPS ================= */
.ai-context-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-lg);
  padding: 0.95rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.08);
  flex-wrap: wrap;
}

.ai-context-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 260px;
}

.ai-context-icon {
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.ai-context-left strong {
  display: block;
  color: #0369a1;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.ai-context-left p {
  font-size: 0.82rem;
  color: #475569;
  margin: 0;
  line-height: 1.35;
}

.btn-ai-context-action {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: white;
  border: none;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-ai-context-action:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
}

/* ================= BANNER CONTEXTUAL — VARIANTE EXTRATO BANCÁRIO ================= */
.banner-extrato-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfeff 100%) !important;
  border-color: #67e8f9 !important;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.1) !important;
}

.banner-extrato-card .btn-ai-context-action {
  background: linear-gradient(135deg, #0891b2 0%, #0d9488 100%) !important;
  box-shadow: 0 2px 6px rgba(8, 145, 178, 0.3) !important;
}
.banner-extrato-card .btn-ai-context-action:hover {
  background: linear-gradient(135deg, #0e7490 0%, #0f766e 100%) !important;
  box-shadow: 0 4px 10px rgba(8, 145, 178, 0.4) !important;
}

/* ================= MODAL EXTRATO BANCÁRIO / GEMINI ================= */
.modal-extrato {
  max-width: 840px !important;
  width: 95vw !important;
}

.upload-drop-zone-bank {
  border-color: #38bdf8 !important;
  background: #f0f9ff !important;
  color: #0284c7 !important;
}
.upload-drop-zone-bank:hover {
  border-color: #0284c7 !important;
  background: #e0f2fe !important;
}

.btn-upload-bank {
  background: #0284c7 !important;
}
.btn-upload-bank:hover {
  background: #0369a1 !important;
}

.btn-analisar-bank {
  background: linear-gradient(135deg, #0284c7 0%, #0d9488 100%) !important;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.3) !important;
}
.btn-analisar-bank:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0f766e 100%) !important;
}

.btn-aplicar-bank {
  background: linear-gradient(135deg, #059669 0%, #0d9488 100%) !important;
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.3) !important;
}
.btn-aplicar-bank:hover {
  background: linear-gradient(135deg, #047857 0%, #0f766e 100%) !important;
}

.ai-spinner-bank {
  border-color: #bae6fd !important;
  border-top-color: #0284c7 !important;
}

.extrato-auditoria-banner {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius-md);
  padding: 0.65rem 0.95rem;
  font-size: 0.85rem;
  color: #166534;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.extrato-contas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

.extrato-conta-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
}
.extrato-conta-card strong {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.extrato-conta-card span {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}
.extrato-conta-card small {
  display: block;
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.extrato-section-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.extrato-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.extrato-table-wrap {
  overflow-x: auto;
  max-height: 220px;
}

.extrato-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.extrato-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1.5px solid #cbd5e1;
  position: sticky;
  top: 0;
  z-index: 2;
}
.extrato-table td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}
.extrato-table tr:hover td {
  background: #f8fafc;
}

.badge-especie {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-ted { background: #e0f2fe; color: #0369a1; }
.badge-pix { background: #ccfbf1; color: #0f766e; }
.badge-transf { background: #ede9fe; color: #6d28d9; }
.badge-debito { background: #fee2e2; color: #b91c1c; }

.extrato-options-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.15rem;
}

.extrato-opt-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  font-size: 0.84rem;
  color: #334155;
}
.extrato-opt-check:last-child {
  margin-bottom: 0;
}
.extrato-opt-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: #0284c7;
  cursor: pointer;
}


/* ================= SELEÇÃO E EXCLUSÃO DE MOVIMENTAÇÕES NO EXTRATO (UX) ================= */
.extrato-dica-auditoria {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #10b981;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.9rem;
  font-size: 0.82rem;
  color: #14532d;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  line-height: 1.35;
}
.extrato-dica-auditoria .dica-icon {
  font-size: 1.15rem;
  line-height: 1;
}
.dica-btn-sample {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0 0.15rem;
}
.dica-btn-sample.excluir {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}
.dica-btn-sample.incluir {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.extrato-header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.extrato-count-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #334155;
  white-space: nowrap;
}
.btn-extrato-bulk {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-extrato-bulk:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.extrato-table th.th-action,
.extrato-table td.td-action {
  text-align: center;
  width: 95px;
  min-width: 90px;
  white-space: nowrap;
}

.btn-extrato-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-extrato-excluir {
  background: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}
.btn-extrato-excluir:hover {
  background: #ffe4e6;
  color: #9f1239;
  border-color: #fda4af;
  box-shadow: 0 1px 4px rgba(225, 29, 72, 0.15);
  transform: translateY(-1px);
}
.btn-extrato-incluir {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.btn-extrato-incluir:hover {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.15);
  transform: translateY(-1px);
}

.extrato-row-excluido {
  background-color: #f8fafc !important;
  opacity: 0.55;
}
.extrato-row-excluido td {
  color: #94a3b8 !important;
}
.extrato-row-excluido .extrato-valor {
  text-decoration: line-through !important;
  color: #94a3b8 !important;
}
.extrato-row-excluido .badge-especie {
  opacity: 0.5;
  filter: grayscale(1);
}
.badge-fora-prestacao {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.08rem 0.35rem;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* ================= DOSSIÊ CONSOLIDADO (PDF ÚNICO) ================= */
.btn-dossie-consolidado {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1rem 2.2rem;
  font-size: 1.05rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.45);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-dossie-consolidado:hover {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.6);
}

/* ================= BOTÕES DE IMPORTAÇÃO E EXPORTAÇÃO EXCEL ================= */
.btn-action-planilha {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid transparent;
}

.btn-planilha-import {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.btn-planilha-import:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.btn-planilha-export {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.btn-planilha-export:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
}

/* ================= MODAL AUDITORIA IA ================= */
.modal-auditoria {
  max-width: 860px;
  width: 95%;
  max-height: 88vh;
  overflow-y: auto;
}

.auditoria-body {
  padding: 1.25rem 0 0.5rem;
}

.auditoria-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border: 1.5px solid #e0e7ff;
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.auditoria-hero-icon {
  font-size: 2.8rem;
  line-height: 1;
}

.auditoria-hero-text h4 {
  font-size: 1.05rem;
  color: #1e1b4b;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.auditoria-hero-text p {
  font-size: 0.86rem;
  color: #475569;
  line-height: 1.45;
}

.btn-executar-auditoria {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: white;
  border: none;
  padding: 0.85rem 2rem;
  font-size: 0.98rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  transition: all 0.2s ease;
}

.btn-executar-auditoria:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
}

.auditoria-score-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.score-indicator-wrap {
  text-align: center;
  min-width: 110px;
  padding-right: 1.5rem;
  border-right: 1.5px solid #e2e8f0;
}

.score-number {
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
  color: #4f46e5;
}

.score-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
  margin-top: 0.25rem;
  letter-spacing: 0.5px;
}

.badge-status-aprovavel {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.badge-status-ressalvas {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.badge-status-reprovavel {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.auditoria-meta-text {
  font-size: 0.78rem;
  color: #64748b;
}

.auditoria-resumo-text {
  font-size: 0.88rem;
  color: #1e293b;
  margin-top: 0.45rem;
  line-height: 1.45;
}

.auditoria-section {
  margin-bottom: 1.25rem;
}

.auditoria-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.inconsistencias-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.inconsistencia-card {
  background: #f8fafc;
  border-left: 4px solid #cbd5e1;
  border-top: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.inconsistencia-card.gravidade-alta {
  border-left-color: #ef4444;
  background: #fff8f8;
}

.inconsistencia-card.gravidade-media {
  border-left-color: #f59e0b;
  background: #fffbeb;
}

.inconsistencia-card.gravidade-baixa {
  border-left-color: #3b82f6;
  background: #f0f7ff;
}

.inconsistencia-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.badge-gravidade {
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.badge-gravidade-alta { background: #fee2e2; color: #b91c1c; }
.badge-gravidade-media { background: #fef3c7; color: #b45309; }
.badge-gravidade-baixa { background: #dbeafe; color: #1d4ed8; }

.inconsistencia-campo {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}

.inconsistencia-desc {
  font-size: 0.84rem;
  color: #1e293b;
  margin-bottom: 0.35rem;
}

.inconsistencia-correcao {
  font-size: 0.8rem;
  color: #047857;
  background: rgba(16, 185, 129, 0.08);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
}

.pontos-positivos-lista {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pontos-positivos-lista li {
  font-size: 0.84rem;
  color: #065f46;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.parecer-final-card {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 0.86rem;
  color: #334155;
  line-height: 1.5;
  font-style: italic;
}

.btn-reexecutar-auditoria {
  background: #4f46e5 !important;
}