/* ===== RESET E BASE ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.85)),
    url('/assets/bg-consulta.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: #1a1a1a;
}

/* ===== TOPBAR ===== */
.topbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 2px solid #e0e0e0;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo-slot { height: 44px; display: flex; align-items: center; }
.logo-slot img { max-height: 44px; width: auto; }

.brand-text {
  border-left: 1px solid #ccc;
  padding-left: 14px;
}
.brand-text strong {
  display: block;
  font-size: 18px;
  color: #0d3b7a;
}
.brand-text small {
  font-size: 13px;
  color: #5a5a5a;
}

.user-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-header .user-meta { text-align: right; }
.user-header .user-meta strong { display: block; font-size: 14px; }
.user-header .user-meta small { color: #5a5a5a; font-size: 13px; }
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #1a5fb4;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
}

.hidden { display: none !important; }

/* ===== SCREENS ===== */
.screen {
  display: none;
  padding: 20px 16px 40px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
  min-height: 100vh;
}
.screen.active { display: block; }

/* ===== BREADCRUMB ===== */
.breadcrumb {
  font-size: 13px;
  color: #5a5a5a;
  margin-bottom: 18px;
  padding: 8px 0;
  border-bottom: 1px solid #e0e0e0;
}
.breadcrumb span { color: #0d3b7a; font-weight: 600; }

/* ===== TELA 1: CONSULTA ===== */
.consult-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  padding: 24px 24px 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  border: 1px solid rgba(255,255,255,0.3);
  max-width: 440px;
  margin: 0 auto;
}
.consult-card h1 {
  font-size: 22px;
  margin-bottom: 4px;
  color: #0d3b7a;
}
.consult-card .sub {
  color: #5a5a5a;
  margin-bottom: 20px;
  font-size: 14px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}
.form-group input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
  transition: border 0.2s;
}
.form-group input[type="text"]:focus {
  border-color: #1a5fb4;
  outline: none;
  box-shadow: 0 0 0 3px rgba(26,95,180,0.15);
}

.btn-primary {
  background: #1a5fb4;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}
.btn-primary:hover { background: #0d3b7a; }

.error { color: #c62828; font-size: 13px; margin-top: 10px; }
.terms {
  border-top: 1px solid #e0e0e0;
  padding: 14px 0 0;
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: #5a5a5a;
}

/* ===== STEPS ===== */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px auto 0;
  max-width: 440px;
}
.step {
  background: rgba(255,255,255,0.8);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  backdrop-filter: blur(4px);
}
.step b { display: block; color: #0d3b7a; font-size: 12px; }
.step span { display: block; color: #5a5a5a; font-size: 11px; }
.step.active { border-color: #1a5fb4; background: rgba(26,95,180,0.08); }
.step.muted { opacity: 0.6; }
.steps.compact { max-width: 360px; }

/* ===== SECURITY NOTE ===== */
.security-note {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 440px;
  margin: 14px auto 0;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(4px);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12px;
  color: #0d3b7a;
  border: 1px solid rgba(26,95,180,0.15);
}
.security-note svg {
  flex-shrink: 0;
  color: #1a5fb4;
}

/* ===== TELA 2: LOADING ===== */
.loading-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  padding: 24px;
  max-width: 440px;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.loading-card .loading-header { margin-bottom: 16px; }
.loading-card .loading-header h1 { font-size: 20px; color: #0d3b7a; }
.loading-card .loading-header p { color: #5a5a5a; font-size: 14px; }

.loading-body { text-align: center; }
.spinner {
  width: 48px; height: 48px;
  border: 4px solid #e0e0e0;
  border-top: 4px solid #1a5fb4;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-body h2 { font-size: 16px; margin-bottom: 4px; }
.loading-body p { color: #5a5a5a; font-size: 14px; }
.divider { height: 1px; background: #e0e0e0; margin: 16px 0 12px; }
.secure-dot { color: #1a5fb4; font-size: 13px; }

/* ===== TELA 3: RESULTADO ===== */
.result-wrap { max-width: 820px; margin: 0 auto; }

.infraction-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  border: 1px solid rgba(255,255,255,0.3);
}
.infraction-card .header-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e0e0e0;
}
.infraction-card .header-row .label {
  font-size: 11px;
  font-weight: 700;
  color: #5a5a5a;
  text-transform: uppercase;
}
.infraction-card .header-row .value {
  font-size: 14px;
  font-weight: 600;
}
.infraction-card .details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  padding: 14px 0;
  border-bottom: 1px solid #e0e0e0;
}
.infraction-card .details-grid .item .label {
  font-size: 11px;
  font-weight: 700;
  color: #5a5a5a;
  text-transform: uppercase;
  display: block;
}
.infraction-card .details-grid .item .value {
  font-size: 14px;
  font-weight: 600;
}

.infraction-card .value-total {
  background: #e8f0fe;
  padding: 14px;
  text-align: center;
  border-radius: 8px;
  margin: 14px 0;
}
.infraction-card .value-total span {
  font-size: 13px;
  color: #0d3b7a;
  font-weight: 700;
  text-transform: uppercase;
  display: block;
}
.infraction-card .value-total strong {
  font-size: 26px;
  color: #2e7d32;
}

.infraction-card .warning-box {
  background: #fff3e0;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  border-left: 4px solid #e65100;
}
.infraction-card .warning-box b { display: block; color: #e65100; font-size: 14px; }
.infraction-card .warning-box ul { margin: 4px 0 0 18px; color: #bf360c; font-size: 13px; }

.btn-pay {
  background: #1a5fb4;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}
.btn-pay:hover { background: #0d3b7a; }

.infraction-card .doc-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #5a5a5a;
}
.infraction-card .doc-footer strong { color: #0d3b7a; }

/* ===== TELA 4: PAYMENT LOADING ===== */
.payment-loading-wrap {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}
.big-loader {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: conic-gradient(#1a5fb4 0 70deg, rgba(26,95,180,0.2) 70deg 360deg);
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}
.big-loader span {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #fff;
  display: block;
}
.payment-loading-wrap h1 { font-size: 26px; color: #0d3b7a; }
.payment-loading-wrap > p { color: #5a5a5a; font-size: 17px; }
.payment-loading-wrap > small { display: block; color: #888; margin: 4px 0 18px; }

.progress-line {
  height: 5px;
  background: #e0e0e0;
  border-radius: 999px;
  overflow: hidden;
  max-width: 300px;
  margin: 0 auto 20px;
}
.progress-line span {
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, #1a5fb4, #4c8bf5);
  animation: progressMove 1.2s ease-in-out infinite;
}
@keyframes progressMove {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(300%); }
}

.payment-loading-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.payment-loading-grid .pl-item {
  background: rgba(255,255,255,0.9);
  border-radius: 10px;
  padding: 18px 12px;
  border: 1px solid #eee;
}
.pl-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
  margin: 0 auto 10px;
}
.pl-icon.blue { background: #dbeafe; color: #1a5fb4; }
.pl-icon.purple { background: #ede7f6; color: #6a1b9a; }
.pl-icon.green { background: #e8f5e9; color: #2e7d32; }
.payment-loading-grid .pl-item h3 { font-size: 15px; }
.payment-loading-grid .pl-item p { color: #5a5a5a; font-size: 12px; }

.payment-loading-safe {
  background: rgba(255,255,255,0.85);
  border-radius: 10px;
  padding: 18px 20px;
  text-align: left;
}
.payment-loading-safe b { display: block; color: #0d3b7a; font-size: 17px; margin-bottom: 6px; }
.payment-loading-safe span { color: #5a5a5a; font-size: 14px; line-height: 1.5; }

/* ===== TELA 5: PAYWALL ===== */
.paywall-details {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.paywall-header h1 {
  font-size: 20px;
  color: #0d3b7a;
  margin-bottom: 14px;
}

.paywall-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid #e0e0e0;
}
.paywall-info-grid div .label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #5a5a5a;
  text-transform: uppercase;
}
.paywall-info-grid div b {
  font-size: 13px;
  font-weight: 600;
}

.paywall-values {
  padding: 12px 0;
  border-bottom: 1px solid #e0e0e0;
}
.paywall-values .value-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 13px;
}
.paywall-values .value-row.total {
  border-top: 1px solid #e0e0e0;
  padding-top: 6px;
  margin-top: 4px;
  font-weight: 700;
}

.paywall-total-pix {
  background: #e8f0fe;
  padding: 14px;
  text-align: center;
  border-radius: 8px;
  margin: 14px 0;
}
.paywall-total-pix span {
  font-size: 12px;
  color: #0d3b7a;
  font-weight: 700;
  text-transform: uppercase;
  display: block;
}
.paywall-total-pix strong {
  font-size: 26px;
  color: #2e7d32;
}

.paywall-warning {
  background: #fff3e0;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  border-left: 4px solid #e65100;
}
.paywall-warning b { display: block; color: #e65100; font-size: 14px; }
.paywall-warning ul { margin: 4px 0 0 18px; color: #bf360c; font-size: 13px; }

.paywall-doc {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #5a5a5a;
}
.paywall-doc strong { color: #0d3b7a; }

/* ===== PIX SECTION ===== */
.pix-section { margin-top: 18px; }

.payment-timer-bar {
  background: #c62828;
  color: #fff;
  padding: 8px 14px;
  text-align: center;
  border-radius: 8px;
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 14px;
}

.pix-summary {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 12px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.pix-summary div span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #5a5a5a;
  text-transform: uppercase;
}
.pix-summary div b {
  font-size: 13px;
  font-weight: 600;
}
.status-pill.pending { color: #f07920; }
.status-pill.paid { color: #2e7d32; }
.status-pill.expired { color: #c62828; }

.pix-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.pix-card h1 { font-size: 20px; color: #0d3b7a; }
.pix-card > p { color: #5a5a5a; margin-bottom: 14px; font-size: 14px; }

.qr-frame {
  width: 170px; height: 170px;
  border: 1px solid #ddd;
  border-radius: 8px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  background: #f5f5f5;
}
.qr-frame img { width: 100%; height: 100%; object-fit: contain; }

.pix-card label {
  display: block;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #5a5a5a;
  text-transform: uppercase;
  max-width: 380px;
  margin: 0 auto 4px;
}
.pix-copy-row {
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 6px;
  max-width: 380px;
  margin: 0 auto 12px;
}
.pix-copy-row input {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: monospace;
  font-size: 11px;
  background: #f9f9f9;
}
.pix-copy-row button {
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f9f9f9;
  cursor: pointer;
  font-size: 16px;
}

.howto {
  max-width: 380px;
  margin: 0 auto 14px;
  text-align: left;
  border: 1px solid #f4c85f;
  background: #fff9e7;
  border-radius: 7px;
  padding: 10px 14px;
  color: #b14e10;
}
.howto b { display: block; margin-bottom: 4px; font-size: 13px; }
.howto ol { margin: 0; padding-left: 20px; font-size: 12px; line-height: 1.4; }

.pay-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 380px;
  margin: 0 auto 10px;
}
.pay-actions button {
  border: none;
  border-radius: 6px;
  padding: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
}
.pay-actions .primary { background: #1a5fb4; color: #fff; }
.pay-actions .secondary { background: #e0e0e0; color: #333; }
.pay-actions .primary:hover { background: #0d3b7a; }
.pay-actions .secondary:hover { background: #ccc; }

.payment-feedback { color: #5a5a5a; font-size: 12px; margin-top: 4px; }

/* ===== RESPONSIVO ===== */
@media (max-width: 700px) {
  .paywall-info-grid, .pix-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 8px;
  }
  .infraction-card .header-row {
    grid-template-columns: 1fr 1fr;
  }
  .infraction-card .details-grid {
    grid-template-columns: 1fr;
  }
  .payment-loading-grid {
    grid-template-columns: 1fr;
  }
  .pay-actions {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .brand-text strong { font-size: 15px; }
  .brand-text small { font-size: 11px; }
  .logo-slot { height: 32px; }
  .logo-slot img { max-height: 32px; }
  .consult-card h1 { font-size: 20px; }
}

@media (max-width: 480px) {
  .paywall-info-grid, .pix-summary {
    grid-template-columns: 1fr 1fr;
  }
  .infraction-card .header-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .steps {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .steps.compact {
    grid-template-columns: repeat(3, 1fr);
  }
}