/* Enhanced Materialize styles with proper responsive design */

body {
    font-family: 'Roboto', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark Mode Variables */
:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --card-bg: #ffffff;
    --nav-bg: #2196F3;
    --border-color: #e0e0e0;
    --input-bg: #ffffff;
    --shadow: rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #ffffff;
    --card-bg: #1e1e1e;
    --nav-bg: #1976D2;
    --border-color: #333333;
    --input-bg: #2a2a2a;
    --shadow: rgba(255,255,255,0.1);
}

/* Dark Mode Styles */
[data-theme="dark"] body {
    background-color: var(--bg-color) !important;
    color: var(--text-color) !important;
}

[data-theme="dark"] body.grey.lighten-4 {
    background-color: var(--bg-color) !important;
}

[data-theme="dark"] .card {
    background-color: var(--card-bg);
    color: var(--text-color);
}

[data-theme="dark"] .collection {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .collection .collection-item {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .input-field input {
    background-color: var(--input-bg);
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .input-field label {
    color: #999;
}

[data-theme="dark"] .modal {
    background-color: var(--card-bg);
    color: var(--text-color);
}

[data-theme="dark"] .tabs .tab a {
    color: var(--text-color);
}

[data-theme="dark"] .tabs .indicator {
    background-color: #2196F3;
}

[data-theme="dark"] table {
    background-color: var(--card-bg);
    color: var(--text-color);
}

[data-theme="dark"] th, [data-theme="dark"] td {
    border-bottom: 1px solid var(--border-color);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    vertical-align: middle;
}

/* Desktop navigation alignment */
.nav-wrapper ul.right li {
    display: flex;
    align-items: center;
    height: 64px;
}

.theme-toggle:hover {
    background-color: rgba(255,255,255,0.1);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
    transform: scale(1.1);
}

/* Additional Dark Mode Styles */
[data-theme="dark"] .sidenav {
    background-color: var(--card-bg);
}

[data-theme="dark"] .sidenav li > a {
    color: var(--text-color);
}

[data-theme="dark"] .sidenav .user-view .name,
[data-theme="dark"] .sidenav .user-view .email {
    color: white;
}

[data-theme="dark"] .dropdown-content {
    background-color: var(--card-bg);
}

[data-theme="dark"] .dropdown-content li > a {
    color: var(--text-color);
}

[data-theme="dark"] .select-dropdown {
    color: var(--text-color);
}

[data-theme="dark"] .select-wrapper input.select-dropdown {
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .btn {
    background-color: #2196F3;
}

[data-theme="dark"] .btn-flat {
    color: #2196F3;
}

[data-theme="dark"] .card-panel {
    background-color: var(--card-bg);
    color: var(--text-color);
}

[data-theme="dark"] .collapsible {
    background-color: var(--card-bg);
}

[data-theme="dark"] .collapsible-header {
    background-color: var(--card-bg);
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .collapsible-body {
    background-color: var(--card-bg);
    color: var(--text-color);
}

[data-theme="dark"] .chat-message__bubble {
    background-color: var(--input-bg);
    color: var(--text-color);
}

[data-theme="dark"] .chat-message--own .chat-message__bubble {
    background-color: #2196F3;
    color: white;
}

[data-theme="dark"] .trip-chat__messages {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .feature-badge {
    background: rgba(33, 150, 243, 0.2);
    color: #64B5F6;
}

[data-theme="dark"] .auth-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, #2a2a2a 100%);
}

[data-theme="dark"] .auth-card__title {
    color: #64B5F6;
}

[data-theme="dark"] .auth-card__subtitle {
    color: #999;
}

[data-theme="dark"] .form-title {
    color: var(--text-color);
}

[data-theme="dark"] .form-subtitle {
    color: #999;
}

[data-theme="dark"] .divider-line {
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

[data-theme="dark"] .divider-text {
    color: #999;
}

[data-theme="dark"] .footer-text {
    color: #999;
}

[data-theme="dark"] .trust-item {
    color: #999;
}

[data-theme="dark"] .pagination li.active {
    background-color: #2196F3;
}

[data-theme="dark"] .pagination li a {
    color: var(--text-color);
}

[data-theme="dark"] .switch label input[type=checkbox]:checked + .lever {
    background-color: rgba(33, 150, 243, 0.5);
}

[data-theme="dark"] .switch label input[type=checkbox]:checked + .lever:after {
    background-color: #2196F3;
}

/* Admin Panel Dark Mode Fixes */
[data-theme="dark"] .tabs {
    background-color: var(--card-bg);
}

[data-theme="dark"] .tabs .tab a {
    color: var(--text-color) !important;
}

[data-theme="dark"] .tabs .tab a:hover {
    color: #64B5F6 !important;
}

[data-theme="dark"] .tabs .tab a.active {
    color: #2196F3 !important;
}

[data-theme="dark"] .container {
    color: var(--text-color);
}

[data-theme="dark"] .card-title {
    color: var(--text-color) !important;
}

[data-theme="dark"] label {
    color: var(--text-color) !important;
}

[data-theme="dark"] p {
    color: var(--text-color);
}

[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3, [data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6 {
    color: var(--text-color) !important;
}

/* Theme Toggle Text Fix */
.theme-toggle {
    color: white !important;
}

[data-theme="dark"] .sidenav .theme-toggle {
    color: var(--text-color) !important;
}

[data-theme="light"] .sidenav .theme-toggle {
    color: #333 !important;
}

/* Admin Stats Panel Dark Mode */
[data-theme="dark"] .admin-stats-panel {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* Form Elements Dark Mode */
[data-theme="dark"] textarea {
    background-color: var(--input-bg);
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .input-field input:focus {
    border-bottom: 2px solid #2196F3;
    box-shadow: 0 1px 0 0 #2196F3;
}

[data-theme="dark"] .input-field label.active {
    color: #2196F3 !important;
}

/* Visually hidden elements - Screen reader only */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Auth page */
.auth-page {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card__title {
    color: #1976D2;
    font-weight: 500;
}

.auth-card__subtitle {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.5;
    margin-bottom: 30px;
}

/* Modern Auth Card Styles */
.auth-card {
    max-width: 480px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.auth-brand-logo {
    margin-bottom: 25px;
}

.brand-icon-wrapper {
    display: inline-block;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.brand-icon {
    color: white;
    font-size: 28px;
}

.brand-name {
    display: block;
    font-weight: 700;
    font-size: 1.8rem;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-product {
    display: block;
    font-weight: 400;
    font-size: 1.2rem;
    color: #666;
    margin-top: -5px;
}

.highlight-text {
    color: #2196F3;
    font-weight: 500;
}

/* Feature Badges */
.feature-badges {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.feature-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(33, 150, 243, 0.1);
    color: #1976D2;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Form Headers */
.form-header {
    margin: 30px 0 25px 0;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}

.form-subtitle {
    color: #666;
    font-size: 0.95rem;
    margin: 0;
}

/* Modern Form Inputs */
.modern-form {
    margin-top: 0;
}

.modern-input {
    margin-bottom: 25px;
}

.modern-input .prefix {
    color: #2196F3;
    font-size: 20px;
    margin-top: 8px;
}

.modern-input input:focus + label,
.modern-input input.valid + label {
    color: #2196F3;
}

.modern-input input:focus {
    border-bottom: 2px solid #2196F3;
    box-shadow: 0 1px 0 0 #2196F3;
}

/* Gradient Button */
.gradient-btn {
    background: linear-gradient(135deg, #2196F3, #1976D2) !important;
    border-radius: 25px !important;
    text-transform: none !important;
    font-weight: 500 !important;
    padding: 0 30px !important;
    height: 48px !important;
    line-height: 48px !important;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3) !important;
    width: 100%;
    margin: 20px 0 !important;
}

.gradient-btn:hover {
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4) !important;
    transform: translateY(-1px);
}

.gradient-btn span {
    font-size: 1rem;
}

/* Auth Links */
.auth-link {
    color: #2196F3;
    font-weight: 500;
    text-decoration: none;
}

.auth-link:hover {
    color: #1976D2;
    text-decoration: underline;
}

/* Modern Divider */
.auth-card__divider {
    display: flex;
    align-items: center;
    margin: 30px 0;
    gap: 15px;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e0e0e0, transparent);
}

.divider-text {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

/* OAuth Section */
.oauth-wrapper {
    margin-bottom: 25px;
}

/* Trust Indicators */
.trust-indicators {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #666;
    font-size: 0.8rem;
}

.trust-item i {
    color: #4CAF50;
}

/* Auth Footer */
.auth-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.footer-text {
    color: #666;
    font-size: 0.85rem;
    margin: 0;
}

.footer-link {
    color: #2196F3;
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

/* Mobile Optimizations */
@media only screen and (max-width: 600px) {
    .auth-card {
        margin: 10px;
        border-radius: 12px;
    }
    
    .brand-name {
        font-size: 1.6rem;
    }
    
    .brand-product {
        font-size: 1.1rem;
    }
    
    .feature-badges {
        gap: 6px;
    }
    
    .feature-badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .trust-indicators {
        gap: 15px;
    }
    
    .trust-item {
        font-size: 0.75rem;
    }
}

/* Fix navbar - prevent overlapping */
.nav-wrapper {
    padding: 0 12px;
    position: relative;
}

.nav-wrapper .brand-logo {
    font-size: 1.6rem;
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.nav-wrapper ul.right {
    margin-right: 0;
}

.nav-wrapper ul.right li {
    margin-left: 8px;
}

@media only screen and (max-width: 992px) {
    .nav-wrapper .brand-logo {
        font-size: 1.2rem;
        position: static;
        transform: none;
    }
}

/* Fix equal card heights */
.equal-height {
    height: 160px;
    display: flex;
}

.equal-height .card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 16px;
}

.equal-height .card-content .card-title {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.equal-height .card-content h5 {
    margin: 8px 0;
    font-size: 1.8rem;
}

.equal-height .card-content p {
    margin: 4px 0 0 0;
    line-height: 1.2;
}

/* Fix avatar sizes */
.trip-members__avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50%;
}

.chat-message__avatar {
    width: 24px !important;
    height: 24px !important;
    border-radius: 50%;
}

.profile-avatar__image {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50%;
}

/* Trip members vertical alignment */
.trip-members__member {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.trip-members__member:last-child {
    border-bottom: none;
}

.trip-members__member img {
    margin-right: 12px;
}

.trip-members__member .member-info {
    flex: 1;
}

.trip-members__member .member-actions {
    margin-left: auto;
}

/* Chat feature buttons - proper Materialize styling */
.chat-features {
    margin-bottom: 12px;
}

.chat-feature-btn {
    background: transparent !important;
    border: 1px solid #e0e0e0 !important;
    color: #2196F3 !important;
    border-radius: 16px !important;
    padding: 4px 12px !important;
    font-size: 0.8rem !important;
    height: 28px !important;
    line-height: 20px !important;
    margin-right: 8px !important;
    text-transform: none !important;
    box-shadow: none !important;
}

.chat-feature-btn:hover {
    background: #2196F3 !important;
    color: white !important;
    border-color: #2196F3 !important;
}

.chat-feature-btn i {
    font-size: 14px !important;
    margin-right: 4px !important;
}

/* Chat styling */
.chat-message {
    margin-bottom: 12px;
    clear: both;
}

.chat-message--own {
    text-align: right;
}

.chat-message__bubble {
    display: inline-block;
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 18px;
    margin: 2px;
    word-wrap: break-word;
}

.chat-message--own .chat-message__bubble {
    background-color: #2196F3;
    color: white;
}

.chat-message--other .chat-message__bubble {
    background-color: #f5f5f5;
    color: #333;
}

.chat-message__header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.chat-message__time {
    font-size: 0.75rem;
    opacity: 0.7;
}

.trip-chat__messages {
    height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 12px;
    background: #fafafa;
}

.trip-chat__input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.trip-chat__input .input-field {
    flex: 1;
    margin: 0;
}

/* Hide original chat card when floating chat is active */
.chat-floating-active .trip-chat {
    display: none;
}

/* Chart sizing */
.expense-chart__canvas {
    max-height: 300px !important;
}

.recent-expenses__list {
    max-height: 300px;
    overflow-y: auto;
}

/* Button spacing improvements */
.right-align a {
    margin-left: 4px;
    margin-right: 4px;
}

.btn-small.red.right {
    margin-left: 8px;
}

/* Mobile sidenav theme toggle */
@media only screen and (max-width: 992px) {
    .sidenav .theme-toggle {
        background: none;
        border: none;
        color: var(--text-color);
        cursor: pointer;
        padding: 16px 32px;
        width: 100%;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 32px;
        font-size: 14px;
        height: auto;
        border-radius: 0;
        justify-content: flex-start;
    }
    
    .sidenav .theme-toggle svg {
        width: 24px;
        height: 24px;
        fill: currentColor;
    }
    
    .sidenav .theme-toggle:hover {
        background-color: rgba(0,0,0,0.1);
    }
    
    [data-theme="dark"] .sidenav .theme-toggle {
        color: var(--text-color);
    }
    
    [data-theme="dark"] .sidenav .theme-toggle:hover {
        background-color: rgba(255,255,255,0.1);
    }
}

/* Improved chat bubble styling */
.chat-message__bubble {
    display: inline-block;
    max-width: 65%;
    padding: 6px 10px;
    border-radius: 16px;
    margin: 1px;
    word-wrap: break-word;
    font-size: 0.9rem;
    line-height: 1.3;
}

.chat-message__header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.chat-message__sender {
    font-size: 0.75rem;
    font-weight: 500;
}

.chat-message__time {
    font-size: 0.7rem;
    opacity: 0.6;
}

.chat-message {
    margin-bottom: 8px;
    clear: both;
}

/* Smaller done icon in chat messages */
.message-status .material-icons {
    font-size: 14px !important;
    opacity: 0.7;
}

/* Chat status improvements */
#typing-indicator {
    display: none;
    font-style: italic;
    color: #2196F3;
    font-size: 0.8rem;
    padding: 4px 8px;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 12px;
    margin: 4px 0;
}

#typing-indicator.active {
    display: block;
}

#online-status {
    font-size: 0.8rem;
    color: #666;
}

#online-members .chip {
    font-size: 0.7rem;
    height: 24px;
    line-height: 24px;
    margin: 2px;
}

/* Tablet view improvements */
@media only screen and (min-width: 601px) and (max-width: 992px) {
    .container {
        width: 90%;
    }
    
    /* Trip actions layout for tablet */
    .trip-actions-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .primary-actions {
        display: flex;
        gap: 8px;
        justify-content: flex-start;
    }
    
    .export-actions {
        display: flex;
        gap: 4px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    /* Summary cards - 2x2 grid on tablet */
    .equal-height {
        height: 140px;
        margin-bottom: 16px;
    }
    
    .equal-height .card-content h5 {
        font-size: 1.6rem;
    }
    
    .equal-height .card-content .card-title {
        font-size: 0.85rem;
    }
    
    /* Navigation improvements */
    .nav-wrapper .brand-logo {
        font-size: 1.4rem;
    }
    
    /* Chat improvements for tablet */
    .trip-chat__messages {
        height: 350px;
    }
    
    .chat-message__bubble {
        max-width: 70%;
        font-size: 0.9rem;
    }
    
    /* Form improvements */
    .modal {
        width: 80%;
        max-width: 600px;
    }
    
    /* Button sizing for tablet */
    .btn {
        padding: 0 16px;
    }
    
    .btn-small {
        padding: 0 12px;
        font-size: 0.8rem;
    }
}

/* Mobile view improvements */
@media only screen and (max-width: 600px) {
    .container {
        width: 95%;
    }
    
    /* Mobile card layout - icon and title side by side */
    .equal-height .card-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .equal-height .card-content .card-title-row {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .equal-height .card-content .material-icons.medium {
        font-size: 1.2rem !important;
        margin: 0;
    }
    
    .equal-height .card-content .card-title {
        font-size: 0.8rem;
        margin: 0;
        white-space: nowrap;
    }
    
    /* Auth page mobile improvements */
    .auth-card__title {
        font-size: 1.5rem;
        color: #1976D2;
    }
    
    .auth-card__subtitle {
        font-size: 0.9rem;
        color: #666;
    }
    
    /* Mobile trip selection layout */
    .mobile-trip-row {
        display: flex;
        gap: 8px;
        align-items: flex-end;
        margin-bottom: 16px;
        padding: 0 8px;
    }
    
    .mobile-trip-select {
        flex: 1;
        min-width: 0;
    }
    
    .mobile-trip-select .input-field {
        margin-bottom: 0;
    }
    
    .mobile-new-trip {
        flex-shrink: 0;
        margin-bottom: 8px;
    }
    
    .mobile-new-trip .btn {
        height: 48px;
        line-height: 48px;
        padding: 0 16px;
        font-size: 0.8rem;
    }
    
    /* Hide desktop trip actions on mobile */
    .trip-actions-container {
        display: none;
    }
    
    /* Hide invitations button on mobile (moved to hamburger) */
    #invitations-btn {
        display: none;
    }
    
    /* Smaller buttons with text on mobile */
    .btn {
        font-size: 0.8rem;
        padding: 0 12px;
    }
    
    .btn-small {
        font-size: 0.7rem;
        padding: 0 8px;
    }
    
    .equal-height {
        height: 130px;
    }
    
    .equal-height .card-content h5 {
        font-size: 1.2rem;
    }
    
    .equal-height .card-content .material-icons {
        font-size: 1rem !important;
    }
    
    .card-title {
        font-size: 0.9rem;
    }
    
    .chat-message__bubble {
        max-width: 80%;
        font-size: 0.85rem;
    }
    
    /* Center brand icon on mobile */
    .brand-icon-wrapper {
        text-align: center;
    }
    
    /* Mobile expense split buttons */
    .expense-form__split {
        display: flex;
        gap: 4px;
        margin: 16px 0;
    }
    
    .expense-form__split p {
        flex: 1;
        margin: 0;
    }
    
    .split-option-btn {
        width: 100%;
        padding: 8px 4px;
        border: 1px solid #e0e0e0;
        background: white;
        color: #666;
        border-radius: 8px;
        font-size: 0.75rem;
        cursor: pointer;
        transition: all 0.2s ease;
        text-align: center;
        display: block;
    }
    
    .split-option-btn.active {
        background: #2196F3;
        color: white;
        border-color: #2196F3;
    }
    
    .split-option-btn:hover {
        border-color: #2196F3;
    }
    
    .split-option-btn::after {
        display: none !important;
    }
    
    /* Hide radio buttons on mobile */
    .expense-form__split input[type="radio"] {
        display: none !important;
        opacity: 0 !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    .expense-form__split input[type="radio"]:before,
    .expense-form__split input[type="radio"]:after {
        display: none !important;
    }
    
    .expense-form__split label {
        margin: 0;
        cursor: pointer;
    }
    
    .expense-form__split label:before,
    .expense-form__split label:after {
        display: none !important;
    }
    
    .expense-form__split [type="radio"]:checked+span:before,
    .expense-form__split [type="radio"]:not(:checked)+span:before,
    .expense-form__split [type="radio"]:not(:checked)+span:after,
    .expense-form__split [type="radio"]:checked+span:after {
        display: none !important;
    }
    
    /* Fix custom split mode buttons */
    .split-mode-toggle {
        display: flex;
        gap: 4px;
        margin-bottom: 12px;
    }
    
    .split-mode-toggle p {
        flex: 1;
        margin: 0;
    }
    
    .split-mode-toggle label {
        width: 100%;
        padding: 6px 8px;
        border: 1px solid #e0e0e0;
        background: white;
        color: #666;
        border-radius: 6px;
        font-size: 0.7rem;
        cursor: pointer;
        transition: all 0.2s ease;
        text-align: center;
        display: block;
    }
    
    .split-mode-toggle label.active {
        background: #2196F3 !important;
        color: white !important;
        border-color: #2196F3 !important;
    }
    
    .split-mode-toggle input[type="radio"] {
        display: none !important;
        opacity: 0 !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    .split-mode-toggle input[type="radio"]:before,
    .split-mode-toggle input[type="radio"]:after {
        display: none !important;
    }
    
    .split-mode-toggle label:before,
    .split-mode-toggle label:after {
        display: none !important;
    }
    
    .split-mode-toggle [type="radio"]:checked+span:before,
    .split-mode-toggle [type="radio"]:not(:checked)+span:before,
    .split-mode-toggle [type="radio"]:not(:checked)+span:after,
    .split-mode-toggle [type="radio"]:checked+span:after {
        display: none !important;
    }
    
    .expense-form__split input[type="radio"],
    .split-mode-toggle input[type="radio"] {
        width: 0 !important;
    }
    
    .expense-form__split label span,
    .split-mode-toggle label span {
        padding-left: 0 !important;
    }
}

/* Modern Chart Styling */
.expense-chart {
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.expense-chart:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.expense-chart .card-content {
    padding: 24px;
}

.expense-chart__canvas {
    height: 500px !important;
    position: relative;
    z-index: 1;
}

/* Immutable System Styles */
.expense-item--replaced {
    opacity: 0.7;
    border-left: 3px solid #ff9800;
}

.budget-with-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.budget-adjust-btn {
    background: none;
    border: 1px solid #2196F3;
    color: #2196F3;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.budget-adjust-btn:hover {
    background: #2196F3;
    color: white;
}

.budget-adjust-btn i {
    font-size: 18px;
}

.expense-history, .budget-history {
    max-height: 400px;
    overflow-y: auto;
}

.history-record {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    background: #f9f9f9;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.history-date {
    font-size: 0.8rem;
    color: #666;
}

.history-details ul {
    margin: 8px 0;
    padding-left: 20px;
}

.history-details li {
    margin: 4px 0;
}

.chart-total-display {
    text-align: center;
    margin-top: 20px;
    padding: 16px;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 12px;
}

.chart-total-amount {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 4px;
}

.chart-total-label {
    font-size: 0.9rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.expense-chart .card-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
}

/* Budget Controls */
.budget-with-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.budget-adjust-btn {
    background: #2196F3;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}

.budget-adjust-btn:hover {
    background: #1976D2;
    transform: scale(1.1);
}

.budget-adjust-btn .material-icons {
    font-size: 18px;
}

/* Budget History UI */
.budget-history-record {
    margin-bottom: 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.budget-history-record:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.budget-history-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.budget-history-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.8);
}

.budget-history-info {
    flex: 1;
}

.budget-history-amount {
    text-align: right;
}

.budget-history-details {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.budget-history-user {
    display: flex;
    align-items: center;
}

/* Budget Transaction Styling */
.expense-item.budget-tx {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-left: 4px solid #2196F3;
    margin-bottom: 8px;
    border-radius: 8px;
    padding: 12px;
}

.expense-item.budget-tx .expense-item__category {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.expense-item.budget-tx .expense-item__category .material-icons {
    font-size: 16px;
}

/* Dark Mode Support */
[data-theme="dark"] .budget-history-record {
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.1);
}

[data-theme="dark"] .budget-history-icon {
    background: rgba(0,0,0,0.3);
}

[data-theme="dark"] .budget-history-details {
    border-top-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .expense-item.budget-tx {
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
    border-left-color: #64B5F6;
}

[data-theme="dark"] .grey-text {
    color: rgba(255,255,255,0.7) !important;
}

[data-theme="dark"] .grey-text.text-darken-1 {
    color: rgba(255,255,255,0.8) !important;
}

[data-theme="dark"] .grey-text.text-darken-2 {
    color: rgba(255,255,255,0.9) !important;
}

/* Expenses Controls */
.expenses-controls {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.expenses-controls-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.expenses-sort,
.expenses-filter {
    flex: 1;
    margin-bottom: 0 !important;
}

.expenses-sort .input-field,
.expenses-filter .input-field {
    margin-bottom: 0;
}

/* Mobile responsive */
@media only screen and (max-width: 600px) {
    .expenses-controls-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .expenses-sort,
    .expenses-filter {
        width: 100%;
    }
}

/* Dark mode */
[data-theme="dark"] .expenses-controls {
    border-bottom-color: rgba(255,255,255,0.1);
}

/* Loading state */
.expenses-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.expenses-loading .material-icons {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

[data-theme="dark"] .expenses-loading {
    color: rgba(255,255,255,0.7);
}

/* Enhanced Budget Tracking UI */
.budget-tracking.enhanced {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-left: 4px solid #2196F3;
}

.budget-tracking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.budget-tracking-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2196F3;
}

.budget-tracking-title .material-icons {
    font-size: 20px;
}

.budget-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.budget-stat {
    text-align: center;
    padding: 12px;
    background: rgba(255,255,255,0.8);
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
}

.budget-stat-value {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 4px;
}

.budget-stat-label {
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.budget-progress {
    margin-bottom: 12px;
}

.budget-progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.budget-progress-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.budget-progress-fill.green {
    background: linear-gradient(90deg, #4CAF50, #66BB6A);
}

.budget-progress-fill.orange {
    background: linear-gradient(90deg, #FF9800, #FFB74D);
}

.budget-progress-fill.red {
    background: linear-gradient(90deg, #F44336, #EF5350);
}

.budget-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
}

.budget-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    color: #c62828;
    font-weight: 500;
}

.budget-alert .material-icons {
    font-size: 18px;
}

/* Mobile Responsive */
@media only screen and (max-width: 600px) {
    .budget-tracking.enhanced {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .budget-tracking-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .budget-tracking-title {
        justify-content: center;
    }
    
    .budget-stats {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .budget-stat {
        padding: 16px 12px;
    }
    
    .budget-stat-value {
        font-size: 1.5rem;
    }
    
    .budget-stat-label {
        font-size: 0.9rem;
    }
}

/* Dark Mode */
[data-theme="dark"] .budget-tracking.enhanced {
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
    border-left-color: #64B5F6;
}

[data-theme="dark"] .budget-stat {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .budget-stat-label {
    color: rgba(255,255,255,0.7);
}

[data-theme="dark"] .budget-progress-bar {
    background: rgba(255,255,255,0.1);
}

[data-theme="dark"] .budget-progress-labels {
    color: rgba(255,255,255,0.7);
}

[data-theme="dark"] .budget-alert {
    background: rgba(244,67,54,0.1);
    border-color: rgba(244,67,54,0.3);
    color: #ff6b6b;
}

[data-theme="dark"] .budget-tracking-title {
    color: #64B5F6;
}

/* Enhanced First Row Dashboard */
.first-row-dashboard {
    margin-bottom: 24px;
}

.first-row-dashboard .card {
    transition: all 0.3s ease;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
}

.first-row-dashboard .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.first-row-dashboard .card.blue.lighten-4 {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 4px solid #2196F3;
}

.first-row-dashboard .card.red.lighten-4 {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 4px solid #f44336;
}

.first-row-dashboard .card.green.lighten-4 {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    border-left: 4px solid #4caf50;
}

.first-row-dashboard .card.orange.lighten-4 {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-left: 4px solid #ff9800;
}

.first-row-dashboard .card-content {
    padding: 20px;
    position: relative;
}

.first-row-dashboard .card-content::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: translate(20px, -20px);
}

.first-row-dashboard .material-icons.medium {
    font-size: 2.5rem;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.first-row-dashboard .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.first-row-dashboard h5 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 8px 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.first-row-dashboard .grey-text small {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Mobile Enhancements */
@media only screen and (max-width: 600px) {
    .first-row-dashboard {
        margin-bottom: 16px;
    }
    
    .first-row-dashboard .card {
        margin-bottom: 12px;
        border-radius: 8px;
    }
    
    .first-row-dashboard .card-content {
        padding: 16px;
    }
    
    .first-row-dashboard .card-title-row {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 12px;
        justify-content: center;
    }
    
    .first-row-dashboard .card-title-row .material-icons {
        font-size: 1.4rem;
    }
    
    .first-row-dashboard .card-title-row .card-title {
        font-size: 0.8rem;
        margin: 0;
    }
    
    .first-row-dashboard h5 {
        font-size: 1.5rem;
        margin: 4px 0;
    }
}

/* Tablet Enhancements */
@media only screen and (min-width: 601px) and (max-width: 992px) {
    .first-row-dashboard .card {
        margin-bottom: 16px;
    }
    
    .first-row-dashboard .material-icons.medium {
        font-size: 2rem;
    }
    
    .first-row-dashboard h5 {
        font-size: 1.6rem;
    }
}

/* Dark Mode Enhancements */
[data-theme="dark"] .first-row-dashboard .card.blue.lighten-4 {
    background: linear-gradient(135deg, rgba(33,150,243,0.15) 0%, rgba(33,150,243,0.08) 100%);
    border-left-color: #64B5F6;
}

[data-theme="dark"] .first-row-dashboard .card.red.lighten-4 {
    background: linear-gradient(135deg, rgba(244,67,54,0.15) 0%, rgba(244,67,54,0.08) 100%);
    border-left-color: #EF5350;
}

[data-theme="dark"] .first-row-dashboard .card.green.lighten-4 {
    background: linear-gradient(135deg, rgba(76,175,80,0.15) 0%, rgba(76,175,80,0.08) 100%);
    border-left-color: #66BB6A;
}

[data-theme="dark"] .first-row-dashboard .card.orange.lighten-4 {
    background: linear-gradient(135deg, rgba(255,152,0,0.15) 0%, rgba(255,152,0,0.08) 100%);
    border-left-color: #FFB74D;
}

[data-theme="dark"] .first-row-dashboard .card {
    background-color: rgba(255,255,255,0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .first-row-dashboard .card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

[data-theme="dark"] .first-row-dashboard .card-content::before {
    background: rgba(255,255,255,0.05);
}

[data-theme="dark"] .first-row-dashboard .grey-text {
    color: rgba(255,255,255,0.7) !important;
}

/* Animation Enhancements */
.first-row-dashboard .card {
    animation: fadeInUp 0.6s ease-out;
}

.first-row-dashboard .col:nth-child(1) .card { animation-delay: 0.1s; }
.first-row-dashboard .col:nth-child(2) .card { animation-delay: 0.2s; }
.first-row-dashboard .col:nth-child(3) .card { animation-delay: 0.3s; }
.first-row-dashboard .col:nth-child(4) .card { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility Enhancements */
.first-row-dashboard .card[onclick] {
    cursor: pointer;
}

.first-row-dashboard .card[onclick]:focus {
    outline: 2px solid #2196F3;
    outline-offset: 2px;
}

.first-row-dashboard .card[onclick]:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Enhanced Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
    transform: rotate(15deg);
}

/* Mobile sidenav theme toggle */
.sidenav .theme-toggle {
    width: 100%;
    justify-content: flex-start;
    padding: 16px 32px;
    border-radius: 0;
    gap: 32px;
}

.sidenav .theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
    transform: none;
}

.sidenav .theme-toggle svg {
    width: 24px;
    height: 24px;
}

.sidenav .theme-toggle span {
    font-size: 14px;
    font-weight: 500;
}

/* Dark mode adjustments */
[data-theme="dark"] .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .sidenav .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Desktop Expense Form Split Options - Inline Layout */
@media only screen and (min-width: 993px) {
    .expense-form__split {
        display: flex;
        gap: 12px;
        align-items: center;
        padding: 16px;
        border-radius: 8px;
        background: #f8f9fa;
        border: 1px solid #e0e0e0;
    }
    
    .expense-form__split p {
        flex: 1;
        margin: 0;
    }
    
    .expense-form__split label {
        display: block;
        width: 100%;
        padding: 8px 16px;
        border: 1px solid #e0e0e0;
        background: #ffffff;
        color: #333;
        border-radius: 6px;
        text-align: center;
        cursor: pointer;
        transition: all 0.2s ease;
        font-size: 0.9rem;
        position: relative;
    }
    
    .expense-form__split label:hover {
        border-color: #2196F3;
        background: rgba(33, 150, 243, 0.05);
    }
    
    .expense-form__split [type="radio"] {
        width: 0 !important;
        height: 0 !important;
        opacity: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        margin: 0 !important;
    }
    
    .expense-form__split [type="radio"]:before,
    .expense-form__split [type="radio"]:after {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    
    .expense-form__split label:before,
    .expense-form__split label:after {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    
    .expense-form__split label span:before,
    .expense-form__split label span:after {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    
    .expense-form__split [type="radio"]:checked + span:before,
    .expense-form__split [type="radio"]:not(:checked) + span:before,
    .expense-form__split [type="radio"]:checked + span:after,
    .expense-form__split [type="radio"]:not(:checked) + span:after {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    
    .expense-form__split [type="radio"]:checked + span {
        background: #2196F3 !important;
        color: white !important;
        border-color: #2196F3 !important;
    }
    
    .expense-form__split label span {
        padding-left: 0 !important;
        display: block;
        width: 100%;
    }
    
    /* Dark Mode */
    [data-theme="dark"] .expense-form__split {
        background: rgba(255, 255, 255, 0.02);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    [data-theme="dark"] .expense-form__split label {
        background: rgba(255, 255, 255, 0.05);
        color: rgba(255, 255, 255, 0.9);
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    [data-theme="dark"] .expense-form__split label:hover {
        border-color: #64B5F6;
        background: rgba(100, 181, 246, 0.1);
    }
    
    [data-theme="dark"] .expense-form__split [type="radio"]:checked + span {
        background: #64B5F6 !important;
        color: #000 !important;
        border-color: #64B5F6 !important;
    }
}

/* Mobile/Tablet Dark Mode - Expense Form Split Options */
@media only screen and (max-width: 992px) {
    [data-theme="dark"] .expense-form__split label {
        color: rgba(255, 255, 255, 0.9) !important;
    }
    
    [data-theme="dark"] .expense-form__split label span {
        color: rgba(255, 255, 255, 0.9) !important;
    }
    
    [data-theme="dark"] .expense-form__split [type="radio"]:checked+span:before,
    [data-theme="dark"] .expense-form__split [type="radio"]:not(:checked)+span:before {
        border-color: rgba(255, 255, 255, 0.5) !important;
    }
    
    [data-theme="dark"] .expense-form__split [type="radio"]:checked+span:after {
        background-color: #64B5F6 !important;
    }
    
    [data-theme="dark"] .expense-form__split label:hover span {
        color: rgba(255, 255, 255, 1) !important;
    }
}

/* Dark mode for split option buttons */
[data-theme="dark"] .split-option-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

[data-theme="dark"] .split-option-btn.active {
    background: #64B5F6 !important;
    color: #000 !important;
    border-color: #64B5F6 !important;
}

[data-theme="dark"] .split-option-btn:hover {
    border-color: #64B5F6 !important;
    color: rgba(255, 255, 255, 1) !important;
}

/* Paid By Dropdown Styling */
.input-field select#paid-by,
.input-field select#edit-paid-by {
    background-color: var(--input-bg);
    color: var(--text-color);
}

[data-theme="dark"] .input-field select#paid-by,
[data-theme="dark"] .input-field select#edit-paid-by {
    background-color: var(--input-bg);
    color: var(--text-color);
}

[data-theme="dark"] .dropdown-content li > span {
    color: var(--text-color);
}

/* Custom Split Section UI Improvements */
#custom-split-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.custom-split-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e0e0e0;
}

.custom-split-header h6 {
    color: #2196F3;
    font-weight: 600;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-split-header h6:before {
    content: '💰';
    font-size: 18px;
}

.split-amount-info {
    background: rgba(33, 150, 243, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    text-align: center;
    font-weight: 500;
    color: #1976D2;
}

.split-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 12px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.split-info span {
    font-size: 0.9rem;
    color: #666;
}

.split-info strong {
    color: #2196F3;
    font-weight: 600;
}

.split-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.split-actions button {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

.split-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.4);
}

.custom-split-members {
    display: grid;
    gap: 12px;
}

.split-member-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
}

.split-member-row:hover {
    border-color: #2196F3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.1);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.split-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50%;
    border: 2px solid #2196F3;
}

.member-name {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.split-input {
    margin: 0 !important;
    max-width: 120px;
    min-width: 80px;
}

.split-input input {
    text-align: center;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid #e0e0e0 !important;
    background: #f8f9fa !important;
    padding: 6px 8px !important;
    margin: 0 !important;
    font-size: 0.9rem !important;
    height: 36px !important;
    box-sizing: border-box !important;
}

.split-input input:focus {
    border-color: #2196F3 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1) !important;
}

.split-input input:invalid {
    border-color: #f44336 !important;
    background: rgba(244, 67, 54, 0.05) !important;
}

.split-input input:valid {
    border-color: #4caf50 !important;
}

.split-input label {
    font-size: 0.7rem !important;
    color: #666 !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
}

.split-display {
    min-width: 80px;
    text-align: center;
    font-weight: 600;
    color: #2196F3;
    background: rgba(33, 150, 243, 0.1);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.split-validation {
    margin-top: 16px;
    border-radius: 8px;
    overflow: hidden;
}

.split-validation .card-panel {
    margin: 0;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Dark Mode */
[data-theme="dark"] #custom-split-section {
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .custom-split-header {
    border-bottom-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .custom-split-header h6 {
    color: #64B5F6;
}

[data-theme="dark"] .split-amount-info {
    background: rgba(100, 181, 246, 0.15);
    color: #64B5F6;
}

[data-theme="dark"] .split-info {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .split-info span {
    color: rgba(255,255,255,0.7);
}

[data-theme="dark"] .split-info strong {
    color: #64B5F6;
}

[data-theme="dark"] .split-actions button {
    background: linear-gradient(135deg, #64B5F6, #42A5F5);
    color: #000;
}

[data-theme="dark"] .split-member-row {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .split-member-row:hover {
    border-color: #64B5F6;
    box-shadow: 0 2px 8px rgba(100, 181, 246, 0.2);
}

[data-theme="dark"] .member-name {
    color: rgba(255,255,255,0.9);
}

[data-theme="dark"] .split-avatar {
    border-color: #64B5F6;
}

[data-theme="dark"] .split-input input {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.2) !important;
    color: rgba(255,255,255,0.9) !important;
}

[data-theme="dark"] .split-input input:focus {
    border-color: #64B5F6 !important;
    background: rgba(255,255,255,0.15) !important;
    box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.2) !important;
}

[data-theme="dark"] .split-input label {
    color: rgba(255,255,255,0.7) !important;
}

[data-theme="dark"] .split-display {
    color: #64B5F6;
    background: rgba(100, 181, 246, 0.15);
}

[data-theme="dark"] .split-input input {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.2) !important;
    color: rgba(255,255,255,0.9) !important;
}

[data-theme="dark"] .split-input input:focus {
    border-color: #64B5F6 !important;
    background: rgba(255,255,255,0.15) !important;
    box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.2) !important;
}

[data-theme="dark"] .split-input input:invalid {
    border-color: #ff6b6b !important;
    background: rgba(255, 107, 107, 0.1) !important;
}

[data-theme="dark"] .split-input input:valid {
    border-color: #66bb6a !important;
}

[data-theme="dark"] .split-input label {
    color: rgba(255,255,255,0.7) !important;
}

/* Mobile Responsive */
@media only screen and (max-width: 600px) {
    #custom-split-section {
        padding: 16px;
        margin-top: 12px;
    }
    
    .custom-split-header h6 {
        font-size: 1rem;
    }
    
    .split-actions {
        gap: 6px;
    }
    
    .split-actions button {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
    
    .split-member-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
    }
    
    .member-info {
        justify-content: center;
        min-width: auto;
    }
    
    .split-input {
        order: 2;
        max-width: 100px;
        min-width: 70px;
        justify-self: center;
    }
    
    .split-input input {
        font-size: 0.85rem !important;
        height: 32px !important;
        padding: 4px 6px !important;
    }
    
    .split-display {
        order: 3;
        justify-self: center;
        min-width: 60px;
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    
    .split-info {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* Tablet Responsive */
@media only screen and (min-width: 601px) and (max-width: 992px) {
    .split-member-row {
        grid-template-columns: 140px 1fr 90px;
    }
    
    .split-actions button {
        font-size: 0.8rem;
    }
}

.expense-chart .card-title i {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.6rem;
}

[data-theme="dark"] .expense-chart {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

[data-theme="dark"] .expense-chart .card-title {
    color: #ecf0f1;
}

[data-theme="dark"] .chart-total-display {
    background: rgba(52, 152, 219, 0.2);
}

[data-theme="dark"] .chart-total-amount {
    color: #ecf0f1;
}

[data-theme="dark"] .chart-total-label {
    color: #bdc3c7;
}

/* Mobile chart adjustments */
@media only screen and (max-width: 600px) {
    .expense-chart__canvas {
        height: 350px !important;
    }
    
    .expense-chart .card-content {
        padding: 16px;
    }
    
    .expense-chart .card-title {
        font-size: 1.2rem;
    }
    
    .chart-total-amount {
        font-size: 1.5rem;
    }
}

/* Tablet chart adjustments */
@media only screen and (min-width: 601px) and (max-width: 992px) {
    .expense-chart__canvas {
        height: 450px !important;
    }
}

/* Large screen improvements */
@media only screen and (min-width: 993px) {
    .trip-actions-container {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 16px;
    }
    
    .primary-actions,
    .export-actions {
        display: flex;
        gap: 8px;
        align-items: center;
    }
    
    .equal-height {
        height: 160px;
    }
    
    /* Hide mobile-specific elements on desktop */
    .mobile-trip-row {
        display: none;
    }
    
    .mobile-accordion {
        display: none;
    }
    
    /* Hide accordion arrows on desktop */
    .mobile-accordion .collapsible-header::after {
        display: none;
    }
}

/* Floating Chat Bubble */
.chat-bubble {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.6);
}

.chat-bubble i {
    color: white;
    font-size: 24px;
}

.chat-bubble .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f44336;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Floating Chat Window */
.chat-window {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 350px;
    height: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

[data-theme="dark"] .chat-window {
    background: var(--card-bg);
    color: var(--text-color);
}

.chat-window-header {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-window-title {
    font-weight: 500;
    font-size: 1.1rem;
}

.chat-window-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.chat-window-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.chat-window-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.chat-window .trip-chat__messages {
    flex: 1;
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    background: #fafafa;
    overflow-y: auto;
    max-height: 300px;
}

[data-theme="dark"] .chat-window .trip-chat__messages {
    background: var(--input-bg);
    border-color: var(--border-color);
}

.chat-window .trip-chat__input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-window .trip-chat__input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

[data-theme="dark"] .chat-window .trip-chat__input input {
    background: var(--input-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

.chat-window .chat-send-btn {
    background: #2196F3;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.chat-window .chat-send-btn:hover {
    background: #1976D2;
}

.chat-window .chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Enhanced expense item UI */
.expense-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s ease;
}

.expense-item:hover {
    background-color: #f8f9fa;
}

.expense-item:last-child {
    border-bottom: none;
}

.expense-item__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
}

.expense-item__info {
    flex: 1;
    min-width: 0;
}

.expense-item__category {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 2px;
    color: #2196F3;
}

.expense-item__description {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 2px;
}

.expense-item__meta {
    font-size: 0.75rem;
    color: #999;
    display: flex;
    gap: 8px;
}

.expense-item__amount {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    margin-right: 8px;
}

.expense-item__actions {
    display: flex;
    gap: 4px;
}

/* Budget adjustment buttons */
.budget-with-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.budget-adjust-btn {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid #2196F3;
    color: #2196F3;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.budget-adjust-btn:hover {
    background: #2196F3;
    color: white;
}

.budget-adjust-btn i {
    font-size: 14px;
}

[data-theme="dark"] .expense-item:hover {
    background-color: rgba(255,255,255,0.05);
}

[data-theme="dark"] .expense-item__amount {
    color: var(--text-color);
}

[data-theme="dark"] .expense-item__description {
    color: #aaa;
}

[data-theme="dark"] .expense-item__meta {
    color: #888;
}

@media only screen and (max-width: 600px) {
    .budget-adjust-btn {
        width: 20px;
        height: 20px;
    }
    
    .budget-adjust-btn i {
        font-size: 12px;
    }
    
    .split-mode-toggle label {
        padding: 4px 6px;
        font-size: 0.65rem;
    }
}

.chat-window .chat-send-btn:hover {
    background: #1976D2;
}

.chat-window .chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Mobile Chat Window */
@media only screen and (max-width: 600px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: 400px;
        bottom: 90px;
        left: 20px;
        right: 20px;
    }
    
    .chat-bubble {
        bottom: 20px;
        left: 20px;
    }
}

/* Chat message avatars */
.chat-message__avatar {
    width: 16px !important;
    height: 16px !important;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
}

/* Fix chat window scrolling */
.chat-window .trip-chat__messages {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.chat-window .trip-chat__messages::-webkit-scrollbar {
    width: 4px;
}

.chat-window .trip-chat__messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.chat-window .trip-chat__messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.chat-window .trip-chat__messages::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Fix split avatar size */
.split-avatar {
    width: 24px !important;
    height: 24px !important;
    margin-right: 8px;
}

/* Mobile hamburger menu accordion styles */
.mobile-accordion {
    border: none;
    box-shadow: none;
}

.mobile-accordion .collapsible-header {
    padding: 16px 32px;
    border-bottom: none;
    background: transparent;
    color: rgba(0,0,0,0.87);
}

.mobile-accordion .collapsible-body {
    padding: 0;
    border-bottom: none;
}

.mobile-accordion .collapsible-body .collection {
    margin: 0;
    border: none;
}

.mobile-accordion .collection-item {
    padding: 12px 48px;
    border-bottom: 1px solid #e0e0e0;
}

.mobile-accordion .collection-item:last-child {
    border-bottom: none;
}

[data-theme="dark"] .mobile-accordion .collapsible-header {
    color: var(--text-color);
}

[data-theme="dark"] .mobile-accordion .collection-item {
    background: var(--card-bg);
    color: var(--text-color);
    border-bottom-color: var(--border-color);
}

/* Fix dark mode sidenav icon colors */
[data-theme="dark"] .sidenav li > a {
    color: var(--text-color) !important;
}

[data-theme="dark"] .sidenav .material-icons {
    color: var(--text-color) !important;
}

/* Add accordion arrow indicators */
.mobile-accordion .collapsible-header::after {
    content: 'keyboard_arrow_down';
    font-family: 'Material Icons';
    position: absolute;
    right: 16px;
    transition: transform 0.3s ease;
}

.mobile-accordion .collapsible-header.active::after {
    transform: rotate(180deg);
}

.mobile-accordion .collapsible-header {
    position: relative;
    padding-right: 48px;
}