@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --brand-primary: #f39200;
    --brand-secondary: #0f172a;
    --brand-accent: #e31e24;
    --success: #10b981;
    --danger: #ef4444;
    --glass: rgba(255, 255, 255, 0.8);
}

/* Prevent Mobile Blurriness & Fix Scaling */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: #f1f5f9;
    color: var(--brand-secondary);
    overflow-x: hidden;
    width: 100%;
    margin: 0;
}

/* --- Layout Structure --- */

.header-bg {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-bottom: 4px solid var(--brand-primary);
    padding-bottom: 2rem;
}

/* Fix: Aggressive override to prevent cards from overlapping the header */
.stats-container,
[class*="stats-container"],
main>div:nth-child(2) {
    margin-top: 1.5rem !important;
    padding: 0 1rem;
    position: relative;
    z-index: 10;
}

.premium-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    border-radius: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.premium-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.08);
}

/* --- Sync Status (Clean Look) --- */
#connStatus {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    font-size: 10px;
    font-weight: 800;
}

/* --- Navigation & Tabs --- */

.tab-btn {
    position: relative;
    padding: 1rem 1.5rem;
    font-weight: 700;
    color: #64748b;
    transition: all 0.3s;
    cursor: pointer;
    white-space: nowrap;
}

.tab-btn.active {
    color: var(--brand-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 4px;
    background: var(--brand-primary);
    border-radius: 10px;
}

.btn-action {
    padding: 0.75rem 1.25rem;
    border-radius: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-size: 0.75rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
}

.status-pill {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

/* --- Mobile Responsiveness (The Final Fixes) --- */
@media (max-width: 640px) {
    .container-fluid {
        padding: 0.5rem;
    }

    /* Force Header and Stats separation */
    .header-bg {
        padding-bottom: 1rem;
    }

    /* Ensure no negative margins from Tailwind move the cards up */
    div[class*="-mt-"] {
        margin-top: 1rem !important;
    }

    /* Prevent text wrapping in tabs (Sales Log Fix) */
    .tab-btn {
        padding: 0.75rem 0.5rem !important;
        font-size: 11px !important;
    }

    h1 {
        font-size: 1.1rem !important;
        white-space: nowrap;
    }

    .tagline {
        font-size: 7px !important;
        white-space: nowrap;
    }

    /* Force linear data in tables and history */
    table,
    .expense-row {
        font-size: 10px !important;
    }

    th,
    td {
        padding: 0.4rem 0.2rem !important;
        white-space: nowrap;
    }

    /* Card adjustments for height economy */
    .card-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .stat-card {
        padding: 0.75rem !important;
    }

    .stat-value {
        font-size: 1.1rem !important;
    }

    .mobile-hide {
        display: none !important;
    }

    /* Shrink action buttons for mobile space */
    .btn-action {
        font-size: 8px;
        padding: 0.4rem 0.6rem;
    }
}

/* --- Utilities --- */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.modal-overlay {
    backdrop-filter: blur(8px);
    background: rgba(15, 23, 42, 0.7);
}