/* ==========================================================================
   Mobile-First Custom Design System & Variables (Dr. Khalid Mobile App Canvas)
   ========================================================================== */

:root {
    --bg-primary: #f1f5f9;      /* Desktop --bg-main */
    --bg-secondary: #ffffff;    /* Desktop --bg-sidebar */
    --bg-card: #ffffff;         /* Desktop --bg-card */
    --bg-card-light: #e2e8f0;   /* Light gray border/hover */
    --border-color: #e2e8f0;    /* Desktop --border-color */
    
    --text-primary: #0f172a;    /* Desktop --text-primary */
    --text-secondary: #64748b;  /* Desktop --text-secondary */
    --text-muted: #94a3b8;      /* Desktop --text-muted */
    
    --theme-teal: #0f9f90;      /* Desktop --color-accent */
    --theme-teal-light: rgba(15, 159, 144, 0.1);
    
    --text-blue: #1d4ed8;       /* Desktop --color-info-text */
    --bg-blue: #dbeafe;         /* Desktop --color-info-light */
    --border-blue: rgba(29, 78, 216, 0.2);
    
    --text-purple: #7c3aed;     /* Purple accent */
    --bg-purple: rgba(124, 58, 237, 0.1);
    --border-purple: rgba(124, 58, 237, 0.2);
    
    --text-red: #b91c1c;        /* Desktop --color-danger-text */
    --bg-red: #fee2e2;          /* Desktop --color-danger-light */
    --border-red: rgba(185, 28, 28, 0.2);
    
    --text-teal: #047857;       /* Desktop --color-success-text */
    --bg-teal: #d1fae5;         /* Desktop --color-success-light */
    --border-teal: rgba(4, 120, 87, 0.2);
    
    --text-amber: #b45309;      /* Desktop --color-warning-text */
    --bg-amber: #fef3c7;        /* Desktop --color-warning-light */
    --border-amber: rgba(180, 83, 9, 0.2);
    
    --text-cyan: #0891b2;       /* Cyan accent */
    --bg-cyan: rgba(8, 145, 178, 0.1);
    --border-cyan: rgba(8, 145, 178, 0.2);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --shadow-premium: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets for mobile */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    height: 100vh;
    height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
}

html {
    height: 100vh;
    height: -webkit-fill-available;
}

/* ==========================================================================
   AUTHENTICATION SCREEN (LOGIN GATE)
   ========================================================================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-premium);
}

.login-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--theme-teal-light);
    color: var(--text-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 20px;
}

.login-card h2 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 22px;
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}

.login-form-group {
    text-align: left;
    margin-bottom: 20px;
}

.login-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.login-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
}

.login-input-wrapper input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: var(--transition-smooth);
}

.login-input-wrapper input:focus {
    border-color: var(--text-teal);
    box-shadow: 0 0 0 2px var(--theme-teal-light);
}

.login-error {
    color: var(--text-red);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: left;
    min-height: 18px;
}

.btn-login-submit {
    width: 100%;
    padding: 14px;
    background-color: var(--theme-teal);
    color: white;
    border: none;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-login-submit:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* ==========================================================================
   APP CONTAINER SHELL
   ========================================================================== */
.app-container {
    width: 100%;
    height: 100%;
    max-width: 480px; /* target mobile devices constraint */
    margin: 0 auto;
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: column;
    position: relative;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

/* Top App Bar */
.app-bar {
    height: 64px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-wrapper {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    overflow: hidden;
    background-color: var(--theme-teal-light);
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.greeting {
    font-size: 11px;
    color: var(--text-muted);
}

.username {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 13.5px;
}

.btn-app-bar-action {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.btn-app-bar-action:active {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Two-Row Grid Layout for Navigation */
.nav-tab-bar {
    height: auto !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 8px !important;
    background-color: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    box-sizing: border-box !important;
}

.nav-tab-bar::-webkit-scrollbar {
    display: none; /* Hide scrollbar Safari/Chrome */
}

.nav-tab {
    flex: 0 0 calc(20% - 6px) !important;
    height: 42px !important;
    display: flex !important;
    flex-direction: column !important; /* icon on top of text */
    justify-content: center !important;
    align-items: center !important;
    gap: 2px !important;
    padding: 4px !important;
    background-color: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    color: var(--text-secondary) !important;
    font-family: var(--font-heading) !important;
    font-weight: 600 !important;
    font-size: 10px !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Custom icon colors on navigation bar */
.nav-tab[data-section="home"] i { color: #0f9f90 !important; }
.nav-tab[data-section="tasks"] i { color: #3b82f6 !important; }
.nav-tab[data-section="calendar"] i { color: #6366f1 !important; }
.nav-tab[data-section="payments"] i { color: #8b5cf6 !important; }
.nav-tab[data-section="calls"] i { color: #ef4444 !important; }
.nav-tab[data-section="habits"] i { color: #06b6d4 !important; }
.nav-tab[data-section="diary"] i { color: #f59e0b !important; }
.nav-tab[data-section="loans"] i { color: #14b8a6 !important; }
.nav-tab[data-section="ideas"] i { color: #f97316 !important; }

/* Active States matching the specific category themes */
.nav-tab.active[data-section="home"] { background-color: rgba(15, 159, 144, 0.09) !important; border-color: #0f9f90 !important; color: #0f9f90 !important; }
.nav-tab.active[data-section="tasks"] { background-color: rgba(59, 130, 246, 0.09) !important; border-color: #3b82f6 !important; color: #3b82f6 !important; }
.nav-tab.active[data-section="calendar"] { background-color: rgba(99, 102, 241, 0.09) !important; border-color: #6366f1 !important; color: #6366f1 !important; }
.nav-tab.active[data-section="payments"] { background-color: rgba(139, 92, 246, 0.09) !important; border-color: #8b5cf6 !important; color: #8b5cf6 !important; }
.nav-tab.active[data-section="calls"] { background-color: rgba(239, 68, 68, 0.09) !important; border-color: #ef4444 !important; color: #ef4444 !important; }
.nav-tab.active[data-section="habits"] { background-color: rgba(6, 182, 212, 0.09) !important; border-color: #06b6d4 !important; color: #06b6d4 !important; }
.nav-tab.active[data-section="diary"] { background-color: rgba(245, 158, 11, 0.09) !important; border-color: #f59e0b !important; color: #f59e0b !important; }
.nav-tab.active[data-section="loans"] { background-color: rgba(20, 184, 166, 0.09) !important; border-color: #14b8a6 !important; color: #14b8a6 !important; }
.nav-tab.active[data-section="ideas"] { background-color: rgba(249, 115, 22, 0.09) !important; border-color: #f97316 !important; color: #f97316 !important; }

.nav-tab i {
    font-size: 13px !important;
    transition: transform 0.2s ease !important;
}

.nav-tab:active i {
    transform: scale(1.15);
}

/* Card and Board Quick-Add Buttons Styles */
.btn-card-add, .btn-board-add {
    background: rgba(20, 184, 166, 0.08) !important;
    border: 1px dashed var(--theme-teal) !important;
    color: var(--theme-teal) !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: all 0.2s ease !important;
}
.btn-card-add:active, .btn-board-add:active {
    transform: scale(0.9) !important;
    background: rgba(20, 184, 166, 0.18) !important;
}

/* Main Workspace Viewport */
.workspace-viewport {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

.view-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 16px;
    display: none;
    -webkit-overflow-scrolling: touch;
}

.view-panel.active {
    display: block;
}

/* ==========================================================================
   CARDS STACKED FEED (HOME VIEW)
   ========================================================================== */
.cards-feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 80px; /* Space for FAB */
}

.mobile-card {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 20px !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.02), 0 8px 10px -6px rgba(15, 23, 42, 0.02) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

/* Feature specific light pastel backgrounds and borders */
.mobile-card.card-tasks, .mobile-card.card-tasks:hover, .mobile-card.card-tasks:focus, .mobile-card.card-tasks:active { background-color: #dbeafe !important; border: 1px solid #93c5fd !important; }
.mobile-card.card-calendar, .mobile-card.card-calendar:hover, .mobile-card.card-calendar:focus, .mobile-card.card-calendar:active { background-color: #e0e7ff !important; border: 1px solid #a5b4fc !important; }
.mobile-card.card-payments, .mobile-card.card-payments:hover, .mobile-card.card-payments:focus, .mobile-card.card-payments:active { background-color: #ede9fe !important; border: 1px solid #d8b4fe !important; }
.mobile-card.card-calls, .mobile-card.card-calls:hover, .mobile-card.card-calls:focus, .mobile-card.card-calls:active { background-color: #fee2e2 !important; border: 1px solid #fca5a5 !important; }
.mobile-card.card-habits, .mobile-card.card-habits:hover, .mobile-card.card-habits:focus, .mobile-card.card-habits:active { background-color: #cffafe !important; border: 1px solid #67e8f9 !important; }
.mobile-card.card-diary, .mobile-card.card-diary:hover, .mobile-card.card-diary:focus, .mobile-card.card-diary:active { background-color: #fef3c7 !important; border: 1px solid #fcd34d !important; }
.mobile-card.card-loans, .mobile-card.card-loans:hover, .mobile-card.card-loans:focus, .mobile-card.card-loans:active { background-color: #dbeafe !important; border: 1px solid #93c5fd !important; }
.mobile-card.card-ideas, .mobile-card.card-ideas:hover, .mobile-card.card-ideas:focus, .mobile-card.card-ideas:active { background-color: #ffedd5 !important; border: 1px solid #fdba74 !important; }

/* Frosted glass style for inner rows inside tinted cards */
.mobile-card .list-item-row {
    background-color: rgba(255, 255, 255, 0.65) !important;
    border-color: rgba(0, 0, 0, 0.04) !important;
}

.mobile-card .card-header {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
}

.mobile-card .title-group h3 {
    font-family: var(--font-heading) !important;
    font-weight: 750 !important;
    font-size: 16px !important;
    color: var(--text-primary) !important;
}

.mobile-card .title-group p {
    font-size: 11px !important;
    color: var(--text-muted) !important;
}

.count-badge {
    padding: 4px 10px !important;
    border-radius: 8px !important;
    font-family: var(--font-heading) !important;
    font-weight: 700 !important;
    font-size: 12px !important;
}

.text-blue { background-color: var(--bg-blue) !important; color: var(--text-blue) !important; border: 1px solid var(--border-blue) !important; }
.text-purple { background-color: var(--bg-purple) !important; color: var(--text-purple) !important; border: 1px solid var(--border-purple) !important; }
.text-red { background-color: var(--bg-red) !important; color: var(--text-red) !important; border: 1px solid var(--border-red) !important; }
.text-teal { background-color: var(--bg-teal) !important; color: var(--text-teal) !important; border: 1px solid var(--border-teal) !important; }
.text-amber { background-color: var(--bg-amber) !important; color: var(--text-amber) !important; border: 1px solid var(--border-amber) !important; }
.text-cyan { background-color: var(--bg-cyan) !important; color: var(--text-cyan) !important; border: 1px solid var(--border-cyan) !important; }

.mobile-card .card-body {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

.btn-view-section {
    width: 100% !important;
    padding: 10px !important;
    background-color: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    color: var(--text-primary) !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

.btn-view-section:active {
    background-color: rgba(15, 159, 144, 0.05) !important;
    color: var(--theme-teal) !important;
    border-color: var(--theme-teal) !important;
    transform: scale(0.98) !important;
}

/* Lists and inner elements styling */
.list-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.list-item-label {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
}

.list-item-subtext {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================================================
   MINI CALENDAR COMPONENT
   ========================================================================== */
.mini-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.mini-cal-day-header {
    font-size: 9.5px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 2px 0;
}

.mini-cal-day-header:nth-child(6),
.mini-cal-day-header:nth-child(7) {
    color: var(--text-red);
}

.mini-cal-cell {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    padding: 4px 0;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: var(--transition-smooth);
}

.mini-cal-cell.today {
    background-color: var(--theme-teal-light) !important;
    color: var(--text-teal) !important;
    border: 1.5px solid var(--text-teal);
}

.mini-cal-cell.selected {
    background-color: var(--theme-teal) !important;
    color: white !important;
}

.mini-cal-cell.has-event::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 3.5px;
    height: 3.5px;
    border-radius: 50%;
    background-color: var(--text-teal);
}

.mini-cal-cell.selected.has-event::after {
    background-color: white;
}

.calendar-events-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

.calendar-events-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cal-arrows button {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
}

/* ==========================================================================
   PANEL INNER WORKSPACES (DETAILED VIEWS)
   ========================================================================== */
.panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sub-header {
    margin-bottom: 16px;
    flex-shrink: 0;
}

.sub-header h2 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 20px;
}

.scroll-content {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 90px; /* Space for FAB */
    -webkit-overflow-scrolling: touch;
}

/* Filter Chips */
.tasks-filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 8px 0 0 0;
}

.tasks-filter-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: 0 0 auto;
    padding: 6px 14px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.chip.active {
    background-color: var(--theme-teal);
    color: white;
    border-color: var(--theme-teal);
}

/* Stats Card Panel */
.stats-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 16px;
    margin-top: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .label {
    font-size: 11px;
    color: var(--text-muted);
}

.stat-item .value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
}

/* List view board layouts */
.list-view-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Component items styling */
.board-item-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: var(--transition-smooth);
}

.board-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.board-item-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.board-item-tag {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2.5px 8px;
    border-radius: 6px;
}

.board-item-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11.5px;
    color: var(--text-secondary);
}

/* Diary Detailed Flow Layout */
.diary-timeline-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    padding: 16px;
    z-index: 10;
}

.btn-back {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-sub-action {
    padding: 6px 12px;
    background-color: var(--theme-teal-light);
    color: var(--text-teal);
    border: none;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
}

.btn-sub-action:active {
    opacity: 0.8;
}

.search-row {
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
}

.search-input-wrapper input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13.5px;
    outline: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    accent-color: var(--theme-teal);
}

/* ==========================================================================
   FLOATING ACTION BUTTON (FAB) & MODALS
   ========================================================================== */
.quick-add-fab {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 28px;
    background-color: var(--theme-teal);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    z-index: 99;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-add-fab:active {
    transform: scale(0.9);
}

/* Bottom Sheet / Modal Panel Overlay */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(9, 13, 22, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 480px;
    background-color: var(--bg-secondary);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    border: 1px solid var(--border-color);
    border-bottom: none;
    box-shadow: var(--shadow-premium);
    padding: 24px;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.1, 0.76, 0.55, 0.94);
}

.modal.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 18px;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    font-family: var(--font-sans);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--text-teal);
}

.modal-footer-btns {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.btn-modal-save {
    flex-grow: 1;
    padding: 14px;
    background-color: var(--theme-teal);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
}

.btn-modal-delete {
    padding: 14px 20px;
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--text-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

/* Settings view panels styles */
.settings-section {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
}

.settings-section h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 13.5px;
    margin-bottom: 4px;
}

.settings-btns-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-settings-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

/* Starred Item Toggle Style */
.star-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}

.star-btn.starred {
    color: #f59e0b; /* Gold star */
}

/* Mobile Loans Panel Refinements */
.loans-section {
    background-color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    padding: 12px;
}

.loan-progress-container {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.loan-progress-bar {
    height: 6px;
    background-color: var(--border-color, #e2e8f0);
    border-radius: 3px;
    overflow: hidden;
}

.loan-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--text-teal, #0d9488), var(--text-blue, #2563eb));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.loan-progress-text {
    font-size: 11px;
    color: var(--text-secondary);
}

.loan-payment-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0,0,0,0.06);
}

.loan-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

.loan-input-prefix {
    position: absolute;
    left: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.pay-amount-input {
    width: 100%;
    padding: 6px 6px 6px 18px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    border: 1px solid var(--border-color, #cbd5e1) !important;
}

.pay-date-input {
    width: 100px;
    padding: 6px !important;
    font-size: 11px !important;
    border-radius: 8px !important;
    border: 1px solid var(--border-color, #cbd5e1) !important;
}

.pay-btn-action {
    background-color: var(--text-teal, #0f766e) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 6px 12px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    cursor: pointer;
}

.loan-ledger-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.loan-ledger-title {
    font-size: 12px;
    color: var(--text-primary);
}

.loan-ledger-meta {
    font-size: 10px;
    color: var(--text-secondary);
    display: block;
}

/* Red Blinking Animation for Current Month Due Payments */
@keyframes red-blink-anim {
    0% { color: #ef4444; opacity: 1; }
    50% { color: #ef4444; opacity: 0.25; }
    100% { color: #ef4444; opacity: 1; }
}

.red-blinking {
    color: #ef4444 !important;
    animation: red-blink-anim 1.2s infinite ease-in-out !important;
    font-weight: 700;
}
