/* ──────────────────────────────────────────────────────────────────────────
   EXIMIR FINANZAS — Estilos Globales
────────────────────────────────────────────────────────────────────────── */

/* ── Variables ───────────────────────────────────────────────────────────── */
:root {
    --radius-card: 20px;
    --radius-inner: 14px;
    --shadow-card: 0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    /* Palette */
    --bg-primary: #EAF2FF;
    --brand-sky: #60A5FA;
    --brand-indigo: #6366F1;
    --muted-900: #0f172a;
    --muted-700: #334155;
}

.dark {
    --bg-primary: #020617;
    --brand-sky: #60A5FA;
    --brand-indigo: #818cf8;
    --muted-900: #f8fafc;
    --muted-700: #cbd5e1;
}

.dark body {
    background-color: #020617 !important;
    color: #e2e8f0 !important;
}

.dark .card {
    background: #111827;
    border-color: rgba(148,163,184,0.18);
    box-shadow: 0 8px 28px rgba(15,23,42,0.18);
}

.dark .bg-white {
    background-color: #111827 !important;
}

.dark .bg-gray-50 {
    background-color: #020617 !important;
}

.dark .text-black {
    color: #f8fafc !important;
}

.dark .text-gray-500,
.dark .text-gray-400 {
    color: #94a3b8 !important;
}

.dark .border-black\/5 {
    border-color: rgba(148,163,184,0.18) !important;
}

.dark .bg-black\/5 {
    background-color: rgba(255,255,255,0.08) !important;
}

.dark .card .text-black {
    color: #f8fafc !important;
}
.dark .card .text-gray-500,
.dark .card .text-gray-400 {
    color: #94a3b8 !important;
}

.dark .scroll-hidden::-webkit-scrollbar { display: none; }

/* ── Reset base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-primary) !important;
    color: #111 !important;
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
}

/* ── Grid del dashboard ──────────────────────────────────────────────────── */
.app-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 1024px) {
    .app-grid {
        grid-template-columns: repeat(12, 1fr);
        gap: 20px;
        padding-top: 24px;
        padding-bottom: 80px;
    }
    .app-grid .lg\:col-span-8  { grid-column: span 8; }
    .app-grid .lg\:col-span-4  { grid-column: span 4; }
    .app-grid .col-span-full   { grid-column: 1 / -1; }
}

/* ── Card base ───────────────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: var(--radius-card);
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: var(--shadow-card);
    padding: 20px;
}

@media (min-width: 640px) {
    .card { padding: 24px; }
}

/* ── Clases de radio ─────────────────────────────────────────────────────── */
.rounded-bento       { border-radius: var(--radius-card); }
.rounded-bento-inner { border-radius: var(--radius-inner); }

/* ── Inputs number: ocultar flechas ──────────────────────────────────────── */
.hide-arrows::-webkit-outer-spin-button,
.hide-arrows::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hide-arrows { -moz-appearance: textfield; }

/* ── Scrollbars ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 4px; height: 4px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: #d0d0d8; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover  { background: #b0b0bb; }
.scroll-hidden::-webkit-scrollbar{ display: none; }

/* Hide scrollbars globally but keep scrolling functional */
html, body, * {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}
html::-webkit-scrollbar, body::-webkit-scrollbar, *::-webkit-scrollbar {
    display: none; /* WebKit */
    width: 0; height: 0;
}

/* ── Material Symbols ────────────────────────────────────────────────────── */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── Animaciones ─────────────────────────────────────────────────────────── */
.animate-scale-up {
    animation: scaleUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes scaleUp {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.18s ease-out forwards;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Toast */
.animate-slide-up {
    animation: slideUpToast 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slideUpToast {
    from { transform: translate(-50%, 20px); opacity: 0; }
    to   { transform: translate(-50%, 0);    opacity: 1; }
}

/* Modales que suben desde abajo (bottom-sheet en móvil) */
.animate-slide-up-modal {
    animation: slideUpModal 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slideUpModal {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Jiggle (Subtle Edit Mode) */
.animate-jiggle {
    animation: subtleJiggle 0.5s ease-in-out infinite;
    transform-origin: center;
}
@keyframes subtleJiggle {
    0%   { transform: rotate(-1deg); }
    50%  { transform: rotate(1.5deg); }
    100% { transform: rotate(-1deg); }
}

/* Racha glow animation when not interacted */
.animate-streak-glow {
    animation: streakGlow 1.8s infinite ease-in-out;
}
@keyframes streakGlow {
    0%, 100% {
        box-shadow: 0 0 4px rgba(249, 115, 22, 0.2), inset 0 0 0 1px rgba(249, 115, 22, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 16px rgba(249, 115, 22, 0.55), inset 0 0 0 1.5px rgba(249, 115, 22, 0.4);
        transform: scale(1.03);
    }
}

/* ── Pantalla de carga ───────────────────────────────────────────────────── */
#initial-loader {
    position: fixed; inset: 0;
    background: #F5F4F7;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 9999;
    transition: opacity 0.45s ease;
}
#initial-loader.fade-out { opacity: 0; pointer-events: none; }

#initial-loader .logo-mark {
    width: 72px; height: 72px;
    border-radius: 20px;
    background: #111; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 40px;
    margin-bottom: 22px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.14);
    animation: logoPulse 2s infinite ease-in-out;
}
@keyframes logoPulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.06); }
}

#initial-loader .loader-bar {
    width: 180px; height: 3px;
    background: #e0dfe4;
    border-radius: 99px; overflow: hidden; position: relative;
}
#initial-loader .loader-bar::before {
    content: ''; position: absolute; inset: 0; width: 40%;
    background: #111; border-radius: 99px;
    animation: loaderSlide 1.4s ease-in-out infinite;
}
@keyframes loaderSlide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}
#initial-loader .loader-text {
    margin-top: 16px; font-weight: 700; font-size: 11px;
    color: #888; letter-spacing: 0.5px; text-transform: uppercase;
}
#initial-loader .loader-error {
    margin-top: 20px; text-align: center;
    font-size: 13px; color: #cc4444; display: none;
}
#initial-loader.error-state .loader-error { display: block; }
#initial-loader.error-state .loader-bar,
#initial-loader.error-state .loader-text  { display: none; }

.reload-btn {
    padding: 10px 24px; background: #111; color: #fff;
    border: none; border-radius: 99px;
    font-weight: 700; cursor: pointer; font-size: 12px; margin-top: 12px;
}

/* ── Responsive: breakpoints finos ──────────────────────────────────────── */

/* Teléfonos pequeños (< 380px, ej. iPhone SE) */
@media (max-width: 380px) {
    .card { padding: 16px; border-radius: 16px; }
    h2.balance-amount { font-size: 1.8rem !important; }
}

/* Teléfonos medianos (380–640px, ej. iPhone 13) */
@media (max-width: 640px) {
    .app-grid { gap: 10px; padding-left: 12px; padding-right: 12px; }

    /* Modales: bottom-sheet sin bordes laterales */
    .sm\:rounded-bento  { border-radius: var(--radius-card) var(--radius-card) 0 0 !important; }
    .sm\:max-w-md       { max-width: 100% !important; }

    /* Grilla de categorías: 3 columnas en móvil */
    .cat-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Tablets (640–1024px) */
@media (min-width: 640px) and (max-width: 1023px) {
    .app-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .app-grid section { grid-column: span 1; }
    .app-grid section.col-span-full { grid-column: 1 / -1; }
}

/* ── Safe area (notch iPhone) ────────────────────────────────────────────── */
@supports (padding-top: env(safe-area-inset-top)) {
    body { padding-top: env(safe-area-inset-top); }
    .fab-wrap { padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }
}