:root {
    /* Color Palette - Green Theme */
    --primary-color: #00796B;
    --primary-dark: #004D40;
    --primary-light: #009688;
    --accent-color: #00897B;

    --bg-primary: #F5F5F5;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #FAFAFA;
    --bg-header: #00796B;

    --text-primary: #212121;
    --text-secondary: #757575;
    --text-tertiary: #9E9E9E;
    --text-white: #FFFFFF;

    --success-color: #4CAF50;
    --danger-color: #F44336;
    --warning-color: #FF9800;

    --border-color: #E0E0E0;
    --divider-color: #EEEEEE;

    --give-color: #4CAF50;
    --receive-color: #F44336;

    /* Typography */
    --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* PWA Polish */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    /* Disable iOS default context menu */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    overscroll-behavior: none;
}

/* Disable selection for better mobile feel */
.ledger-item,
.transaction-item,
.btn {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Active/Touch Feedback */
.btn:active,
.ledger-item:active,
.transaction-item:active,
.nav-item:active,
.context-menu-item:active,
.fab:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.btn {
    position: relative;
    overflow: hidden;
}

/* Ripple effect for buttons */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* Allow selection in inputs and specific text for copying */
input,
textarea,
.ledger-phone,
.transaction-amount {
    user-select: text;
    -webkit-user-select: text;
    -webkit-touch-callout: default;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* App Container */
#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-secondary);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Page transition animations */
.page-enter {
    animation: pageSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pageSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Header */
.app-header {
    background: var(--bg-header);
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.header-title {
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.account-icon {
    font-size: 1.4rem;
    background: rgba(255, 255, 255, 0.2);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.header-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.header-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-white);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    transition: background var(--transition-fast);
}

.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Account Selector */
.account-selector {
    position: relative;
}

.account-selector-btn {
    background: transparent;
    border: none;
    color: var(--text-white);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-base);
    transition: background var(--transition-fast);
}

.account-selector-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.account-dropdown {
    position: absolute;
    top: calc(100% + var(--spacing-xs));
    right: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.account-dropdown.active {
    display: block;
}

.account-dropdown-item {
    padding: var(--spacing-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.account-dropdown-item:last-child {
    border-bottom: none;
}

.account-dropdown-item:hover {
    background: var(--bg-tertiary);
}

/* Main Content */
.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-primary);
}

/* Summary Cards - Compact, Colorful & Collapsible */
.summary-section {
    position: sticky;
    top: 0;
    z-index: 90;
    background: #00796b;
    padding: var(--spacing-md);
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
}

.summary-balance-card {
    background: linear-gradient(135deg, #00796B 0%, #009688 100%);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-sm);
}

.summary-balance-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.summary-balance-card:active {
    transform: scale(0.98);
}

.summary-balance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.summary-balance-label {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-toggle-icon {
    font-size: var(--font-size-lg);
    transition: transform var(--transition-base);
}

.summary-toggle-icon.expanded {
    transform: rotate(180deg);
}

.summary-balance-amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin-top: var(--spacing-sm);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.summary-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base);
}

.summary-details.expanded {
    max-height: 200px;
}

.summary-row {
    display: flex;
    gap: var(--spacing-sm);
    padding-top: var(--spacing-sm);
}

.summary-card {
    flex: 1;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.summary-card.give {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    border-bottom-left-radius: 30px;
}

.summary-card.receive {
    background: linear-gradient(135deg, #F44336 0%, #EF5350 100%);
    border-bottom-right-radius: 30px;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
    pointer-events: none;
}

.summary-card .summary-label {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card .summary-amount {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Search Bar with Sort */
.search-section {
    position: sticky;
    top: 0;
    z-index: 89;
    padding: var(--spacing-md);
    background: var(--bg-primary);
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.search-wrapper {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: var(--spacing-md);
    padding-right: 40px;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    outline: none;
    transition: border-color var(--transition-fast);
}

.search-input:focus {
    border-color: var(--primary-color);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: var(--font-size-lg);
    cursor: pointer;
    padding: var(--spacing-sm);
    display: none;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.search-clear-btn.visible {
    display: block;
}

.search-clear-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sort-btn {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: var(--font-size-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 48px;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.sort-btn:active {
    transform: scale(0.95);
}

/* Sort Menu */
.sort-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid var(--border-color);
    display: none;
}

.sort-menu.active {
    display: block;
}

.sort-menu-item {
    padding: var(--spacing-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.sort-menu-item:hover {
    background: var(--bg-tertiary);
}

.sort-menu-item.active {
    background: rgba(0, 121, 107, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

/* Ledger List - Scrollable with Card Layout */
.ledger-list {
    background: var(--bg-primary);
    padding: var(--spacing-md);
    padding-bottom: 80px; /* Extra padding to show last ledger above FAB and bottom nav */
    overflow-y: auto;
    max-height: calc(100vh - 56px);
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.ledger-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-secondary);
    position: relative;
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-sm);
    box-shadow: var(--shadow-sm);
    animation: itemFadeIn 0.3s ease backwards;
}

@keyframes itemFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ledger-item:nth-child(1) { animation-delay: 0.05s; }
.ledger-item:nth-child(2) { animation-delay: 0.1s; }
.ledger-item:nth-child(3) { animation-delay: 0.15s; }
.ledger-item:nth-child(4) { animation-delay: 0.2s; }
.ledger-item:nth-child(5) { animation-delay: 0.25s; }

.ledger-item.pinned {
    background: linear-gradient(90deg, rgba(0, 121, 107, 0.05) 0%, var(--bg-secondary) 100%);
    border-left: 3px solid var(--primary-color);
    box-shadow: var(--shadow-md);
}

.ledger-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.ledger-item:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-sm);
}

.ledger-pin-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    color: var(--primary-color);
}

.ledger-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-white);
    margin-right: var(--spacing-md);
    flex-shrink: 0;
}

.ledger-info {
    flex: 1;
    min-width: 0;
}

.ledger-name {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ledger-phone {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.ledger-balance {
    text-align: right;
    flex-shrink: 0;
}

.ledger-balance-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.ledger-balance-amount {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.ledger-balance-amount.receive {
    color: var(--receive-color);
}

.ledger-balance-amount.give {
    color: var(--give-color);
}

/* Chat/Transaction View */
.chat-header {
    background: var(--bg-header);
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: var(--shadow-md);
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: var(--font-size-xl);
    cursor: pointer;
    padding: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition-fast);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-header-info {
    flex: 1;
}

.chat-header-name {
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: var(--text-white);
}

.chat-header-balance {
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-xs);
    color: rgba(255, 255, 255, 0.9);
}

.chat-header-balance.receive {
    color: #FFCDD2;
}

.chat-header-balance.give {
    color: #C8E6C9;
}

/* Transaction List */
.transaction-list {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md);
    padding-bottom: 100px; /* Extra padding to show last transaction above action buttons */
    gap: var(--spacing-sm);
    min-height: 100%;
    background: var(--bg-primary);
}

.transaction-date-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.transaction-date {
    text-align: center;
    margin: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.transaction-date-label {
    display: inline-block;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    box-shadow: var(--shadow-sm);
}

.transaction-item {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--spacing-md);
    width: 80%;
    animation: itemFadeIn 0.3s ease backwards;
    /* Requested 80% width */
}

.transaction-item.got {
    align-self: flex-start;
}

.transaction-item.gave {
    align-self: flex-end;
}

.transaction-bubble {
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    position: relative;
    width: 100%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.transaction-bubble:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}

.transaction-item.got .transaction-bubble {
    background: var(--bg-secondary);
    border-bottom-left-radius: var(--spacing-xs);
}

.transaction-item.gave .transaction-bubble {
    background: #E8F5E9;
    border-bottom-right-radius: var(--spacing-xs);
}

.transaction-amount {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.transaction-balance-badge {
    font-size: var(--font-size-xs);
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.05);
}

.transaction-balance-badge.positive {
    color: var(--receive-color);
    background: rgba(76, 175, 80, 0.1);
}

.transaction-balance-badge.negative {
    color: var(--give-color);
    background: rgba(244, 67, 54, 0.1);
}

.transaction-item.got .transaction-amount {
    color: var(--give-color);
}

.transaction-item.gave .transaction-amount {
    color: var(--text-primary);
}

.transaction-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    word-wrap: break-word;
}

.transaction-payment-method {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-sm);
    text-transform: capitalize;
}

.transaction-divider {
    border: none;
    border-top: 1px solid var(--divider-color);
    margin: var(--spacing-sm) 0;
}

.transaction-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

/* Transaction Action Buttons */
.transaction-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--spacing-md);
    z-index: 100;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.action-btn {
    flex: 1;
    padding: var(--spacing-md);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.action-btn.got {
    background: var(--give-color);
    color: white;
}

.action-btn.gave {
    background: var(--receive-color);
    color: white;
}

.action-btn:active {
    transform: scale(0.98);
}

/* Bottom Navigation - Professional */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    z-index: 100;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
    height: auto;
    min-height: 64px;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    text-decoration: none;
    position: relative;
    border-radius: var(--radius-md);
    margin: 0 4px;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 32px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 0 0 3px 3px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item.active::before {
    transform: translateX(-50%) scaleX(1);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item:active {
    transform: scale(0.95);
    background: var(--bg-tertiary);
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
    font-weight: 500;
}

/* Context Menu Backdrop */
.context-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999;
    animation: fadeIn 0.2s ease;
}

/* Context Menu for Edit/Delete */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    min-width: 180px;
    z-index: 1001;
    overflow: hidden;
    border: 1px solid var(--border-color);
    animation: contextMenuSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: top center;
}

@keyframes contextMenuSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.context-menu-item {
    padding: 14px 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    font-weight: 500;
    border-bottom: 1px solid var(--divider-color);
}

.context-menu-item:last-child {
    border-bottom: none;
}

.context-menu-item:active {
    transform: scale(0.98);
}

.context-menu-item:hover {
    background: var(--bg-tertiary);
}

.context-menu-item.danger {
    color: var(--danger-color);
}

.context-menu-item.danger:hover {
    background: rgba(244, 67, 54, 0.08);
}

.context-menu-item.danger:active {
    background: rgba(244, 67, 54, 0.15);
}

/* Transaction Balance Badge */
.transaction-balance-badge {
    display: inline-block;
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-left: var(--spacing-xs);
}

.transaction-balance-badge.positive {
    background: rgba(76, 175, 80, 0.1);
    color: var(--give-color);
}

.transaction-balance-badge.negative {
    background: rgba(244, 67, 54, 0.1);
    color: var(--receive-color);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 80px;
    right: var(--spacing-lg);
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 121, 107, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 99;
    animation: fabEntrance 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s backwards;
}

@keyframes fabEntrance {
    from {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(0, 121, 107, 0.5);
}

.fab:active {
    transform: scale(0.95) rotate(90deg);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    will-change: transform;
    animation: modalSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.3);
    /* Safe area for newer iPhones */
    padding-bottom: env(safe-area-inset-bottom);
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-xl);
    cursor: pointer;
    padding: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.modal-close:hover {
    background: var(--bg-tertiary);
}

.modal-body {
    padding: var(--spacing-lg);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(0, 121, 107, 0.1);
    transform: translateY(-1px);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    cursor: pointer;
}

/* Fix for mobile date inputs and decimal numbers */
input[type="date"] {
    min-height: 48px;
    display: block;
    -webkit-appearance: none;
    appearance: none;
    width: 100% !important;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Buttons */
.btn {
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.3px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(0, 121, 107, 0.3);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #43A047 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #E53935 100%);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
}

.btn:active {
    transform: scale(0.98);
}

/* Auth Page */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

.auth-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}

.auth-logo {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.auth-logo-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
}

.auth-logo-text {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--primary-color);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
}

.country-select-group {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.country-code-select {
    width: 120px;
}

.phone-input {
    flex: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-lg);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.empty-state-text {
    font-size: var(--font-size-sm);
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

/* Loading Spinner */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid var(--primary-color);
    border-radius: var(--radius-full);
    width: 50px;
    height: 50px;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

.mt-3 {
    margin-top: var(--spacing-lg);
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

.mb-3 {
    margin-bottom: var(--spacing-lg);
}

/* Responsive Design */
@media (max-width: 768px) {
    .summary-card {
        min-width: 140px;
    }
}

@media (min-width: 769px) {
    #app {
        border-left: 1px solid var(--border-color);
        border-right: 1px solid var(--border-color);
    }
}

/* Profile Page Styles */
.profile-content {
    background: var(--bg-primary);
    padding: var(--spacing-md);
    padding-bottom: 80px;
    overflow-y: auto;
    max-height: calc(100vh - 56px);

}

.profile-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-md);
    overflow: hidden;

}

.profile-card-header {
    background: linear-gradient(135deg, #00796B 0%, #009688 100%);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);

}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);

}

.profile-user-info {
    flex: 1;

}

.profile-user-name {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: white;
    margin-bottom: var(--spacing-xs);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);

}

.profile-user-email {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.9);

}

.profile-card-title {
    padding: var(--spacing-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--divider-color);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);

}

.profile-card-title span {
    font-size: var(--font-size-lg);

}

.profile-card-body {
    padding: var(--spacing-md);

}

.profile-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;

}

.profile-info-item:not(:last-child) {
    border-bottom: 1px solid var(--divider-color);

}

.profile-info-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);

}

.profile-info-value {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);

}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    border-radius: var(--radius-md);

}

.profile-menu-item:not(:last-child) {
    margin-bottom: var(--spacing-xs);

}

.profile-menu-item:hover {
    background: var(--bg-tertiary);

}

.profile-menu-item:active {
    transform: scale(0.98);

}

.profile-menu-icon {
    font-size: var(--font-size-2xl);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);

}

.profile-menu-text {
    flex: 1;

}

.profile-menu-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;

}

.profile-menu-subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);

}

.profile-menu-arrow {
    font-size: var(--font-size-2xl);
    color: var(--text-tertiary);

}

.profile-logout-btn {
    margin-top: var(--spacing-md);
    font-weight: 600;
}

/* Spinner & Loading */
.spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 10001;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.auth-otp-info {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.change-number-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-xs);
    display: inline-block;
    margin-top: 4px;
}

.change-number-link:hover {
    text-decoration: underline;
}