/* ==========================================================================
   DESIGN SYSTEM - CORRIDA VIP (PWA EXECUTIVO)
   Estilo Premium / Fintech | Clean | Mobile-First | WCAG 2.1 AA Compliant
   ========================================================================== */

:root {
  /* Tema Modern Minimal (21st.dev / shadcn) - claro */
  --bg-app: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-surface-subtle: #f9fafb;
  --border-color: #e5e7eb;
  --border-focus: #3b82f6;

  --text-main: #333333;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --text-inverse: #ffffff;

  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-accent-bg: #e0f2fe;
  --color-accent-text: #1e3a8a;

  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-success-text: #065f46;

  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-warning-text: #92400e;

  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;
  --color-danger-text: #991b1b;

  --color-whatsapp: #25d366;
  --color-whatsapp-hover: #1ebd5a;

  /* Sombras Sutis */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.02);
  --shadow-selected: 0 0 0 2px #10b981, 0 8px 20px -4px rgba(16, 185, 129, 0.18);

  /* Dimensões */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-full: 9999px;
  --touch-target: 48px;

  /* Transições */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

[data-theme="dark"] {
  /* Modern Minimal - escuro */
  --bg-app: #171717;
  --bg-surface: #262626;
  --bg-surface-elevated: #262626;
  --bg-surface-subtle: #1f1f1f;
  --border-color: #404040;
  --border-focus: #3b82f6;

  --text-main: #e5e5e5;
  --text-muted: #a3a3a3;
  --text-subtle: #737373;
  --text-inverse: #ffffff;

  --color-primary: #3b82f6;
  --color-primary-hover: #60a5fa;
  --color-accent-bg: #1e3a8a;
  --color-accent-text: #bfdbfe;

  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-success-text: #34d399;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.6);
  --shadow-selected: 0 0 0 2px #10b981, 0 8px 24px -4px rgba(16, 185, 129, 0.25);
}

/* RESET E BASE */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* ÍCONES SVG VETORIAIS */
.icon-svg {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon-svg-sm {
  width: 1rem;
  height: 1rem;
}

.icon-svg-lg {
  width: 1.5rem;
  height: 1.5rem;
}

/* CABEÇALHO */
.app-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-icon-wrap {
  width: 38px;
  height: 38px;
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
  margin-top: -2px;
}

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

/* BOTÕES DE CABEÇALHO */
.btn-install-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success);
  border-radius: var(--radius-full);
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  transition: all var(--transition-fast);
}

.btn-install-pill:hover {
  background-color: var(--color-success);
  color: #ffffff;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background-color: var(--bg-surface-subtle);
  border-color: var(--text-subtle);
}

/* LAYOUT PRINCIPAL */
.app-main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

.app-layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 860px) {
  .app-layout-grid {
    grid-template-columns: 380px 1fr;
    align-items: start;
    gap: 2rem;
  }
}

/* CARD DO SIMULADOR (COLUNA ESQUERDA) */
.simulator-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

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

.simulator-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.btn-text-sm {
  background: none;
  border: none;
  color: var(--text-subtle);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.btn-text-sm:hover {
  color: var(--text-main);
  background-color: var(--bg-surface-subtle);
}

/* PRESETS / ATALHOS */
.presets-section {
  margin-bottom: 1.25rem;
}

.section-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  margin-bottom: 0.5rem;
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.preset-chip {
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.4rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-main);
}

.preset-chip:hover {
  border-color: var(--color-success);
  background-color: var(--color-success-bg);
}

.preset-chip-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
}

.preset-chip-meta {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* INPUTS NUMÉRICOS */
.inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

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

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.input-with-badge {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  min-height: var(--touch-target);
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 2.5rem 0.65rem 0.85rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus {
  border-color: var(--border-focus);
}

.input-suffix {
  position: absolute;
  right: 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-subtle);
  pointer-events: none;
}

.quick-buttons-group {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.btn-increment {
  flex: 1;
  min-height: 32px;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-increment:hover {
  background-color: var(--border-color);
  color: var(--text-main);
}

/* ROTAS OPCIONAIS */
.optional-routes-details {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
}

.routes-summary {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.routes-fields {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.form-input-text {
  width: 100%;
  min-height: 42px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
}

.form-input-text:focus {
  border-color: var(--border-focus);
}

/* SEÇÃO DE RESULTADOS (COLUNA DIREITA) */
.results-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* RESUMO OPERACIONAL LIMPO (BARRA SUPERIOR) */
.quick-summary-bar {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.summary-cost-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.summary-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.summary-cost-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-summary-action {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.btn-summary-action:hover {
  background-color: var(--bg-surface-subtle);
  border-color: var(--text-subtle);
}

/* CARTÕES DE TARIFA INTERATIVOS E CLICÁVEIS */
.cards-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 680px) {
  .cards-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tier-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.tier-card:hover {
  transform: translateY(-2px);
  border-color: var(--text-subtle);
  box-shadow: var(--shadow-md);
}

/* SELEÇÃO ATIVA DO CARD */
.tier-card.is-selected {
  border: 2px solid var(--color-success) !important;
  box-shadow: var(--shadow-selected);
  background-color: var(--bg-surface);
}

.tier-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.tier-identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tier-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.tier-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.tier-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
}

.badge-subtle {
  background-color: var(--bg-surface-subtle);
  color: var(--text-muted);
}

.badge-primary {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

/* VALOR EM DESTAQUE NOBRE */
.tier-price-box {
  margin: 0.4rem 0 0.85rem;
  text-align: center;
}

.tier-price-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.tier-price-value {
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.1;
}

/* LINHA ÚNICA LIMPA DE MÉTRICAS */
.tier-clean-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.tier-stat-highlight {
  font-weight: 700;
  color: var(--color-success);
}

/* BOTÕES DE AÇÃO DOS CARTÕES */
.tier-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 42px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  padding: 0 0.75rem;
  border: none;
}

.btn-secondary {
  background-color: var(--bg-surface-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-whatsapp {
  background-color: var(--color-whatsapp);
  color: #ffffff;
}

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

/* FAIXA MINIMALISTA VANTAGEM PARTICULAR */
.platform-comparison-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.comparison-lead {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.comparison-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--color-success-bg);
  color: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.comparison-gain {
  font-weight: 700;
  color: var(--color-success);
}

.btn-outline-sm {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-outline-sm:hover {
  background-color: var(--bg-surface-subtle);
}

/* MODAIS ACESSÍVEIS */
.modal-container {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

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

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-body {
  padding: 1.25rem;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* TABELA DE RAIO-X */
.breakdown-table {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-subtle);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breakdown-row strong {
  color: var(--text-main);
}

.breakdown-row.highlight-total {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
  font-weight: 700;
  margin-top: 0.5rem;
}

.breakdown-formula-box {
  margin-top: 1rem;
  padding: 0.75rem;
  background-color: var(--bg-surface-elevated);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* CONFIGURAÇÕES FORM */
.settings-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  margin: 1rem 0 0.5rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.settings-input, .select-custom {
  width: 100%;
  min-height: 42px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
}

.settings-input:focus, .select-custom:focus {
  border-color: var(--border-focus);
}

/* TOASTS */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-item {
  background-color: var(--text-main);
  color: var(--bg-surface);
  border-radius: var(--radius-full);
  padding: 0.65rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  animation: toastFade 0.25s ease;
}

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

/* RODAPÉ DISCRETO */
.app-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.78rem;
  color: var(--text-subtle);
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-surface);
}

.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;
}

/* PAYWALL GATE OVERLAY */
.paywall-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(9, 13, 22, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.paywall-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: 20px;
  max-width: 440px;
  width: 100%;
  padding: 2.2rem 1.8rem;
  text-align: center;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6);
}
.paywall-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-success) 15%, transparent);
  color: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 1.25rem;
}
.paywall-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.6rem;
  letter-spacing: -0.025em;
}
.paywall-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1.5rem;
}
.paywall-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.paywall-unlock-box {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-subtle);
}
.paywall-unlock-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.paywall-input {
  flex: 1;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  color: var(--text-main);
  text-transform: uppercase;
}

