:root {
  --bg: #e0e5ec;
  --shadow-light: #ffffff;
  --shadow-dark: #a3b1c6;
  --text: #2d3748;
  --muted: #8899aa;
  --accent: #667eea;
  --green: #10b981;
  --red: #ef4444;
  --neu-out: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
  --neu-in:  inset 4px 4px 10px var(--shadow-dark), inset -4px -4px 10px var(--shadow-light);
  --neu-press: inset 3px 3px 7px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50V18L28 2l28 16v32L28 66zm0-4.2L4 48.2V21.8L28 7.2l24 14.6v26.4L28 61.8z' fill='%23c8d0da' fill-opacity='0.35'/%3E%3C/svg%3E");
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 16px;
}

.container { width: 100%; max-width: 420px; }

/* ── TELAS ── */
.tela { display: none; }
.tela.active { display: block; animation: fadeUp 0.35s ease-out; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── CARD ── */
.neu-card {
  background: var(--bg);
  border-radius: 28px;
  padding: 32px 24px;
  box-shadow: var(--neu-out);
  margin-bottom: 16px;
}

/* ── SETUP HEADER ── */
.setup-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
  gap: 12px;
}

.logo-upload-wrap { position: relative; cursor: pointer; }
.logo-circle {
  width: 90px; height: 90px;
  border-radius: 22px;
  background: var(--bg);
  box-shadow: var(--neu-out);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.logo-circle:hover { box-shadow: 8px 8px 18px var(--shadow-dark), -6px -6px 14px var(--shadow-light); }
.logo-circle img { width: 100%; height: 100%; object-fit: cover; }
.logo-circle .logo-placeholder { font-size: 36px; }
.logo-edit-badge {
  position: absolute; bottom: -4px; right: -4px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: white;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
}

.foto-upload-wrap { position: relative; cursor: pointer; }
.foto-circle {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--neu-out);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.foto-circle:hover { box-shadow: 8px 8px 18px var(--shadow-dark), -6px -6px 14px var(--shadow-light); }
.foto-circle img { width: 100%; height: 100%; object-fit: cover; }
.foto-circle .foto-placeholder { font-size: 28px; }
.foto-edit-badge {
  position: absolute; bottom: 0; right: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--green); color: white; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
}

.setup-header h1 { font-size: 24px; font-weight: 900; color: var(--text); letter-spacing: -0.5px; margin-bottom: 2px; }
.setup-header p  { font-size: 13px; color: var(--muted); font-weight: 600; }
.img-hint        { font-size: 11px; color: var(--muted); text-align: center; font-weight: 600; }

/* ── INPUTS ── */
.input-group { margin-bottom: 16px; }
.input-group label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 8px;
}
input[type="text"],
input[type="number"],
input[type="password"] {
  width: 100%;
  font-family: 'Nunito', sans-serif;
  font-size: 17px; font-weight: 700;
  padding: 14px 18px;
  border: none; border-radius: 14px;
  background: var(--bg); color: var(--text);
  box-shadow: var(--neu-in);
  outline: none; transition: box-shadow 0.2s;
}
input:focus {
  box-shadow: inset 4px 4px 10px var(--shadow-dark),
              inset -4px -4px 10px var(--shadow-light),
              0 0 0 2px rgba(102,126,234,0.25);
}
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; font-weight: 600; }

/* ── BOTÕES ── */
button {
  border: none; border-radius: 50px;
  padding: 15px 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px; font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
button:active { transform: scale(0.97); }

.btn-primary {
  width: 100%; background: var(--bg);
  color: var(--accent); box-shadow: var(--neu-out); margin-top: 4px;
}
.btn-primary:hover  { box-shadow: 8px 8px 16px var(--shadow-dark), -6px -6px 14px var(--shadow-light); }
.btn-primary:active { box-shadow: var(--neu-press); }

.btn-secondary {
  width: 100%; background: var(--bg);
  color: var(--muted); box-shadow: var(--neu-out); margin-top: 10px;
}
.btn-secondary:hover  { color: var(--text); }
.btn-secondary:active { box-shadow: var(--neu-press); }

/* ── STATUS ── */
.status {
  padding: 12px 16px; border-radius: 14px;
  font-size: 13px; font-weight: 700;
  text-align: center; margin-top: 14px; display: none;
  box-shadow: var(--neu-in);
}
.status.show    { display: block; }
.status.info    { color: #1976d2; background: #dbeafe; }
.status.success { color: #166534; background: #dcfce7; }
.status.error   { color: #991b1b; background: #fee2e2; }

/* ── PIN ── */
.pin-row { display: flex; gap: 12px; justify-content: center; margin: 24px 0; }
.pin-digit {
  width: 62px !important; height: 72px !important;
  font-size: 30px !important; font-weight: 900 !important;
  text-align: center; border-radius: 18px !important;
  transition: transform 0.15s, box-shadow 0.2s !important;
}
.pin-digit:focus { transform: scale(1.06) !important; }

/* ── TELA VERIFICAR PIN ── */
.pin-user-header {
  display: flex; flex-direction: column;
  align-items: center; margin-bottom: 8px; gap: 12px;
}
.pin-foto-circle {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--bg); box-shadow: var(--neu-out);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}
.pin-foto-circle img { width: 100%; height: 100%; object-fit: cover; }
.pin-user-header h1 { font-size: 22px; font-weight: 900; }
.pin-user-header p  { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ── USER BAR ── */
.user-bar {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg);
  box-shadow: var(--neu-in);
  border-radius: 16px; padding: 12px 16px;
  margin-bottom: 20px;
}
.user-name { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; color: var(--text); }
.user-avatar-sm {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #764ba2);
  box-shadow: var(--neu-out);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white;
  overflow: hidden; flex-shrink: 0;
}
.user-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

.btn-dropdown {
  background: var(--bg); color: var(--muted);
  box-shadow: var(--neu-out); padding: 8px 14px;
  font-size: 12px; border-radius: 50px; gap: 5px;
}
.btn-dropdown:hover  { color: var(--text); }
.btn-dropdown:active { box-shadow: var(--neu-press); }

/* ── DROPDOWN ── */
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0; left: 0;
  background: var(--bg); border-radius: 18px;
  box-shadow: 10px 10px 24px var(--shadow-dark), -6px -6px 16px var(--shadow-light);
  z-index: 100; overflow: hidden; display: none;
  animation: dropIn 0.2s ease-out;
}
.dropdown-menu.open { display: block; }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer;
  transition: background 0.15s;
  font-size: 14px; font-weight: 700; color: var(--text);
  border-bottom: 1px solid rgba(163,177,198,0.2);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover  { background: rgba(102,126,234,0.06); }
.dropdown-item:active { background: rgba(102,126,234,0.12); }
.dropdown-item .dd-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #a8c0ff, #3f2b96);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: white; flex-shrink: 0; overflow: hidden;
}
.dropdown-item .dd-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dropdown-item .dd-name   { flex: 1; }
.dropdown-item .dd-active {
  font-size: 11px; color: var(--accent); font-weight: 700;
  background: rgba(102,126,234,0.12); padding: 3px 8px; border-radius: 50px;
}
.dropdown-divider { border-top: 2px solid rgba(163,177,198,0.25); margin: 4px 0; }
.dropdown-new {
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; font-size: 14px; font-weight: 700; color: var(--accent);
  transition: background 0.15s;
}
.dropdown-new:hover { background: rgba(102,126,234,0.06); }
.dropdown-new .dd-plus {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg); box-shadow: var(--neu-out);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--accent);
}

/* ── MÊS NAVIGATOR ── */
.mes-navigator {
  background: linear-gradient(135deg, #4b6cb7 0%, #764ba2 100%);
  border-radius: 20px; padding: 16px 14px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; color: white;
  box-shadow: 6px 6px 14px rgba(75,108,183,0.4), -2px -2px 8px rgba(255,255,255,0.5);
  user-select: none; touch-action: pan-y;
}
.mes-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.18); color: white;
  font-size: 20px; padding: 0;
  border: 1px solid rgba(255,255,255,0.25); box-shadow: none;
}
.mes-btn:hover    { background: rgba(255,255,255,0.28); }
.mes-btn:active   { transform: scale(0.93); }
.mes-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
.mes-info         { text-align: center; flex: 1; }
.mes-info .mes-nome    { font-size: 18px; font-weight: 900; display: block; margin-bottom: 2px; }
.mes-info .mes-periodo { font-size: 11px; opacity: 0.85; font-weight: 600; letter-spacing: 0.3px; }

/* ── VALOR ── */
.valor-row {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; padding: 6px 4px;
}
.valor-display-wrap {
  flex: 1; background: var(--bg);
  box-shadow: var(--neu-in); border-radius: 18px;
  padding: 4px 8px;
  display: flex; align-items: center; justify-content: center;
}
#valor {
  font-family: 'Share Tech Mono', monospace !important;
  font-size: 36px !important; font-weight: 400 !important;
  color: var(--text) !important; background: transparent !important;
  box-shadow: none !important; border-radius: 0 !important;
  text-align: center; letter-spacing: 3px;
  padding: 12px 8px !important; width: 100%;
}
#valor::placeholder { color: #b0bec5; }

.btn-voice {
  width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #52606e, #1a2330);
  color: white; font-size: 24px; padding: 0; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.08);
}
.btn-voice:hover   { box-shadow: 8px 8px 18px var(--shadow-dark), -4px -4px 10px var(--shadow-light); }
.btn-voice:active  { transform: scale(0.95); }
.btn-voice.listening {
  animation: pulse-mic 1s ease-in-out infinite;
  background: radial-gradient(circle at 35% 35%, #e53935, #7b1fa2);
}
@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,57,53,0.4); }
  50%       { box-shadow: 0 0 0 12px rgba(229,57,53,0); }
}

/* ── ACTIONS ── */
.actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.btn-add {
  background: linear-gradient(135deg, #6ee7b7 0%, #34d399 50%, #10b981 100%);
  color: white; padding: 18px; font-size: 15px;
  box-shadow: 4px 4px 12px rgba(16,185,129,0.35), -2px -2px 6px rgba(255,255,255,0.6);
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.btn-add:hover  { box-shadow: 6px 6px 16px rgba(16,185,129,0.45), -2px -2px 8px rgba(255,255,255,0.7); }
.btn-add:active { box-shadow: inset 3px 3px 8px rgba(0,0,0,0.15); transform: scale(0.97); }
.btn-remove {
  background: linear-gradient(135deg, #fca5a5 0%, #f87171 50%, #ef4444 100%);
  color: white; padding: 18px; font-size: 15px;
  box-shadow: 4px 4px 12px rgba(239,68,68,0.35), -2px -2px 6px rgba(255,255,255,0.6);
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.btn-remove:hover  { box-shadow: 6px 6px 16px rgba(239,68,68,0.45), -2px -2px 8px rgba(255,255,255,0.7); }
.btn-remove:active { box-shadow: inset 3px 3px 8px rgba(0,0,0,0.15); transform: scale(0.97); }

/* ── TOTAIS ── */
.totals-card {
  display: none; border-radius: 22px; overflow: hidden;
  box-shadow: var(--neu-out); grid-template-columns: 1fr 1fr;
  margin-bottom: 4px;
}
.totals-card.visible { display: grid; }
.total-half  { padding: 20px 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.total-half.hoje { background: linear-gradient(135deg, #3d4e6b 0%, #2d3a52 100%); }
.total-half.mes  { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.total-icon  { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-size: 15px; margin-bottom: 6px; }
.total-label { font-size: 11px; color: rgba(255,255,255,0.8); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.total-value { font-size: 20px; font-weight: 900; color: white; letter-spacing: -0.5px; }
.total-value.animate { animation: countUp 0.4s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes countUp {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* ── ADS ── */
.ad-container { margin-top: 16px; border-radius: 14px; overflow: hidden; min-height: 50px; min-width: 300px; }

/* ── RODAPÉ ── */
.app-footer {
  text-align: center;
  padding: 10px 0 2px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid rgba(163,177,198,0.3);
  margin-top: 12px;
}
.app-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

/* ── LOADING OVERLAY ── */
.upload-loading {
  position: fixed; inset: 0;
  background: rgba(224,229,236,0.85);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 999; flex-direction: column; gap: 16px;
  font-size: 16px; font-weight: 800; color: var(--text);
}
.upload-loading.show { display: flex; }
.spinner {
  width: 48px; height: 48px;
  border: 5px solid var(--shadow-dark);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
