/* QuandoAcaba v2.2 — Design System Fintech Pro (Alinhamento Perfeito, Zero Textos Espremidos, Ícones SVG) */
:root {
  --bg-main: #080C14;
  --bg-card: #111827;
  --bg-card-elevated: #1A2333;
  --bg-input: #0B101B;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.15);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --emerald-400: #34D399;
  --emerald-500: #10B981;
  --emerald-600: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.12);

  --amber-400: #FBBF24;
  --amber-500: #F59E0B;
  --amber-glow: rgba(245, 158, 11, 0.12);

  --rose-400: #FB7185;
  --rose-500: #F43F5E;
  --rose-glow: rgba(244, 63, 94, 0.12);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-card: 0 8px 24px -6px rgba(0, 0, 0, 0.55);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 16px 104px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Header */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--border-subtle);
}

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

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-title span {
  color: var(--emerald-400);
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-toggle, .license-pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.license-pill-btn.pro {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--emerald-400);
}

.license-pill-btn.demo {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(251, 191, 36, 0.35);
  color: var(--amber-400);
}

/* Top Control Bar (Base Month + Privacy) */
.control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 13px;
}

.privacy-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.privacy-status strong {
  color: var(--emerald-400);
  font-weight: 700;
}

.base-month-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-input);
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.base-month-picker input,
.base-month-picker select {
  background: var(--bg-input);
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.base-month-picker select option {
  background: #111827;
  color: #F9FAFB;
}

/* Guided Demo Banner (1-Tap Clear & Start) */
.guided-onboarding-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14) 0%, rgba(17, 24, 39, 0.95) 100%);
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: var(--radius-md);
  padding: 11px 14px;
}

.guided-onboarding-text {
  font-size: 0.78rem;
  color: #D1FAE5;
  line-height: 1.35;
}

.guided-onboarding-text strong {
  color: #FFFFFF;
}

.guided-onboarding-btn {
  background: var(--emerald-400);
  color: #032219;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Filter chips for credit cards — Clean Wrapped Pills (Never clipped!) */
.card-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-chip.active {
  background: var(--bg-card-elevated);
  color: var(--text-primary);
  border-color: rgba(52, 211, 153, 0.45);
}

.card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Scope & PDF Summary Banner (100% Centered & Balanced) */
.pdf-breakdown-banner {
  background: linear-gradient(135deg, #131D31 0%, #0D1424 100%);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.pdf-breakdown-title {
  font-size: 0.81rem;
  font-weight: 800;
  color: #93C5FD;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-align: center;
}

.pdf-breakdown-note {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.42;
  text-align: center;
  max-width: 96%;
}

.pdf-breakdown-note strong {
  color: var(--emerald-400);
}

/* HERO RELIEF PANEL — Clean 1 Top Full-Width Card + 2 Wide Bottom Cards (NEVER CRAMPED!) */
.hero-relief-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
}

.kpi-card.Snowball {
  grid-column: 1 / -1; /* Full width on top! */
  background: linear-gradient(135deg, #161F33 0%, #0F172A 100%);
  border-left: 4px solid var(--rose-400);
}

.kpi-card.Breath {
  border-left: 4px solid var(--amber-400);
}

.kpi-card.Freedom {
  border-left: 4px solid var(--emerald-400);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 700;
  line-height: 1.25;
}

.kpi-icon-box {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.kpi-card.Snowball .kpi-value {
  font-size: 1.75rem;
}

.kpi-value {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kpi-card.Freedom .kpi-value {
  color: var(--emerald-400);
}

.kpi-card.Breath .kpi-value {
  color: var(--amber-400);
}

.kpi-subtext {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 5px;
  line-height: 1.35;
}

/* Main Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 8px;
}

.section-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Timeline Bar Chart */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-row {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
}

.timeline-row.highlight-drop {
  border-color: rgba(52, 211, 153, 0.45);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-input) 100%);
}

.timeline-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
  gap: 8px;
}

.timeline-month {
  font-weight: 700;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.drop-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.16);
  color: var(--emerald-400);
}

.timeline-amount {
  font-weight: 800;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline-bar-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.timeline-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--emerald-500), var(--amber-400));
  transition: width 0.3s ease;
}

.timeline-ending-items {
  margin-top: 7px;
  font-size: 0.73rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.timeline-ending-items strong {
  color: var(--emerald-400);
  font-weight: 600;
}

/* Blurred Vitrine Effect on Top KPI Cards & Rows */
.blurred-value {
  filter: blur(8px);
  -webkit-filter: blur(8px);
  user-select: none;
  pointer-events: none;
}

.kpi-locked-overlay {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 5px 10px;
  border-radius: 7px;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: var(--amber-400);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

/* Blurred Lock for 4th+ Month when in Free Preview */
.blurred-row {
  filter: blur(6px);
  -webkit-filter: blur(6px);
  opacity: 0.55;
  user-select: none;
  pointer-events: none;
}

.paywall-blur-wall {
  margin-top: 6px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #162033 0%, #0E1525 100%);
  border: 1px solid rgba(52, 211, 153, 0.4);
  text-align: center;
}

.paywall-blur-wall h4 {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.paywall-blur-wall p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* PDF Local Dropzone (100% Client-Side RAM Extraction) */
.pdf-upload-box {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(17, 24, 39, 0.9) 100%);
  border: 1.5px dashed rgba(59, 130, 246, 0.45);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  margin-bottom: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.pdf-upload-box:hover {
  border-color: var(--emerald-400);
  background: rgba(16, 185, 129, 0.08);
}

.pdf-upload-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 4px;
}

.pdf-upload-sub {
  font-size: 0.73rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.pdf-security-note {
  margin-top: 6px;
  font-size: 0.69rem;
  color: var(--emerald-400);
  font-weight: 600;
}

/* Input Tabs & Forms */
.input-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  border: 1px solid var(--border-subtle);
}

.mode-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 9px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 7px;
  cursor: pointer;
}

.mode-tab.active {
  background: var(--bg-card-elevated);
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-field, .textarea-field, .select-field {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.textarea-field {
  min-height: 120px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
}

.input-field:focus, .textarea-field:focus, .select-field:focus {
  border-color: var(--emerald-400);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.99);
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald-400) 0%, var(--emerald-600) 100%);
  color: #032219;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
}

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

.btn-danger-outline {
  background: rgba(244, 63, 94, 0.1);
  color: var(--rose-400);
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.helper-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--emerald-400);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

/* Installment Items List */
.items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.installment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  gap: 10px;
}

.item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.item-card-badge {
  width: 6px;
  height: 32px;
  border-radius: 4px;
  flex-shrink: 0;
}

.item-info {
  min-width: 0;
}

.item-title {
  font-weight: 700;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  font-size: 0.73rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.parcel-pill {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.item-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-align: right;
}

.item-amount {
  font-weight: 800;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.item-remaining-total {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.delete-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.delete-btn:hover {
  color: var(--rose-400);
  border-color: rgba(244, 63, 94, 0.3);
}

/* Simulator Verdict Box */
.verdict-box {
  margin-top: 14px;
  padding: 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.verdict-box.safe {
  background: var(--emerald-glow);
  border-color: rgba(52, 211, 153, 0.4);
}

.verdict-box.warning {
  background: var(--amber-glow);
  border-color: rgba(251, 191, 36, 0.4);
}

.verdict-box.danger {
  background: var(--rose-glow);
  border-color: rgba(251, 113, 133, 0.45);
}

.verdict-title {
  font-size: 0.96rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.verdict-desc {
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.verdict-recommendation {
  font-size: 0.78rem;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: #E2E8F0;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 300;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  max-width: 420px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-badge {
  display: inline-flex;
  align-self: flex-start;
  background: rgba(16, 185, 129, 0.14);
  color: var(--emerald-400);
  border: 1px solid rgba(52, 211, 153, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
}

.modal-title {
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.25;
}

.modal-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.modal-divider {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Bottom Navigation Bar with crisp SVG icons */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(11, 16, 27, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
}

.bottom-nav-inner {
  max-width: 500px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px));
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px 4px;
  font-size: 0.69rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.nav-item.active {
  color: var(--emerald-400);
}

.view-section {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.view-section.active {
  display: flex;
}

.empty-state {
  text-align: center;
  padding: 24px 14px;
  color: var(--text-secondary);
}

.empty-state h3 {
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.8rem;
  margin-bottom: 14px;
}

.legal-box {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legal-box h4 {
  color: var(--text-primary);
  font-size: 0.83rem;
  margin-top: 4px;
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #065F46;
  color: #ECFDF5;
  border: 1px solid var(--emerald-400);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 400;
  text-align: center;
  max-width: 90vw;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 390px) {
  .hero-relief-grid {
    grid-template-columns: 1fr;
  }
}
