:root {
  --purple: #8A05BE;
  --purple-dark: #6B04A0;
  --purple-light: #A020F0;
  --purple-bg: #F5EAFB;
  --white: #FFFFFF;
  --gray-50: #FAFAFA;
  --gray-100: #F0F0F0;
  --gray-200: #E0E0E0;
  --gray-500: #888;
  --gray-700: #333;
  --gray-900: #111;
  --success: #00C853;
  --radius: 16px;
  --radius-sm: 12px;
}

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

html, body {
  height: 100%;
  background: var(--gray-50);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--gray-900);
  overflow-x: hidden;
  touch-action: manipulation;
}

#app {
  min-height: 100%;
  min-height: 100svh;
}

.screen {
  display: none;
  min-height: 100svh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ─── Tela de instalação ─── */
.install-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
  padding: 48px 24px;
  text-align: center;
  color: var(--white);
}

.hero-logo {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.install-hero h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.hero-sub {
  font-size: 16px;
  opacity: 0.85;
  max-width: 280px;
  line-height: 1.5;
}

.install-actions {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--white);
}

.ios-hint {
  padding: 16px 24px 32px;
  background: var(--white);
  text-align: center;
  color: var(--gray-500);
  font-size: 14px;
  line-height: 1.5;
}
.ios-hint strong { color: var(--gray-700); }

/* ─── Botões ─── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 16px 24px;
  transition: transform 0.1s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--purple);
  color: var(--white);
}
.btn-primary:active { background: var(--purple-dark); }

.btn-ghost {
  background: transparent;
  color: var(--purple);
}

.btn-lg {
  padding: 18px 24px;
  font-size: 17px;
  border-radius: var(--radius);
}

/* ─── Header ─── */
.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: var(--purple);
  color: var(--white);
  padding-top: max(16px, env(safe-area-inset-top, 0px));
}

.header-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.header-title {
  font-weight: 700;
  font-size: 18px;
  flex: 1;
}

.notif-badge {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-badge .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ccc;
  transition: background 0.3s;
}
.notif-badge.active .dot { background: var(--success); }

/* ─── Conteúdo ─── */
.main-content {
  flex: 1;
  padding: 20px 16px;
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
}

.balance-card {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-light) 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 24px;
}

.balance-label {
  display: block;
  font-size: 14px;
  opacity: 0.8;
  margin-bottom: 8px;
}

.balance-value {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
}

/* ─── Grid de ações ─── */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.action-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, border-color 0.2s;
}
.action-card:active {
  transform: scale(0.96);
  border-color: var(--purple);
}

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--purple-bg);
  color: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
}
.action-icon svg {
  width: 22px;
  height: 22px;
}

.action-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--gray-900);
}

.action-desc {
  font-size: 13px;
  color: var(--gray-500);
}

/* ─── Push banner ─── */
.push-banner {
  background: var(--purple-bg);
  border: 1.5px solid var(--purple);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.push-banner p {
  font-size: 14px;
  color: var(--gray-700);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ─── Feedback ─── */
.feedback {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  animation: fadeIn 0.3s ease;
}
.feedback.success {
  background: #E8F5E9;
  color: #1B5E20;
}
.feedback.error {
  background: #FFEBEE;
  color: #B71C1C;
}

/* ─── Modal ─── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-width: 200px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── Utilities ─── */
.hidden { display: none !important; }

/* ─── In-app notification banner ─── */
#in-app-notif {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 16px));
  left: 12px;
  right: 12px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  z-index: 200;
  transform: translateY(-120%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#in-app-notif.visible {
  transform: translateY(0);
}
#in-app-notif .notif-icon img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}
#in-app-notif .notif-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
#in-app-notif .notif-text strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-900);
}
#in-app-notif .notif-text span {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.4;
}

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