/* FlexCore Finance - ajustes de responsividade para celular/tablet (v1.1.0) */

/* Evita scroll horizontal acidental e zoom de fonte automático no iOS */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
img, svg, canvas { max-width: 100%; }

/* iOS dá zoom na página ao focar campos com fonte < 16px */
@media (max-width: 1023px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
    select, textarea { font-size: 16px !important; }
}

/* Alvos de toque mínimos (~44px) em telas sensíveis ao toque */
@media (pointer: coarse) {
    button, .sidebar-link, select, input[type="date"] { min-height: 44px; }
    .chart-period-btn { min-height: 36px; }
}

/* Hover "grudado" no toque: desliga efeitos de elevação */
@media (hover: none) {
    .card-hover:hover, .chart-period-btn:hover { transform: none; box-shadow: none; }
}

/* Altura real da tela no mobile (barra do navegador) e área segura (notch / barra de gestos) */
@media (max-width: 1023px) {
    .sidebar { height: 100vh; height: 100dvh; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
}
#modalContent { max-height: 90vh; max-height: 90dvh; }
#modalContainer { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
@media (max-width: 639px) {
    #modalContainer { align-items: flex-end; padding: 0; }
    #modalContent { max-width: none; border-bottom-left-radius: 0; border-bottom-right-radius: 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* App instalado (standalone): respeita o notch na barra superior */
@media (display-mode: standalone) {
    body { overscroll-behavior-y: none; }
    header.sticky { padding-top: env(safe-area-inset-top); }
}

/* Botão flutuante e avisos fora da barra de gestos; toast não cobre o FAB */
button.fixed.bottom-6.right-6 { bottom: calc(1.5rem + env(safe-area-inset-bottom)); right: calc(1.5rem + env(safe-area-inset-right)); }
#toastContainer { bottom: calc(1rem + env(safe-area-inset-bottom)); max-width: calc(100vw - 2rem); }
@media (max-width: 639px) {
    #toastContainer { bottom: calc(6.5rem + env(safe-area-inset-bottom)); left: 1rem; right: 1rem; }
}

/* Tabelas largas rolam dentro do contêiner em vez de quebrar o layout */
.overflow-x-auto { -webkit-overflow-scrolling: touch; }
.overflow-x-auto table { min-width: 560px; }

/* Banner de instalação (PWA) */
/* abaixo dos modais (z-50) e acima do botão flutuante (z-40) */
#pwaInstall { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); display: flex; justify-content: center; pointer-events: none; }
#pwaInstall .pwa-card { pointer-events: auto; width: 100%; max-width: 440px; background: #1e293b; color: #fff; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.45); font-family: 'Plus Jakarta Sans', system-ui, sans-serif; animation: pwaUp .3s ease-out; }
#pwaInstall .pwa-head { display: flex; gap: 12px; align-items: center; }
#pwaInstall img { width: 48px; height: 48px; border-radius: 12px; flex: none; }
#pwaInstall strong { display: block; font-size: 15px; }
#pwaInstall p { margin: 2px 0 0; font-size: 13px; line-height: 1.4; color: #cbd5e1; }
#pwaInstall .pwa-steps { margin: 12px 0 0; padding: 10px 12px; background: rgba(255,255,255,.06); border-radius: 12px; font-size: 13px; line-height: 1.6; color: #e2e8f0; }
#pwaInstall .pwa-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
#pwaInstall button { border: 0; border-radius: 12px; padding: 11px 14px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; min-height: 44px; }
#pwaInstall .pwa-primary { background: #22c55e; color: #fff; flex: 1 1 100%; }
#pwaInstall .pwa-secondary { background: rgba(255,255,255,.1); color: #e2e8f0; flex: 1 1 0; }
@keyframes pwaUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
