/* css/app.css */
body.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-dark);
}


/* Sidebar */
.app-sidebar {
    width: 280px;
    height: 100vh;
    max-height: 100vh;
    background: rgba(18, 24, 38, 0.95);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.5rem;
    z-index: 50;
    backdrop-filter: blur(20px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.app-sidebar .logo {
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-height: min-content;
}

.nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.3);
    margin: 1.5rem 0 0.5rem 1rem;
    font-weight: 600;
}

.app-nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
}

.app-nav-item:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text-main);
}

.app-nav-item.active {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-light-blue);
    border: 1px solid rgba(34, 197, 94, 0.2);
    box-shadow: inset 0 0 20px rgba(34, 197, 94, 0.05);
}

.app-nav-item i {
    font-size: 1.3rem;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    flex: 0 0 auto;
}

/* Main Area */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}



/* Header */
.app-header {
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 3rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(10, 15, 26, 0.8);
    backdrop-filter: blur(15px);
    z-index: 40;
}

.header-greeting h2 {
    font-size: 1.5rem;
    font-weight: 600;
}
.header-greeting p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.app-search {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1.2rem;
    border-radius: 100px;
    width: 320px;
    transition: all 0.3s ease;
}

.app-search:focus-within {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(255,255,255,0.05);
}

.app-search input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    width: 100%;
    font-family: var(--font-body);
}

.app-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.notification-btn {
    position: relative;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s ease;
}

.notification-btn:hover { color: #fff; }

.notification-dot {
    position: absolute;
    top: -2px; right: -2px;
    width: 8px; height: 8px;
    background: var(--accent-purple);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-purple);
}

.app-profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
    overflow: hidden;
    border: 2px solid var(--bg-dark);
}

/* Content Area */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 3rem;
    position: relative;
    height: 0; /* critical: makes flex children fill remaining space */
    display: flex;
    flex-direction: column;
    /* Custom Scrollbar for inner app */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* Full-bleed layout (e.g. journal workspace) — no padding */
.app-content.no-pad {
    padding: 0;
    overflow: hidden;
}

.app-content::-webkit-scrollbar {
    width: 6px;
}
.app-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

/* Module Switching */
.module-section {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

.module-section.active {
    display: block;
    /* GSAP handles the opacity/transform */
}

/* Base Panel Style */
.panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.2, 0, 0.2, 1);
}

.panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.3), transparent);
    z-index: 1;
}

.panel:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Dashboard Specific Styles */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.dash-grid.two-col {
    grid-template-columns: 2fr 1fr;
}

.welcome-panel {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), rgba(22, 163, 74, 0.05));
    border-color: rgba(34, 197, 94, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.welcome-text h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.welcome-quote {
    max-width: 400px;
    font-style: italic;
    color: var(--accent-light-blue);
    border-left: 2px solid var(--accent-blue);
    padding-left: 1rem;
}

.stat-box {
    display: flex;
    flex-direction: column;
}
.stat-box .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.stat-box .val {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Mobile Bottom Navigation — ALWAYS hidden on desktop */
.mobile-bottom-nav {
    display: none;
}

/* ============================================
   MOBILE APP LAYOUT — Flex Column Approach
   ============================================ */
@media (max-width: 900px) {

    /* 1. Body: Locked container */
    body.app-layout {
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
        height: 100dvh !important;
        overflow: hidden !important;
        width: 100vw !important;
        margin: 0 !important;
        position: relative !important;
    }

    /* 2. Hide Sidebar */
    .app-sidebar {
        display: none !important;
    }

    /* 3. Main Area: Flex container */
    .app-main {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        width: 100% !important;
    }

    /* 4. Header: Fixed height */
    .app-header {
        height: 60px !important;
        padding: 0 1.25rem !important;
        flex-shrink: 0 !important;
        background: rgba(10, 15, 26, 0.8) !important;
        backdrop-filter: blur(15px) !important;
    }

    .header-greeting h2 {
        font-size: 1.1rem !important;
    }

    .header-greeting p,
    .app-search {
        display: none !important;
    }

    /* 5. Content Area: Scrollable */
    .app-content {
        flex: 1 !important;
        overflow-y: auto !important;
        padding: 1.5rem !important;
        padding-bottom: calc(1.5rem + 110px) !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* 6. Dashboard Grid: Collapse */
    .dash-grid,
    .dash-grid.two-col {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    .welcome-panel {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .welcome-quote {
        max-width: 100% !important;
        border-left: none !important;
        padding-left: 0 !important;
        padding-top: 1rem !important;
        border-top: 1px solid rgba(34, 197, 94, 0.2) !important;
    }

    /* 7. Bottom Navigation: Ultra-Premium Floating Tab Bar */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed !important;
        bottom: 24px !important;
        left: 20px !important;
        right: 20px !important;
        width: calc(100% - 40px) !important;
        height: 64px !important; /* Slightly slimmer for elegance */
        background: linear-gradient(180deg, rgba(13, 17, 28, 0.85) 0%, rgba(5, 8, 15, 0.95) 100%) !important;
        backdrop-filter: blur(20px) saturate(160%) !important;
        -webkit-backdrop-filter: blur(20px) saturate(160%) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 20px !important;
        justify-content: space-around !important;
        align-items: stretch !important; /* Stretch so items can center themselves */
        padding: 0 8px !important;
        z-index: 10000 !important;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6),
                    inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
        top: auto !important;
        margin: 0 auto !important;
    }

    .bottom-nav-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
        color: rgba(255, 255, 255, 0.35) !important;
        text-decoration: none !important;
        font-size: 0.55rem !important;
        font-weight: 700 !important;
        letter-spacing: 0.03em !important;
        text-transform: uppercase !important;
        flex: 1 !important;
        height: 100% !important;
        transition: all 0.3s ease !important;
        position: relative !important;
    }

    .bottom-nav-item i {
        font-size: 1.35rem !important;
        margin-top: 2px !important;
        transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    }

    .bottom-nav-item.active {
        color: #fff !important;
    }

    /* Active Pill Indicator (More subtle) */
    .bottom-nav-item.active::before {
        content: '' !important;
        position: absolute !important;
        top: 8px !important;
        bottom: 8px !important;
        left: 6px !important;
        right: 6px !important;
        background: rgba(34, 197, 94, 0.12) !important;
        border-radius: 14px !important;
        z-index: -1 !important;
        border: 1px solid rgba(34, 197, 94, 0.15) !important;
    }

    .nav-indicator {
        position: absolute !important;
        height: 48px !important;
        background: rgba(34, 197, 94, 0.12) !important;
        border: 1px solid rgba(34, 197, 94, 0.2) !important;
        border-radius: 14px !important;
        z-index: 0 !important;
        transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
        pointer-events: none !important;
    }

    .bottom-nav-item.active::before {
        display: none !important; /* Hide old static indicator */
    }
    .bottom-nav-item.center-action {
        flex: 1.1 !important;
    }

    .bottom-nav-item.center-action .center-btn {
        width: 48px !important;
        height: 48px !important;
        background: linear-gradient(135deg, #22c55e, #15803d) !important;
        border-radius: 16px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: #fff !important;
        font-size: 1.5rem !important;
        box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4) !important;
        transform: translateY(-6px) !important;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    }

    .bottom-nav-item.center-action:active .center-btn {
        transform: translateY(-4px) scale(0.9) rotate(90deg) !important;
    }
}

/* ── Notification Panel ── */
.app-profile { position: relative; }
.notif-panel {
    display: none;
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: 320px;
    background: rgba(13,17,28,0.97);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    backdrop-filter: blur(24px);
    box-shadow: 0 24px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
    z-index: 200;
    overflow: hidden;
}
@media (max-width: 768px) {
    .notif-panel {
        position: fixed;
        width: calc(100vw - 2rem);
        max-width: 360px;
        right: 1rem;
        top: 70px;
        max-height: 70vh;
        z-index: 9999;
    }
}
.notif-panel.open { display: block; }
.notif-header {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.2s;
    cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(255,255,255,0.03); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.notif-title { font-size: 0.9rem; font-weight: 500; color: #fff; margin-bottom: 2px; }
.notif-sub   { font-size: 0.78rem; color: var(--text-muted); }

/* ── Habit done state ── */
.habit-row.habit-done h4 { opacity: 0.4; text-decoration: line-through; transition: all 0.4s; }

/* ── Focus item ── */
.focus-item { transition: background 0.2s; cursor: pointer; border-radius: 8px; }
.focus-item:hover { background: rgba(255,255,255,0.02); }

/* ── Inspire button ── */
.inspire-btn { position: relative; transition: color 0.3s; }
.inspire-btn.inspired { color: var(--accent-gold) !important; }

/* ── Goal progress bar ── */
.goal-prog-fill { transition: width 1.4s cubic-bezier(0.22,1,0.36,1); }

/* ── Profile Dropdown ── */
.profile-menu-wrap { position: relative; }

.profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: 260px;
    background: rgba(13,17,28,0.98);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(28px);
    box-shadow: 0 28px 60px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.07);
    z-index: 300;
    overflow: hidden;
}
.profile-dropdown.open { display: block; }

.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1.2rem 1.25rem;
}
.pd-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.1);
}
.pd-name  { font-weight: 600; font-size: 0.95rem; color: #fff; margin-bottom: 3px; }
.pd-level { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

.pd-divider { height: 1px; background: var(--glass-border); margin: 0.25rem 0; }

.pd-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}
.pd-item i { font-size: 1.1rem; }
.pd-item:hover { background: rgba(255,255,255,0.04); color: #fff; }
.pd-logout { color: rgba(248,113,113,0.7); }
.pd-logout:hover { background: rgba(248,113,113,0.08); color: #f87171; }

/* ═══════════════════════════════════════════════════════════════
   HABIT ARCHITECTURE MODULE — Ultra-Premium Responsive Grid
   ═══════════════════════════════════════════════════════════════ */
.habits-header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}
.section-sub {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent-blue);
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.habits-header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    width: auto;
}
.habits-filter-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 0.4rem;
    border-radius: 16px;
    flex-wrap: wrap;
    backdrop-filter: blur(10px);
}
.habit-filter-chip {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.habit-filter-chip.active, .habit-filter-chip:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), inset 0 0 10px rgba(255, 255, 255, 0.05);
}
.new-habit-btn {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #fff;
    border: none;
    padding: 0.8rem 1.6rem;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 10px 25px rgba(34, 197, 94, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}
.new-habit-btn::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}
.new-habit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(34, 197, 94, 0.5);
}
.new-habit-btn:hover::after {
    opacity: 1;
}

/* Habits Grid */
.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    align-items: start;
}
.habit-card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), inset 0 0 30px rgba(255, 255, 255, 0.03);
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
}
.habit-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,0.06), transparent 40%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}
.habit-card:hover {
    transform: translateY(-6px) scale(1.01);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(255, 255, 255, 0.05);
}
.habit-card:hover::before {
    opacity: 1;
}

.habit-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.habit-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    backdrop-filter: blur(5px);
}
.badge-blue   { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); box-shadow: 0 0 15px rgba(34, 197, 94,0.15); }
.badge-purple { background: rgba(22, 101, 52, 0.15); color: #c084fc; border: 1px solid rgba(22, 101, 52, 0.3); box-shadow: 0 0 15px rgba(22, 101, 52,0.15); }
.badge-cyan   { background: rgba(16, 185, 129, 0.15); color: #67e8f9; border: 1px solid rgba(16, 185, 129, 0.3); box-shadow: 0 0 15px rgba(16, 185, 129,0.15); }
.badge-gold   { background: rgba(251, 191, 36, 0.15); color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.3); box-shadow: 0 0 15px rgba(251,191,36,0.15); }

.habit-opt-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0.4rem;
    border-radius: 50%;
}
.habit-opt-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

.habit-main-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.habit-title-area {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.habit-name {
    font-size: 1.35rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
}
.habit-schedule {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Big Checkmark Box */
.habit-check-box {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
    color: transparent;
    font-size: 1.5rem;
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.02);
}
.habit-check-box:hover {
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.08);
}
.habit-check-box.completed {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
    box-shadow: 0 0 25px rgba(34, 197, 94, 0.5), inset 0 0 15px rgba(255,255,255,0.3);
}
.habit-check-box.completed:hover {
    transform: scale(1.1) rotate(3deg);
    box-shadow: 0 0 35px rgba(34, 197, 94, 0.8), inset 0 0 20px rgba(255,255,255,0.4);
}

/* Stats Row */
.habit-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}
.h-stat {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.h-stat span {
    color: #fff;
    font-weight: 600;
}

/* Consistency Matrix */
.habit-matrix-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1.5rem;
}
.matrix-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}
.h-day-matrix {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.h-day-chip {
    flex: 1;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.h-day-chip:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.h-day-chip.completed {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: #93c5fd;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.25);
}
.h-day-chip.missed {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}
.h-day-chip.inactive {
    opacity: 0.4;
    cursor: not-allowed;
}
.h-day-chip.today {
    border: 2px solid var(--accent-gold);
    color: #fcd34d;
    box-shadow: 0 0 15px rgba(251,191,36,0.2);
}

/* ═══════════════════════════════════════════════════════════════
   FLAWLESS MOBILE RESPONSIVENESS (Smart Adaptations)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .habits-header-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }
    .habits-header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .habits-filter-group {
        flex: 1;
        overflow-x: auto;
        padding: 0.4rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .habits-filter-group::-webkit-scrollbar {
        display: none;
    }
    .habit-filter-chip {
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    .habits-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .habits-header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .habits-filter-group {
        width: 100%;
        justify-content: flex-start;
    }
    .new-habit-btn {
        width: 100%;
        justify-content: center;
        padding: 1rem;
    }
    .habit-card {
        padding: 1.5rem;
        border-radius: 20px;
        gap: 1.25rem;
    }
    .habit-name {
        font-size: 1.2rem;
    }
    .habit-check-box {
        width: 46px; height: 46px;
        border-radius: 14px;
        font-size: 1.3rem;
    }
    .habit-stats-row {
        padding: 0.85rem 1rem;
    }
    .h-stat {
        font-size: 0.8rem;
    }
    .h-day-chip {
        height: 34px;
        border-radius: 10px;
        font-size: 0.8rem;
    }
    .h-day-matrix {
        gap: 0.35rem;
    }
}

@media (max-width: 400px) {
    .habit-card {
        padding: 1.25rem;
    }
    .habit-stats-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }
    .h-day-chip {
        height: 30px;
        border-radius: 8px;
        font-size: 0.75rem;
    }
    .h-day-matrix {
        gap: 0.25rem;
    }
}
