:root {
  --primary-blue: #1e5bbf;
  --header-blue: #2563eb;
  --dark-blue: #0f3a8a;
  --card-dark-blue: #123e96;
  --bg-light: #f3f5f9;
  --card-bg: #ffffff;
  --text-dark: #111827;
  --text-muted: #6b7280;
  --success: #10b981;
  --warning: #f59e0b;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-family);
  background-color: var(--bg-light);
  color: var(--text-dark);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===================================================
   1. TELA DE LOGIN CORPORATIVO
=================================================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 20px;
  background: linear-gradient(145deg, #091a3e 0%, #0f3a8a 60%, #1e5bbf 100%);
  position: relative;
  overflow: hidden;
}

.login-backdrop-glow {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(0, 210, 255, 0.25) 0%, rgba(30, 91, 191, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border-radius: 28px;
  padding: 36px 26px 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 10;
  text-align: center;
  animation: fadeInCard 0.4s ease-out;
}

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

.login-brand-header {
  margin-bottom: 20px;
}

.logo-box {
  width: 220px;
  height: 68px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1e5bbf 0%, #0f3a8a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  padding: 12px 20px;
  box-shadow: 0 8px 24px rgba(15, 58, 138, 0.28);
}

.logo-box img {
  width: 175px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.app-brand-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #0f172a;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.app-brand-badge {
  display: inline-block;
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.login-security-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.login-form {
  text-align: left;
}

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

.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

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

.input-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  font-size: 0.98rem;
  outline: none;
  background: #f8fafc;
  color: #0f172a;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary-blue);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(30, 91, 191, 0.12);
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-password:hover {
  color: #475569;
}

.btn-auth {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, #1e5bbf 0%, #0f3a8a 100%);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 58, 138, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-auth:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(15, 58, 138, 0.2);
}

.btn-auth:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-footer {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary-blue);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-notice-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
}

.login-notice-box svg {
  color: #64748b;
  flex-shrink: 0;
  margin-top: 2px;
}

.login-notice-box p {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.4;
  margin: 0;
}

/* ===================================================
   2. DASHBOARD (IDÊNTICO À IMAGEM FLUTTER)
=================================================== */
.app-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-light);
  position: relative;
}

/* Header Azul Royal */
.app-header {
  background: var(--header-blue);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.app-header-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

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

.icon-btn {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.15s;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

/* Corpo Rolável */
.app-content-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 95px; /* Espaço para o bottom nav + FAB */
}

/* Card Azul de Saldo Geral */
.balance-card {
  margin: 16px 16px 8px;
  padding: 22px 18px 20px;
  background: #1754be;
  border-radius: 20px;
  color: #ffffff;
  text-align: center;
  box-shadow: 0 10px 24px rgba(23, 84, 190, 0.3);
}

.balance-title {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 400;
  margin-bottom: 4px;
}

.balance-amount {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 18px;
}

.sub-balances-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sub-balance-box {
  padding: 12px 14px;
  border-radius: 14px;
  text-align: left;
}

.box-pendente {
  background: rgba(255, 255, 255, 0.18);
}

.box-aprovado {
  background: #0f3a8a;
}

.sub-box-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  margin-bottom: 4px;
}

.sub-box-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

/* Banner de Registrar Comprovante */
.action-banner {
  text-align: center;
  padding: 18px 16px 14px;
}

.action-banner-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: #111827;
}

.action-banner-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Seção Inferior com Sheet Branca */
.records-sheet {
  background: #ffffff;
  border-radius: 26px 26px 0 0;
  padding: 22px 20px 40px;
  box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.03);
  flex: 1;
}

.records-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.records-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #111827;
}

.btn-refresh {
  background: none;
  border: none;
  color: var(--header-blue);
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 48px 16px;
}

/* Lista de Despesas */
.expenses-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.expense-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  transition: transform 0.1s;
}

.expense-info h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 3px;
}

.expense-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.expense-right {
  text-align: right;
}

.expense-amount {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.badge-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pendente {
  background: #fef3c7;
  color: #d97706;
}

.status-aprovado {
  background: #d1fae5;
  color: #059669;
}

/* ===================================================
   3. BOTTOM NAVIGATION & FLOATING ACTION BUTTON (FAB)
=================================================== */
.floating-camera-btn {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #0f3a8a;
  color: #ffffff;
  border: none;
  box-shadow: 0 6px 16px rgba(15, 58, 138, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s;
}

.floating-camera-btn svg {
  width: 28px;
  height: 28px;
}

.floating-camera-btn:active {
  transform: translateX(-50%) scale(0.92);
  background: #09255a;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  padding-bottom: var(--safe-bottom);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid #e5e7eb;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 0.72rem;
  font-weight: 500;
  gap: 3px;
  cursor: pointer;
  flex: 1;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-item.active {
  color: var(--header-blue);
  font-weight: 700;
}

.nav-spacer {
  width: 60px;
  flex-shrink: 0;
}

/* ===================================================
   4. MODAIS E BOTTOM SHEETS
=================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeInModal 0.2s ease;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-sheet {
  background: #ffffff;
  width: 100%;
  max-width: 480px;
  border-radius: 26px 26px 0 0;
  padding: 24px 22px calc(24px + var(--safe-bottom));
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
  animation: slideUpSheet 0.25s ease-out;
}

@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Centralização do Modal em Telas Maiores (Desktop e Tablet) */
@media (min-width: 600px) {
  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 24px;
  }

  .modal-sheet {
    border-radius: 28px !important;
    padding: 30px 28px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
    animation: zoomInModal 0.22s ease-out;
  }

  @keyframes zoomInModal {
    from {
      opacity: 0;
      transform: scale(0.92);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }
}

/* ===================================================
   ADAPTAÇÃO RESPONSIVA PARA COMPUTADOR / DESKTOP (>= 768px)
=================================================== */
.fab-text {
  display: none;
}

.btn-banner-upload {
  display: none;
}

@media (min-width: 768px) {
  .app-screen {
    width: 100%;
    max-width: 100%;
    margin: 0;
    min-height: 100vh;
    background-color: #f1f5f9;
    border: none;
    box-shadow: none;
  }

  /* Header Superior no Desktop */
  .app-header {
    padding: 16px 32px;
    box-shadow: 0 2px 10px rgba(15, 58, 138, 0.1);
  }

  .app-header .header-container {
    max-width: 1120px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  /* Conteúdo Centralizado e com Margens Confortáveis */
  .app-content-body {
    max-width: 1120px;
    margin: 0 auto;
    width: 100%;
    padding: 28px 24px 60px 24px;
  }

  /* Card de Saldo no Formato Dashboard Executivo */
  .balance-card {
    margin: 0 0 24px 0;
    padding: 30px 36px;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    background: linear-gradient(135deg, #1754be 0%, #0f3a8a 100%);
    box-shadow: 0 12px 30px rgba(15, 58, 138, 0.2);
  }

  .balance-amount {
    font-size: 2.8rem;
    margin-bottom: 0;
  }

  .sub-balances-grid {
    display: flex;
    gap: 16px;
    min-width: 380px;
  }

  .sub-balance-box {
    flex: 1;
    padding: 16px 20px;
    border-radius: 14px;
  }

  .sub-box-value {
    font-size: 1.35rem;
  }

  /* Banner de Ação para Novo Comprovante no Desktop */
  .action-banner {
    background: #ffffff;
    border: 1.5px dashed #cbd5e1;
    border-radius: 16px;
    padding: 20px 28px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  }

  .action-banner:hover {
    border-color: var(--primary-blue);
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(30, 91, 191, 0.08);
  }

  .action-banner-title {
    font-size: 1.15rem;
  }

  .btn-banner-upload {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--header-blue);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.92rem;
    padding: 12px 22px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .btn-banner-upload:hover {
    background: var(--dark-blue);
  }

  /* Seção de Lançamentos em Formato Card Branco Moderno */
  .records-sheet {
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    padding: 28px 32px 36px;
    flex: initial;
    border: 1px solid #e2e8f0;
  }

  .expense-item {
    padding: 18px 22px;
    border-radius: 14px;
    transition: all 0.15s ease;
  }

  .expense-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateX(4px);
  }

  .expense-info h4 {
    font-size: 1.05rem;
  }

  .expense-amount {
    font-size: 1.2rem;
  }

  /* No Desktop: oculta a barra inferior mobile e adapta o botão de ação */
  .bottom-nav {
    display: none !important;
  }

  .floating-camera-btn {
    left: auto;
    right: 36px;
    bottom: 36px;
    transform: none;
    width: auto;
    height: 52px;
    padding: 0 24px 0 20px;
    border-radius: 999px;
    gap: 10px;
    font-weight: 700;
    font-size: 0.94rem;
    box-shadow: 0 10px 25px rgba(15, 58, 138, 0.35);
  }

  .floating-camera-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(15, 58, 138, 0.45);
  }

  .floating-camera-btn .fab-text {
    display: inline-block;
  }
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.sheet-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
}

.sheet-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
}

.sheet-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 18px;
}

.preview-area {
  text-align: center;
  margin-bottom: 16px;
}

#expense-image-preview {
  max-height: 140px;
  max-width: 100%;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ocr-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 8px;
}

.spinner-dot {
  width: 8px;
  height: 8px;
  background: #0284c7;
  border-radius: 50%;
  animation: pulseDot 1s infinite alternate;
}

@keyframes pulseDot {
  from { opacity: 0.3; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.2); }
}

/* Modal de Perfil */
.profile-card-details {
  text-align: center;
  padding: 16px 0;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #e0e7ff;
  color: var(--header-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.profile-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.profile-role {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

.profile-info-text {
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 4px;
}

.btn-secondary-action {
  width: 100%;
  height: 48px;
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-danger-action {
  width: 100%;
  height: 48px;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  border-radius: 12px;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
}

/* Card Virtual Mastercard no Topo */
.user-card-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
}

.card-chip-box {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.card-chip-box svg {
  flex-shrink: 0;
  color: #fbbf24;
}

.card-details-info {
  display: flex;
  flex-direction: column;
}

.card-label-tipo {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
}

.card-number-preview {
  font-size: 0.98rem;
  font-weight: 750;
  letter-spacing: 1.2px;
  font-family: 'Consolas', 'Courier New', monospace;
}

.card-holder-name {
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}
