@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

.hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

:root {
    /* Modern HSL Palette */
    --primary-h: 142;
    --primary-s: 71%;
    --primary-l: 45%;

    --primary-green: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --dark-green: hsl(var(--primary-h), var(--primary-s), 20%);
    --light-green: hsl(var(--primary-h), var(--primary-s), 85%);
    --accent-glow: hsl(var(--primary-h), var(--primary-s), 60%);

    --bg-color: hsl(var(--primary-h), 20%, 98%);
    --white: #ffffff;
    --text-dark: hsl(222, 47%, 11%);
    --text-muted: hsl(215, 16%, 47%);
    --border-color: hsl(214, 32%, 91%);

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius: var(--radius-md);
}

/* --- Global Premium Background --- */
.app-bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background:
        radial-gradient(at 0% 0%, hsla(var(--primary-h), 71%, 45%, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, hsla(200, 70%, 60%, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(280, 70%, 50%, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(var(--primary-h), 80%, 30%, 0.1) 0px, transparent 50%),
        hsl(222, 47%, 98%);
    /* Base light color */
    transition: background 0.5s ease;
}

.app-bg-layer::after {
    content: '';
    position: absolute;
    inset: 0;
    backdrop-filter: blur(100px);
    -webkit-backdrop-filter: blur(100px);
    pointer-events: none;
    /* CRITICAL: prevent this from blocking touch events */
}

body.dark-mode .app-bg-layer {
    background:
        radial-gradient(at 0% 0%, hsla(var(--primary-h), 71%, 45%, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, hsla(200, 70%, 60%, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(280, 70%, 50%, 0.05) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(var(--primary-h), 80%, 20%, 0.1) 0px, transparent 50%),
        hsl(222, 47%, 4%);
    /* Base dark color */
}

/* Dark Mode Theme Overrides - Premium Refinement */
body.dark-mode {
    /* Deeper, more sophisticated background */
    --bg-color: hsl(222, 47%, 4%);
    /* Cards/Elevated sections - slightly lighter for depth */
    --white: hsl(222, 47%, 8%);
    --text-dark: hsl(210, 40%, 98%);
    --text-muted: hsl(215, 20%, 65%);
    --border-color: hsla(217, 32%, 70%, 0.25);

    /* Glass accents for dark mode */
    --glass-bg: hsla(222, 47%, 10%, 0.7);
    --glass-border: hsla(0, 0%, 100%, 0.15);
    --glass-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6);

    /* Softened primary colors for dark mode to prevent neon glare */
    --primary-green: hsl(var(--primary-h), 65%, 42%);
    --accent-glow: hsl(var(--primary-h), 65%, 35%);
    --error-red: hsl(0, 75%, 55%);

    /* Adjusted shadows for dark surfaces - focus on glow and depth */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.7);
}

body.dark-mode .app-container {
    background: var(--bg-color);
}

body.dark-mode #dashboard {
    background: transparent;
}

body.dark-mode .app-header {
    background: hsla(222, 47%, 6%, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 2px solid hsla(0, 0%, 100%, 0.12);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

body.dark-mode .bottom-nav {
    background: hsla(222, 47%, 6%, 0.9);
    backdrop-filter: blur(20px);
    border-top: 2px solid hsla(0, 0%, 100%, 0.12);
}

/* Premium Card Distinction */
body.dark-mode .glass-card,
body.dark-mode .settings-card,
body.dark-mode .summary-card {
    background: var(--white);
    border: 1.5px solid hsla(0, 0%, 100%, 0.12);
    box-shadow: var(--shadow-md), inset 0 0 0 1px hsla(0, 0%, 100%, 0.05);
}

/* Distinct Header in Cards */
body.dark-mode .card-header {
    border-bottom: 2px solid var(--border-color);
}

body.dark-mode .card-icon {
    background: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.15);
    color: var(--primary-green);
    border: 1px solid hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.2);
}

body.dark-mode .trend-indicator {
    background: hsla(0, 0%, 100%, 0.05);
    border: 1px solid var(--glass-border);
}

/* Better Input Definition */
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: hsl(222, 47%, 6%);
    border: 1px solid hsla(0, 0%, 100%, 0.08);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    color: var(--text-dark);
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px hsla(142, 69%, 58%, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .secondary-btn {
    background: hsla(0, 0%, 100%, 0.05);
    border: 1px solid hsla(0, 0%, 100%, 0.05);
    color: var(--text-dark);
}

body.dark-mode .secondary-btn:hover {
    background: hsla(0, 0%, 100%, 0.08);
}

/* Setting Tabs Differentiation */
body.dark-mode .settings-tabs {
    background: hsla(0, 0%, 0%, 0.2);
    border: 2px solid hsla(0, 0%, 100%, 0.12);
}

body.dark-mode .settings-tab.active,
body.dark-mode .filter-btn.active {
    background: var(--primary-green);
    color: white;
    box-shadow: 0 4px 15px hsla(142, 69%, 58%, 0.3);
}

body.dark-mode .settings-tab:not(.active) {
    color: var(--text-muted);
}

body.dark-mode .settings-tab:hover:not(.active) {
    background: hsla(0, 0%, 100%, 0.03);
    color: var(--text-dark);
}

body.dark-mode hr {
    border: none;
    border-top: 2px solid hsla(0, 0%, 100%, 0.15);
}

body.dark-mode .text-muted {
    color: hsl(215, 15%, 55%);
}

.budget-summary-card {
    background: linear-gradient(135deg, var(--dark-green) 0%, #006400 100%);
}

body.dark-mode .budget-summary-card {
    background: linear-gradient(135deg, hsla(var(--primary-h), var(--primary-s), 15%, 1) 0%, hsla(var(--primary-h), var(--primary-s), 5%, 1) 100%) !important;
    border: 1.5px solid var(--glass-border) !important;
}

/* --- Dark Mode Aesthetic Refinements --- */

body.dark-mode .empty-state p,
body.dark-mode .recent-transactions-empty {
    color: var(--text-muted);
}

/* Specific component overrides for Budget Card */
body.dark-mode section#budget .card[style*="linear-gradient"] {
    background: linear-gradient(135deg, hsla(222, 47%, 12%, 1) 0%, hsla(222, 47%, 4%, 1) 100%) !important;
    border: 1.5px solid var(--glass-border) !important;
    color: var(--text-dark) !important;
}

body.dark-mode #budget-progress {
    background: var(--primary-green) !important;
    box-shadow: 0 0 10px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.3);
}

/* List Items & Activity */
body.dark-mode .txn-list .card,
body.dark-mode .recent-activity-list .activity-item,
body.dark-mode .txn-item {
    background: hsla(222, 47%, 6%, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.8rem;
}

body.dark-mode .txn-item-date {
    color: var(--text-muted) !important;
}

/* Calendar Debug & Error Styles */
body.dark-mode .calendar-debug-label {
    grid-column: 1 / -1;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 8px;
    background: hsla(222, 47%, 2%, 0.3);
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 5px;
}

body.dark-mode .calendar-error-marker {
    grid-column: 1 / -1;
    background: hsla(0, 50%, 15%, 0.4);
    color: var(--error-red);
    padding: 20px;
    text-align: center;
    border: 1px dashed var(--error-red);
    border-radius: var(--radius-md);
}

/* Fix for Summary Stat background */
body.dark-mode .stats-section .card {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Analytics Summary Row */
body.dark-mode .summary-stats-row {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1.5px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

body.dark-mode .stat-item .label {
    color: var(--text-muted);
}

/* Calendar Refinements */
body.dark-mode .calendar-header {
    background: transparent;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1.5rem;
}

body.dark-mode .calendar-grid-header {
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}

body.dark-mode .calendar-grid {
    background: var(--glass-border);
    /* Subtle grid lines */
    border: 1px solid var(--glass-border);
}

body.dark-mode .calendar-day {
    background: var(--white);
}

body.dark-mode .calendar-day.empty {
    background: hsla(222, 47%, 2%, 0.3);
}

body.dark-mode .calendar-day.today {
    background: hsla(var(--primary-h), var(--primary-s), 15%, 0.2);
    box-shadow: inset 0 0 0 1px var(--primary-green);
}

body.dark-mode .calendar-event.work {
    background: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.8);
}

body.dark-mode .calendar-event.expense {
    background: hsla(0, 75%, 45%, 0.8);
}

body.dark-mode .calendar-total.net-positive {
    background: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.1);
    color: var(--primary-green);
}

body.dark-mode .cal-select {
    background: var(--white);
    border-color: var(--glass-border);
    color: var(--text-dark);
}

/* Budget & Navigation Refinements */
body.dark-mode .budget-nav {
    background: hsla(222, 47%, 6%, 0.5) !important;
    border-color: var(--glass-border) !important;
    color: var(--text-dark);
}

body.dark-mode .txn-toggle-container {
    background: hsla(222, 47%, 2%, 0.5) !important;
}

body.dark-mode .txn-toggle-container .filter-btn:not(.active) {
    color: var(--text-muted);
}

body.dark-mode .txn-toggle-container .filter-btn.active {
    background: var(--primary-green);
    color: white;
}

body.dark-mode .filter-controls {
    background: hsla(222, 47%, 2%, 0.5);
    border-color: var(--glass-border);
}

body.dark-mode #invoice-jobs-list {
    background: hsla(222, 47%, 2%, 0.3);
    border-color: var(--glass-border);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: transparent;
    /* Background handled by .app-bg-layer */
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
}

/* Ensure all interactive elements respond to touch */
button,
a,
[onclick],
.nav-links li,
.filter-btn,
.client-bar,
.calendar-day,
.activity-item,
.glass-card,
input,
select,
textarea {
    touch-action: manipulation;
}

/* Dashboard Background wrapper */
#dashboard {
    background: transparent;
    /* Glass effect handled globally and per card */
    position: relative;
    border-radius: var(--radius-lg);
    padding: 2.5rem !important;
    min-height: 100vh;
    overflow: visible;
    /* was overflow:hidden — caused scroll clipping */
}


/* Ambient glows for dashboard */
#dashboard::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

#dashboard::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, hsl(200, 70%, 60%) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    opacity: 0.1;
    z-index: 0;
    pointer-events: none;
}

/* Ensure content sits above overlay */
#dashboard>* {
    position: relative;
    z-index: 1;
}

/* Main Layout Structure */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding-bottom: 70px;
    /* Space for bottom nav */
}

/* Digital Clock - Premium Pill Style */
#digital-clock {
    background: var(--white);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1.25rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.02em;
}

body.dark-mode #digital-clock {
    background: hsla(222, 47%, 6%, 0.5);
    border-color: var(--glass-border);
    color: var(--text-dark);
}

/* Top App Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-dark);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-dark);
}

.logout-icon-btn {
    background: var(--white);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-dark);
    box-shadow: var(--shadow-sm);
}

.logout-icon-btn:hover {
    background: var(--primary-light);
    border-color: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.2);
    color: var(--primary-green);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.trial-badge-header {
    background: var(--primary-light);
    color: var(--primary-green);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.2);
}

.trial-badge-header .icon {
    font-size: 1rem;
}

/* Bottom Navigation - Floating Design */
.bottom-nav {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 600px;
    height: 76px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 12px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
}

.nav-links li {
    padding: 10px 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-muted);
    font-weight: 600;
    flex: 1;
    position: relative;
    border-radius: 16px;
}

.nav-links li:hover {
    color: var(--primary-green);
}

.nav-links li.active {
    color: var(--primary-green);
}

.nav-links li.active::after {
    content: '';
    position: absolute;
    bottom: 6px;
    width: 6px;
    height: 6px;
    background: var(--primary-green);
    border-radius: 50%;
}

.nav-icon {
    font-size: 1.4rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-links li.active .nav-icon {
    transform: translateY(-4px) scale(1.1);
}

.nav-text {
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    /* CRITICAL: allows flex child to scroll properly */
    -webkit-overflow-scrolling: touch;
    /* smooth momentum scrolling on iOS */
}

.tab-content {
    padding: 1.5rem;
    /* Reduced padding for mobile feel */
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* Adjust dashboard background to cover full width */
#dashboard {
    border-radius: 0;
    /* Full bleed on mobile */
    min-height: auto;
    flex: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Header adjustments for Dashboard */
#dashboard .section-header h2 {
    color: var(--white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-size: 2.5rem;
    text-align: center;
    width: 100%;
    margin-bottom: 0.5rem;
}

#dashboard .section-header {
    flex-direction: column;
    align-items: center;
    margin-bottom: 3rem;
}

.dashboard-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin-top: -1.5rem;
    margin-bottom: 2rem;
    font-weight: 300;
}

.dash-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    padding-left: 0.5rem;
    border-left: 4px solid var(--primary-green);
    letter-spacing: -0.01em;
}

.recent-activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem;
}

.activity-item {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.25rem;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: fadeInSlideRight 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.activity-item:hover {
    background: var(--white);
    transform: translateX(8px);
    border-color: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.2);
    box-shadow: var(--shadow-md);
}

@keyframes fadeInSlideRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Activity Feed Sub-elements */
.activity-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.icon-income {
    background: hsla(142, 71%, 45%, 0.12);
    border: 1px solid hsla(142, 71%, 45%, 0.25);
}

.icon-expense {
    background: hsla(0, 75%, 55%, 0.1);
    border: 1px solid hsla(0, 75%, 55%, 0.2);
}

.activity-details {
    flex: 1;
    min-width: 0;
}

.activity-details h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.activity-details small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.activity-amount {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.amount-positive {
    color: var(--primary-green);
}

.amount-negative {
    color: hsl(0, 75%, 55%);
}

/* glass-item is an alias/complement to activity-item glass style */
.glass-item {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}


.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Premium Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 240px;
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    animation: fadeInSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.glass-card:hover {
    background: var(--white);
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.25);
    border-color: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.3);
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fadeIn-delay-1 {
    animation-delay: 0.1s;
}

.fadeIn-delay-2 {
    animation-delay: 0.2s;
}

.fadeIn-delay-3 {
    animation-delay: 0.3s;
}

.card-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-light) 0%, hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.1) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-green);
    font-size: 2rem;
    margin-bottom: 2rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 0 0 1px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.1);
}

.glass-card:hover .card-icon {
    transform: rotate(-8deg) scale(1.1);
    background: var(--primary-green);
    color: var(--white);
    box-shadow: 0 8px 20px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.4);
}

.glass-card h3,
.glass-card .stat-sub {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.glass-card .stat-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0;
    letter-spacing: -0.05em;
    line-height: 1;
    background: linear-gradient(180deg, var(--text-dark) 0%, hsla(var(--primary-h), 20%, 80%, 1) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Trend Indicators */
.trend-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    margin-top: 2rem;
    padding: 0.6rem 1.25rem;
    background: hsla(0, 0%, 100%, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    width: fit-content;
    border: 1px solid hsla(0, 0%, 100%, 0.1);
}

.trend-up {
    color: var(--primary-green);
}

.trend-down {
    color: hsl(0, 84%, 60%);
}

.sparkline {
    margin-left: auto;
    width: 100px;
    height: 40px;
    opacity: 0.8;
}

/* Forms */
.form-card {
    max-width: 600px;
    margin-bottom: 2rem;
    border: 1px solid var(--primary-green);
}

.hidden {
    display: none;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

input,
select,
textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    font-size: 1rem;
    background: var(--white);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-dark);
    font-weight: 500;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.1);
    background: var(--white);
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.primary-btn {
    background: var(--primary-green);
    color: var(--white);
    box-shadow: 0 10px 20px -5px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.3);
}

.primary-btn:hover {
    background: var(--dark-green);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -8px hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.4);
}

.secondary-btn {
    background: var(--white);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.secondary-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-green);
    color: var(--primary-green);
    transform: translateY(-1px);
}

.full-width {
    width: 100%;
}

/* Calculator & Stats Header */
.calculator-layout {
    display: block;
    margin-bottom: 3rem;
}

.calculator-card {
    max-width: 500px;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-controls {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-color);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
}

.filter-btn {
    border: none;
    background: transparent;
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--white);
    color: var(--primary-green);
    box-shadow: var(--shadow-sm);
}

/* Time Inputs Custom */
.time-12 {
    padding: 0.4rem;
    font-size: 0.9rem;
}

.time-24 {
    padding: 0.4rem;
}

.toggle-container input {
    width: auto;
    margin-right: 4px;
}

/* ==========================================================================
   Calendar Premium Styles
   ========================================================================== */

.calendar-header-top {
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.calendar-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0;
    letter-spacing: -0.5px;
}

.calendar-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

/* Controls Header */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.cal-nav-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--white);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: #f8fafc;
    color: var(--primary-green);
    border-color: #e2e8f0;
    transform: translateY(-1px);
}

.icon-btn:active {
    transform: translateY(0);
}

.pill-btn {
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--white);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill-btn:hover {
    background: #f8fafc;
    color: var(--primary-green);
    border-color: #e2e8f0;
}

.cal-select-group {
    display: flex;
    gap: 0.8rem;
}

.custom-select-wrapper {
    position: relative;
    display: inline-block;
}

.cal-select-modern {
    appearance: none;
    -webkit-appearance: none;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 110px;
}

.cal-select-modern:hover {
    border-color: var(--primary-green);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.1);
}

.cal-select-modern:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.custom-select-wrapper .select-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.cal-select-modern:focus+.select-icon {
    transform: translateY(-50%) rotate(180deg);
}

/* Grid Layout */
.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    /* Increased gap for better tile separation */
}

.calendar-day {
    background: var(--white);
    min-height: 100px;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    /* Visible border for definition */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    /* Slight depth */
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.calendar-day:hover:not(.empty) {
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.calendar-day.empty {
    background: #f8fafc;
    /* Subtle grey for empty days */
    border: 1px dashed #cbd5e1;
    /* Dashed border to clear definition */
    box-shadow: none;
}

.day-number-wrapper {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 6px;
}

.day-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
}

.calendar-day.today .day-number {
    background: var(--primary-green);
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

/* Event Chips */
.calendar-event {
    font-size: 0.75rem;
    padding: 5px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border: 1px solid transparent;
}

.calendar-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.event-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.event-amount {
    font-weight: 700;
    opacity: 0.9;
}

.calendar-event.work {
    background: #ecfdf5;
    /* Light emerald */
    color: #065f46;
    /* Dark emerald text */
    border-color: #d1fae5;
}

.calendar-event.income {
    background: #eff6ff;
    /* Light blue */
    color: #1e40af;
    /* Dark blue text */
    border-color: #dbeafe;
}

.calendar-event.expense {
    background: #fef2f2;
    /* Light red */
    color: #991b1b;
    /* Dark red text */
    border-color: #fee2e2;
}

.calendar-total {
    font-size: 0.8rem;
    font-weight: 700;
    text-align: right;
    margin-top: auto;
    padding: 4px 8px;
    border-radius: 6px;
    align-self: flex-end;
}

.calendar-total.net-positive {
    color: #065f46;
    background: #ecfdf5;
}

.calendar-total.net-negative {
    color: #991b1b;
    background: #fef2f2;
}

.calendar-total.net-neutral {
    color: var(--text-muted);
    background: #f8fafc;
}

.summary-stats-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9fdf9;
    border-radius: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-green);
}

/* Data Table */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    background: #fafafa;
}

.data-table tr:hover {
    background-color: #fbfdfb;
}

/* Documents Split View */
.docs-split-view {
    display: flex;
    gap: 2rem;
}

.docs-column {
    flex: 1;
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.docs-column h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-green);
}

.docs-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.upload-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.doc-select {
    width: auto;
}

.doc-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #fbfdfb;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
}

.doc-item:hover {
    border-color: var(--light-green);
}

/* =============================================
   COMPREHENSIVE MOBILE RESPONSIVENESS
   ============================================= */

/* --- Small screens: up to 768px --- */
@media (max-width: 768px) {

    /* Body: allow vertical scroll, prevent horizontal overflow */
    body {
        overflow: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
    }

    /* App container: allow natural height & scrolling */
    .app-container {
        flex-direction: column;
        height: auto !important;
        min-height: 100vh;
        overflow: visible !important;
        padding-bottom: 160px !important;
        /* Increased for FAB and Bottom Nav clearance */
    }

    /* Main content must scroll freely */
    .main-content {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
        max-height: none !important;
        flex: 1;
        padding-bottom: 60px !important;
        /* Extra inner padding to ensure list items are visible */
    }

    /* Dashboard: remove fixed-height and overflow:hidden that clips content */
    #dashboard {
        overflow: visible !important;
        min-height: auto !important;
        padding: 1rem !important;
        padding-bottom: 80px !important;
        /* Ensure CTA isn't covered */
    }

    /* All tab sections: no overflow clipping */
    .tab-content,
    .tab-content.active,
    section[id] {
        overflow: visible !important;
        height: auto !important;
    }

    /* Logo: reset absolute positioning that blocks tap events */
    .logo {
        position: static !important;
        transform: none !important;
        order: -1;
        display: flex !important;
        align-items: center !important;
        gap: 0.3rem !important;
        /* Move lettering closer */
    }

    .logo h1 {
        font-size: 1.1rem !important;
    }

    .logo img {
        height: 32px !important;
        margin-right: 0px !important;
        /* Removed margin to use gap exclusively */
    }

    /* Modal overlay: ensure proper display and scrollability */
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        display: flex;
        justify-content: center;
        align-items: flex-end !important;
        padding: 0 !important;
        z-index: 3000 !important;
        /* Higher z-index to stay above bottom nav */
        backdrop-filter: blur(5px);
        transition: opacity 0.3s ease;
    }

    .modal-overlay.hidden {
        display: none !important;
        opacity: 0;
        pointer-events: none !important;
    }

    .modal-overlay .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 24px 24px 0 0 !important;
        max-height: 88vh !important;
        overflow-y: auto !important;
        margin: 0;
        padding: 1.5rem;
    }

    /* Modal (non-overlay type) */
    .modal .modal-content {
        border-radius: 20px !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        width: 95% !important;
        padding: 1.25rem;
    }

    /* Invoice Modal Header Optimizations for Mobile */
    .invoice-modal-content .modal-header {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
        margin-bottom: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .invoice-modal-content .modal-header h3 {
        font-size: 1.2rem !important;
        margin: 0 !important;
    }

    .invoice-modal-content .modal-header>div {
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 8px !important;
    }

    .invoice-modal-content .modal-header .btn {
        flex: 1;
        padding: 0.6rem 0.4rem !important;
        font-size: 0.8rem !important;
        min-height: 44px;
        /* Better for touch */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Ensure close button is accessible */
    .invoice-modal-content .close-btn {
        position: relative;
        right: 0;
        top: 0;
        padding: 10px;
    }

    /* Prevent bottom nav from blocking footer buttons */
    .modal-overlay .modal-footer {
        padding-bottom: 2rem !important;
        flex-direction: column-reverse;
        /* Stack buttons if needed */
    }

    .modal-overlay .modal-footer .btn {
        width: 100%;
    }

    /* ---- TOP HEADER ---- */
    .app-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
        position: sticky;
        top: 0;
        justify-content: space-between;
    }


    /* Hide text labels on header buttons, keep emoji */
    .logout-icon-btn span:not(.icon) {
        display: none;
    }

    .logout-icon-btn {
        padding: 0.5rem 0.7rem;
        font-size: 1.1rem;
    }

    /* Header right-side buttons: tighten the flex */
    .app-header>div:last-child {
        gap: 0.4rem;
    }

    /* Hide trial badge on very small widths to give room */
    #trial-indicator {
        display: none !important;
    }

    /* Hide the digital clock to save space */
    #digital-clock {
        display: none;
    }

    /* ---- BOTTOM NAVIGATION ---- */
    .bottom-nav {
        bottom: 10px;
        width: calc(100% - 20px);
        height: 64px;
        border-radius: 18px;
        padding: 0 4px;
    }

    .nav-icon {
        font-size: 1.2rem;
    }

    .nav-text {
        font-size: 0.65rem;
    }


    .tab-content {
        padding: 1rem 0.75rem;
    }

    /* ---- SECTION HEADERS ---- */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .section-header h2 {
        font-size: 1.6rem !important;
    }

    .section-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* padding handled above */
    #dashboard {
        padding: 1rem !important;
    }

    #dashboard .section-header h2 {
        font-size: 1.8rem !important;
        text-align: left;
    }

    /* ---- STATS GRID (Dashboard Cards) ---- */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .glass-card {
        padding: 1.5rem;
        min-height: 160px;
    }

    .glass-card .stat-value {
        font-size: 2.5rem;
    }

    .card-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    /* ---- FORMS ---- */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row .form-group {
        flex: none;
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* ---- CARDS (general) ---- */
    .card,
    .calculator-card,
    .settings-card {
        padding: 1.25rem;
    }

    /* ---- BUDGET TAB ---- */
    .budget-summary-card {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .budget-stats-grid {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Budget two-column grid becomes single column */
    .grid-2-col {
        grid-template-columns: 1fr !important;
        gap: 1.25rem;
    }

    /* Budget navigation bar */
    #budget .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    /* ---- CALENDAR ---- */
    .calendar-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .calendar-grid {
        grid-template-columns: repeat(7, minmax(40px, 1fr));
        /* Slightly larger min-width */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 2px;
    }

    .calendar-grid-header {
        font-size: 0.7rem;
    }

    .calendar-day {
        min-height: 48px;
        padding: 2px;
        font-size: 0.65rem;
    }

    .calendar-event {
        font-size: 0.55rem;
        padding: 1px 2px;
    }

    .day-number {
        font-size: 0.75rem;
    }

    .cal-select {
        font-size: 0.85rem;
        min-width: auto !important;
        padding: 0.3rem 0.5rem;
    }

    /* ---- ANALYTICS TAB ---- */
    .stats-section .card {
        padding: 1rem;
    }

    .stats-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }

    .summary-stats-row {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .filter-controls {
        flex-wrap: wrap;
    }

    /* Analytics date filter row */
    .filter-controls>div {
        flex-wrap: wrap;
    }

    /* ---- DATA TABLES ---- */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th,
    .data-table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
    }

    /* ---- CLIENTS TAB ---- */
    .clients-list-container {
        gap: 0.75rem;
    }

    .client-bar {
        grid-template-columns: 1fr auto;
        padding: 1rem;
        gap: 0.75rem;
    }

    .client-bar .client-email,
    .client-bar .client-phone,
    .client-bar .client-revenue-group {
        display: none;
    }

    /* ---- DOCUMENTS TAB ---- */
    .docs-split-view {
        flex-direction: column;
        gap: 1.25rem;
    }

    .upload-controls {
        flex-direction: column;
        gap: 0.75rem;
    }

    .doc-select {
        width: 100%;
    }

    /* ---- SETTINGS TAB ---- */
    .settings-tabs {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }

    .settings-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    /* ---- MODALS ---- */
    .modal-content {
        width: 96%;
        padding: 1.25rem;
        border-radius: 16px;
        max-height: 95vh;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .modal-footer .btn {
        width: 100%;
    }

    /* ---- NOTIFICATIONS ---- */
    .notification-container {
        top: auto;
        bottom: 100px;
        right: 12px;
        left: 12px;
    }

    .notification-popup {
        min-width: unset;
        width: 100%;
        padding: 1rem 1.25rem;
    }

    /* ---- INVOICES ---- */
    #invoice-paper {
        padding: 1rem !important;
        width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box;
    }

    .invoice-table {
        font-size: 0.75rem !important;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 0.5rem !important;
    }

    .invoice-table td.editable-field {
        word-break: break-word;
        white-space: normal;
        min-width: 120px;
    }

    .invoice-total {
        font-size: 1.25rem !important;
    }

    .invoice-header {
        flex-direction: column;
        gap: 1rem;
    }

    .invoice-details-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .invoice-title {
        font-size: 2rem;
    }

    /* ---- MISC ---- */
    .activity-item {
        padding: 1rem;
        gap: 0.75rem;
    }

    .activity-amount {
        font-size: 0.95rem;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* --- Extra small: up to 400px --- */
@media (max-width: 400px) {
    .bottom-nav {
        height: 58px;
    }

    .nav-text {
        display: none;
    }

    .nav-icon {
        font-size: 1.4rem;
    }

    .glass-card .stat-value {
        font-size: 2rem;
    }

    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 24px;
    width: 95%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    position: relative;
    max-height: 90vh;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.03em;
}

.modal-footer {
    margin-top: 2.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Notification Popup */
.notification-container {
    position: fixed;
    top: 32px;
    right: 32px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.notification-popup {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1.25rem 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 16px;
    transform: translateX(120%);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border-color);
    border-left: 6px solid var(--primary-green);
    min-width: 320px;
}

.notification-popup.show {
    transform: translateX(0);
}

.notification-icon {
    font-size: 1.75rem;
}

.notification-content h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
}

.notification-content p {
    margin: 4px 0 0 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}


/* Print Styles */

/* Recent Activity & Quick Actions */
.dashboard-section {
    margin-top: 3.5rem;
}

.dash-section-title {
    color: var(--text-dark);
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.recent-activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
}

.activity-item:hover {
    transform: translateX(6px);
    border-color: var(--primary-green);
    box-shadow: var(--shadow-md);
}

.activity-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.icon-income {
    background: hsla(142, 71%, 45%, 0.1);
    color: var(--primary-green);
}

.icon-expense {
    background: hsla(0, 84%, 60%, 0.1);
    color: hsl(0, 84%, 60%);
}

.activity-details {
    flex: 1;
}

.activity-details h4 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-dark);
}

.activity-details small {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.activity-amount {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.amount-positive {
    color: var(--primary-green);
}

.amount-negative {
    color: hsl(0, 84%, 60%);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.25rem;
}

.action-btn {
    background: var(--white);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-dark);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
}

.action-btn:hover {
    border-color: var(--primary-green);
    color: var(--primary-green);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}


/* Toggle Switch Styles */
.recurring-wrapper {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.recurring-wrapper:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.recurring-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0 !important;
    width: 100%;
}

.toggle-checkbox {
    display: none;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background-color: #cbd5e1;
    border-radius: 20px;
    position: relative;
    transition: background-color 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background-color: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.toggle-checkbox:checked+.toggle-switch {
    background-color: var(--primary-green);
}

.toggle-checkbox:checked+.toggle-switch::after {
    transform: translateX(20px);
}

/* Invoices */


/* Invoices Hub Specifics */

/* --- Modal Styles (Added for Portal) --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* Semi-transparent overlay */
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    /* Must be > bottom-nav (1000) */
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-md);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--dark-green);
    margin-bottom: 0;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    margin-left: 1rem;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--primary-green);
}



/* Activity Feed Items */
.activity-item {
    transition: background 0.2s;
    border-radius: 8px;
}

.activity-item:hover {
    background: #f8fafc;
}

/* Client Card Specifics */
.client-card {
    flex: 1 1 300px;
    max-width: 350px;
    min-width: 250px;
    background: var(--white);
    border: 1px solid #ddd;
    /* More visible border */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.client-card:hover {
    border-color: var(--primary-green);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.client-card h3 {
    font-size: 1.25rem;
    color: var(--text-dark);
    margin-bottom: 0.2rem;
}

.client-card .role {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Client Avatar */
.client-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* View Mode Toggle (Dashboard) */
.view-mode-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 6px;
    border-radius: 20px;
    margin-left: 8px;
}

.toggle-label {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.2s;
    color: white;
}



/* Settings Section */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
    max-width: 800px;
}

.settings-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.settings-card h3 {
    margin-bottom: 1rem;
    color: var(--dark-green);
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

/* Invoices & Job Selection */
#invoice-paper {
    background: white;
    padding: 3rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    min-height: 800px;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#invoice-jobs-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
}

.job-invoice-check {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid var(--primary-green);
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

.invoice-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark-green);
}

.invoice-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.invoice-section h4 {
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    color: #666;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.editable-field {
    padding: 5px;
    border: 1px dashed transparent;
    border-radius: 4px;
    transition: all 0.2s;
}

.editable-field:hover {
    border-color: #ccc;
    background: #fffdf0;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

.invoice-table th {
    background: #f9f9f9;
    padding: 1rem;
    text-align: left;
    color: #555;
    font-size: 0.9rem;
}

.invoice-table td {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.invoice-total {
    text-align: right;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark-green);
    margin-top: 2rem;
}

#invoices-list .card:hover {
    border-color: var(--primary-green);
    background: #f0fdf4;
}

/* Utility: Hidden */
.hidden {
    display: none !important;
}

/* Gross/Net View Mode Toggle Specifics */
.view-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.7);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-left: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.toggle-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
}

.toggle-label.active {
    color: var(--primary-green);
    font-weight: 700;
}

.toggle-switch {
    width: 36px;
    height: 20px;
    background-color: var(--primary-green);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: background-color 0.3s ease;
}

/* Hide conflicting ::after from base toggle-switch class */
.view-mode-toggle .toggle-switch::after {
    display: none;
}

/* Base style for the knob inside toggle */
.toggle-knob {
    width: 16px;
    height: 16px;
    background-color: var(--white);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Modifiers for Gross mode (Assuming Gross is default and green) */
.view-mode-toggle:not(.net) .toggle-switch {
    background-color: var(--primary-green);
}

.view-mode-toggle:not(.net) .toggle-knob {
    transform: translateX(0);
}

/* Modifiers for Net mode */
.view-mode-toggle.net .toggle-switch {
    background-color: var(--secondary-blue);
}

.view-mode-toggle.net .toggle-knob {
    transform: translateX(16px);
    /* 36 - 16 - 4 = 16 */
}



/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.project-card {
    cursor: pointer;
    background: var(--white);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-green);
}

.project-card h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-dark);
}

.project-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-planning {
    background: #e0e7ff;
    color: #4338ca;
}

.badge-active {
    background: #dcfce7;
    color: #15803d;
}

.badge-on-hold {
    background: #fef3c7;
    color: #b45309;
}

.badge-completed {
    background: #f3f4f6;
    color: #374151;
}

.progress-container {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-green);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.phase-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.phase-item.completed {
    border-left: 4px solid var(--primary-green);
}

.phase-form-row {
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 15px;
}

.hidden {
    display: none !important;
}

/* Help Modal & Tour System */
.tour-highlight {
    position: relative;
    z-index: 9999 !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75), 0 0 15px rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    background: white;
    /* Ensure visibility */
    transition: all 0.3s ease;
}

#tour-tooltip {
    background: white;
    border-radius: 12px;
    padding: 20px;
    min-width: 280px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease;
}

#tour-tooltip::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

/* FAQ Accordion */
.faq-item {
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.faq-item h5:hover {
    text-decoration: underline;
}

/* Fix for tabs in help modal */
#help-modal .filter-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}


/* Tour Mode Overrides */
body.tour-active,
body.tour-active #dashboard,
body.tour-active .main-content,
body.tour-active .app-container {
    overflow: visible !important;
    z-index: auto !important;
    /* Prevent stacking context trapping */
    transform: none !important;
    perspective: none !important;
    filter: none !important;
}

/* Ensure highlights pop above everything */
.tour-highlight {
    z-index: 10000 !important;
    pointer-events: auto !important;
    position: relative;
}

/* Fallback for fixed elements */

.app-header.tour-highlight,
.bottom-nav.tour-highlight {
    z-index: 10001 !important;
}

/* Settings Tabs UI */
.settings-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: fit-content;
    overflow-x: auto;
    /* Allow scrolling on small screens */
    scrollbar-width: none;
    /* Hide scrollbar for Firefox */
}

.settings-tabs::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar for Chrome/Safari */
}

.settings-tab {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-tab:hover {
    color: var(--text-dark);
}

.settings-tab.active {
    color: var(--primary-green);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.settings-tab-content {
    animation: settingsFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes settingsFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Alphabet Bar Styling */
.alphabet-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    justify-content: center;
}

.alphabet-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.alphabet-btn:hover {
    background: var(--primary-green);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
}

.alphabet-btn.active {
    background: var(--primary-green);
    color: white;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
    border-color: var(--primary-green);
}

.alphabet-btn.all {
    width: auto;
    padding: 0 1rem;
}

[data-theme="dark"] .alphabet-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .alphabet-btn:hover {
    background: var(--primary-green);
}

/* Horizontal Client Bar Styling */
.clients-list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.client-bar {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr 100px;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    gap: 1.5rem;
}

.client-bar:hover {
    transform: translateX(8px);
    border-color: var(--primary-green);
    box-shadow: var(--shadow-md);
}

.client-info-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.client-bar h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-dark);
}

.client-bar .client-email,
.client-bar .client-phone {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-bar .client-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-green);
    margin-bottom: 2px;
    font-weight: 800;
}

.client-revenue-group {
    display: flex;
    flex-direction: column;
}

.client-revenue-group .client-revenue {
    font-weight: 700;
    color: var(--primary-green);
    font-size: 1rem;
}

.client-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.client-bar .client-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.7);
    color: #1a1a1a;
}

[data-theme="dark"] .client-bar .client-avatar {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .client-bar {
        grid-template-columns: 2fr 1.5fr 1fr;
    }

    .client-bar .client-phone {
        display: none;
    }
}

@media (max-width: 600px) {
    .client-bar {
        grid-template-columns: 1fr auto;
        padding: 1rem;
    }

    .client-bar .client-email {
        display: none;
    }
}

/* Monthly Overview - Premium Card */
.budget-summary-card {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--dark-green) 100%);
    color: white !important;
    padding: 1.5rem 2rem;
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: 0 20px 40px rgba(22, 163, 74, 0.25);
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
}

.budget-summary-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.budget-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.budget-card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.premium-btn-sm {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.premium-btn-sm:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.budget-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.85;
    margin-bottom: 6px;
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.budget-progress-wrapper {
    margin-top: auto;
}

.budget-progress-track {
    height: 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.budget-progress-fill {
    height: 100%;
    background: #ccff33;
    /* Vibrant lime */
    box-shadow: 0 0 15px rgba(204, 255, 51, 0.5);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.budget-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.9;
}

/* Card Over-Budget State */
.budget-summary-card.over-budget {
    background: linear-gradient(135deg, #dc2626 0%, #7f1d1d 100%);
    box-shadow: 0 20px 40px rgba(220, 38, 38, 0.25);
}

.budget-summary-card.over-budget .budget-progress-fill {
    background: #ff4d4d;
    box-shadow: 0 0 15px rgba(255, 77, 77, 0.5);
}

[data-theme="dark"] .budget-summary-card {
    background: linear-gradient(135deg, var(--dark-green) 0%, #064e3b 100%);
}

/* --- Digital Clock --- */
#digital-clock {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text-dark);
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

body.dark-mode #digital-clock {
    color: var(--text-dark);
    background: hsla(222, 47%, 6%, 0.5);
    border-color: var(--glass-border);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* --- Floating Currency Widget --- */
.floating-widget {
    position: fixed;
    bottom: 110px;
    /* Above bottom nav offset */
    right: 20px;
    z-index: 2000;
    /* Ensure it's above normal content but below modals */
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.floating-widget.expanded {
    width: 320px;
    height: auto;
    border-radius: var(--radius-md);
    bottom: 110px;
}

.floating-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    border-bottom: 1px solid transparent;
    transition: background 0.3s;
    flex-shrink: 0;
}

.floating-widget.expanded .floating-header {
    background: var(--primary-light);
    border-bottom: 1px solid var(--glass-border);
}

body.dark-mode .floating-widget.expanded .floating-header {
    background: hsla(var(--primary-h), var(--primary-s), 15%, 0.4);
}

.floating-header .icon {
    font-size: 1.6rem;
    margin-right: 12px;
}

.floating-header .label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    opacity: 0;
    width: 0;
    white-space: nowrap;
    transition: all 0.3s;
    overflow: hidden;
}

.floating-widget.expanded .floating-header .label {
    opacity: 1;
    width: auto;
    margin-right: auto;
}

.floating-header .toggle-icon {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.3s;
    opacity: 0;
    margin-left: auto;
}

.floating-widget.expanded .floating-header .toggle-icon {
    opacity: 1;
    transform: rotate(180deg);
}

.floating-body {
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s 0.1s;
    /* Delay for expand */
    transform: translateY(10px);
    display: none;
}

.floating-widget.expanded .floating-body {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block;
}

.floating-widget input,
.floating-widget select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-dark);
}

.converter-result {
    margin-top: 10px;
    text-align: right;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-green);
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* Desktop positioning adjustments */
@media (min-width: 768px) {
    .floating-widget {
        bottom: 40px;
        right: 40px;
    }

    .floating-widget.expanded {
        bottom: 40px;
    }

}

/* Subscription Overlay */
#subscription-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

#subscription-overlay.hidden {
    display: none !important;
    pointer-events: none;
}

.subscription-modal {
    background: var(--white);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    max-width: 450px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUpFade 0.4s ease-out;
}

/* Dark mode support */
body.dark-mode .subscription-modal {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.plan-details {
    margin: 2rem 0;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-green);
}

.plan-details .period {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.logout-link {
    margin-top: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

/* Invoice Status Badges */
.badge-pending {
    background: #fef3c7;
    color: #b45309;
}

.badge-overdue {
    background: #fee2e2;
    color: #dc2626;
}

.badge-paid {
    background: #dcfce7;
    color: #15803d;
}

/* Input with Currency Styling */
.input-with-currency {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-currency .currency-symbol {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-weight: 500;
    pointer-events: none;
}

.input-with-currency input {
    width: 100%;
    padding-left: 28px !important;
}

/* Receipt Scanner Animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.rotating {
    display: inline-block;
    animation: spin 1.5s linear infinite;
}

/* ==========================================
   AI Receipt Scanner Button — Premium Style
   ========================================== */
.ai-scan-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    background: var(--glass-bg, rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    /* Remove any inherited button reset */
    font-family: 'Outfit', sans-serif;
    position: relative;
    overflow: visible;
    clip-path: none;
}

/* Force Material Icons font — buttons reset font-family by default */
.ai-scan-btn .material-icons-round {
    font-family: 'Material Icons Round', 'Material Icons', sans-serif !important;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Subtle shimmer on the left edge */
.ai-scan-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
    background: linear-gradient(180deg, var(--primary-green), var(--accent-glow));
    opacity: 0.85;
}

.ai-scan-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: hsl(var(--primary-h), var(--primary-s), 70%);
    background: rgba(255, 255, 255, 0.9);
}

body.dark-mode .ai-scan-btn:hover {
    background: hsla(222, 47%, 14%, 0.9);
    border-color: hsl(var(--primary-h), var(--primary-s), 35%);
}

.ai-scan-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Icon badge */
.ai-scan-btn__icon-wrap {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-green), var(--accent-glow));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px hsla(var(--primary-h), var(--primary-s), 45%, 0.35);
    transition: box-shadow 0.2s ease;
}

.ai-scan-btn__icon-wrap .material-icons-round {
    color: #ffffff;
    font-size: 1.25rem;
}

.ai-scan-btn:hover .ai-scan-btn__icon-wrap {
    box-shadow: 0 6px 18px hsla(var(--primary-h), var(--primary-s), 45%, 0.55);
}

/* Label stack */
.ai-scan-btn__label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-scan-btn__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.2;
}

.ai-scan-btn__sub {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* Chevron */
.ai-scan-btn__arrow {
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: transform 0.2s ease, color 0.2s ease;
    opacity: 0.6;
}

.ai-scan-btn:hover .ai-scan-btn__arrow {
    color: var(--primary-green);
    transform: translateX(3px);
    opacity: 1;
}

/* Loading state */
.ai-scan-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: hsla(var(--primary-h), var(--primary-s), 45%, 0.08);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary-green);
    font-family: 'Outfit', sans-serif;
}

.ai-scan-loading__icon {
    font-size: 1rem;
    animation: spin 1.5s linear infinite;
}
/* ===== PAYROLL PLANNER STYLES ===== */
.payroll-summary-strip {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.payroll-stat-card {
    flex: 1;
    min-width: 160px;
    background: var(--card-bg, #fff);
    border-radius: 12px;
    padding: 1.1rem 1.3rem;
    border: 1px solid var(--border-color, #eee);
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.payroll-stat-label { font-size: 0.82rem; color: #888; font-weight: 500; }
.payroll-stat-value { font-size: 1.4rem; font-weight: 800; color: var(--dark-green, #1a7a4a); }

.payroll-run-card {
    margin-bottom: 1rem;
    padding: 1.2rem 1.4rem;
    border-radius: 14px;
    border: 1px solid var(--border-color, #eee);
    background: var(--card-bg, #fff);
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
    transition: box-shadow .2s;
}
.payroll-run-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,.09); }
.payroll-run-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.9rem;
    gap: 0.8rem;
}
.payroll-run-client { font-size: 1.05rem; font-weight: 700; color: var(--text-primary, #222); }
.payroll-run-period { font-size: 0.83rem; color: #888; margin-top: 2px; }
.payroll-run-notes { font-size: 0.82rem; color: #aaa; margin-top: 4px; font-style: italic; }

.payroll-badge {
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.badge-paid { background: #d4edda; color: #1a7a4a; }
.badge-pending { background: #fff3cd; color: #856404; }

.payroll-run-amounts {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
    padding: 0.8rem 1rem;
    background: var(--bg-light, #f8f9fa);
    border-radius: 10px;
}
.payroll-run-amount-item { display: flex; flex-direction: column; gap: 2px; }
.payroll-run-amount-label { font-size: 0.78rem; color: #888; }
.payroll-run-amount-value { font-size: 1rem; font-weight: 600; }

.payroll-run-entries-summary { font-size: 0.82rem; color: #bbb; margin-bottom: 0.9rem; }
.payroll-run-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

/* Payroll calc totals in form */
.payroll-calc-totals {
    border: 1px solid var(--border-color, #eee);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 0.8rem;
    background: var(--bg-light, #f8f9fa);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.payroll-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}
.payroll-net-row {
    border-top: 1px solid var(--border-color, #eee);
    padding-top: 0.5rem;
    margin-top: 0.2rem;
}

@media (max-width: 600px) {
    .payroll-summary-strip { flex-direction: column; }
    .payroll-run-amounts { gap: 0.8rem; }
    .payroll-run-card { padding: 1rem; }
}

/* ===== DASHBOARD PAYROLL WIDGET & QUICK ACTIONS ===== */
.payroll-dash-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid var(--border-color, #eee);
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
    background: var(--card-bg, #fff);
    min-height: 70px;
}
.dash-payrun-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.4rem;
    border-bottom: 1px solid #f3f3f3;
    gap: 0.6rem;
    border-radius: 8px;
    transition: background 0.15s;
}
.dash-payrun-row:last-child { border-bottom: none; }
.dash-payrun-row:hover { background: #f9f9f9; }
.dash-payrun-info { display: flex; flex-direction: column; gap: 2px; }
.dash-payrun-client { font-size: 0.9rem; font-weight: 600; color: var(--text-primary, #222); }
.dash-payrun-period { font-size: 0.78rem; color: #aaa; }
.dash-payrun-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.dash-payrun-amount { font-size: 0.95rem; font-weight: 700; color: var(--dark-green, #1a7a4a); }
.dash-payroll-meta { margin-top: 0.2rem; }

/* Quick Actions Bar */
.quick-actions-bar {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
}
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-color, #eee);
    border-radius: 14px;
    background: var(--card-bg, #fff);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary, #333);
    min-width: 80px;
    flex: 1;
    transition: all 0.18s;
    box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.quick-action-btn:hover {
    background: linear-gradient(135deg, rgba(22,163,74,0.08), rgba(22,163,74,0.02));
    border-color: var(--primary-green, #16a34a);
    color: var(--primary-green, #16a34a);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(22,163,74,0.12);
}
.qa-icon { font-size: 1.4rem; line-height: 1; }

@media (max-width: 480px) {
    .quick-actions-bar { gap: 0.5rem; }
    .quick-action-btn { min-width: 60px; padding: 0.7rem 0.6rem; }
}
