/* ==========================================
   CSS CUSTOM VARIABLES & PALETTE
   ========================================== */
:root {
    --bg-main: #090d16;
    --bg-sidebar: #0f1524;
    --bg-card: rgba(22, 30, 49, 0.7);
    --bg-card-hover: rgba(28, 38, 62, 0.85);
    --bg-input: #151d30;
    
    --color-primary: #8b5cf6;       /* Electric Violet */
    --color-primary-hover: #7c3aed;
    --color-primary-glow: rgba(139, 92, 246, 0.25);
    
    --color-secondary: #06b6d4;     /* Vibrant Cyan */
    --color-secondary-hover: #0891b2;
    --color-secondary-glow: rgba(6, 182, 212, 0.25);
    
    --color-success: #10b981;       /* Emerald */
    --color-success-glow: rgba(16, 185, 129, 0.15);
    
    --color-danger: #f43f5e;        /* Rose Warning */
    --color-danger-glow: rgba(244, 63, 94, 0.15);
    
    --color-warning: #f59e0b;       /* Amber */
    --color-warning-glow: rgba(245, 158, 11, 0.15);

    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-focus: rgba(139, 92, 246, 0.5);

    --text-main: #f3f4f6;           /* Gray 100 */
    --text-secondary: #cbd5e1;      /* Gray 300 */
    --text-muted: #94a3b8;          /* Gray 400 */
    --text-dark: #1e293b;           /* Gray 800 */

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================
   GLOBAL RESET & BASE STYLES
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    /* Soft grid overlay */
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ==========================================
   APP LAYOUT STRUCTURE
   ========================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* SIDEBAR STYLES */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}

.logo-icon {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px var(--color-primary-glow));
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.04em;
    color: var(--text-main);
}

.logo-text .highlight {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-item i {
    font-size: 1.2rem;
    transition: var(--transition-smooth);
}

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

.nav-item:hover i {
    transform: scale(1.1);
    color: var(--color-secondary);
}

.nav-item.active {
    color: var(--text-main);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(6, 182, 212, 0.05));
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow: var(--shadow-sm);
}

.nav-item.active i {
    color: var(--color-primary);
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* MAIN CONTENT WORKSPACE */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 3rem;
    height: 100vh;
    overflow-y: auto;
    min-width: 0;
    box-sizing: border-box;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

#page-title {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    background: linear-gradient(to right, var(--text-main), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.stats-badge {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

.stats-badge .label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-badge .value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--color-secondary);
}

/* ==========================================
   PANELS CONTAINER & TRANSITIONS
   ========================================== */
.panels-container {
    flex-grow: 1;
    position: relative;
}

.page-panel {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

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

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

/* ==========================================
   DASHBOARD PANEL COMPONENTS
   ========================================== */
/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.purple {
    background-color: rgba(139, 92, 246, 0.15);
    color: var(--color-primary);
}

.stat-icon.blue {
    background-color: rgba(6, 182, 212, 0.15);
    color: var(--color-secondary);
}

.stat-icon.green {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.stat-icon.yellow {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

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

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 500;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: var(--font-heading);
}

/* DASHBOARD LAYOUT & CARDS */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.card-header {
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header-icon {
    color: var(--color-primary);
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.card-body {
    flex-grow: 1;
}

/* BALANCES LIST */
.balances-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.balance-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
}

.balance-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.balance-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.balance-name {
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.balance-amount {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
}

.balance-amount.positive {
    background-color: var(--color-success-glow);
    color: var(--color-success);
}

.balance-amount.negative {
    background-color: var(--color-danger-glow);
    color: var(--color-danger);
}

.balance-amount.neutral {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.balance-bars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.balance-bar-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.progress-bar-wrapper {
    height: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 1s ease-out;
}

.progress-bar.paid {
    background: linear-gradient(to right, var(--color-secondary), var(--color-primary));
}

.progress-bar.consumed {
    background: var(--color-primary);
}

/* SETTLEMENTS LIST */
.settlements-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settlement-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.01) 100%);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.settlement-card:hover {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.04);
}

.settlement-flow {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.settlement-actor {
    display: flex;
    flex-direction: column;
}

.actor-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.actor-name {
    font-weight: 600;
}

.settlement-arrow {
    color: var(--text-muted);
    font-size: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    animation: flowPulse 2s infinite ease-in-out;
}

@keyframes flowPulse {
    0%, 100% {
        transform: translateX(0);
        opacity: 0.7;
    }
    50% {
        transform: translateX(5px);
        opacity: 1;
    }
}

.settlement-val {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--color-secondary);
    background-color: var(--color-secondary-glow);
    padding: 0.25rem 0.85rem;
    border-radius: var(--radius-sm);
}

/* ==========================================
   FORM & LIST SPLIT LAYOUTS
   ========================================== */
.split-layout {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 950px) {
    .split-layout {
        grid-template-columns: 1fr;
    }
}

.form-card {
    position: sticky;
    top: 20px;
}

/* ==========================================
   INPUTS & FORM ELEMENTS
   ========================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    margin-top: -0.25rem;
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.input-with-icon input,
select {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.85rem 1rem 0.85rem 2.75rem;
    border-radius: var(--radius-md);
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

select {
    padding-left: 1.25rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' class='w-6 h-6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
}

.input-with-icon input:focus,
select:focus {
    border-color: var(--border-color-focus);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
    background-color: rgba(21, 29, 48, 0.9);
}

.input-with-icon input:focus + i {
    color: var(--color-primary);
}

/* CHECKBOX GROUPS */
.checkbox-group {
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
    user-select: none;
}

.checkbox-label input {
    appearance: none;
    width: 20px;
    height: 20px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.checkbox-label input::after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.75rem;
    color: var(--bg-main);
    display: none;
}

.checkbox-label input:checked {
    background-color: var(--color-secondary);
    border-color: var(--color-secondary);
}

.checkbox-label input:checked::after {
    display: block;
}

.checkbox-label:hover input {
    border-color: var(--color-secondary);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-bounce);
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: var(--text-main);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-icon-danger {
    background: rgba(244, 63, 94, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(244, 63, 94, 0.15);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-icon-danger:hover {
    background: var(--color-danger);
    color: var(--text-main);
    transform: scale(1.08);
}

.w-100 {
    width: 100%;
}

/* ==========================================
   PARTICIPANTS GRID LIST
   ========================================== */
.grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.participant-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    transition: var(--transition-smooth);
    text-align: center;
}

.participant-card:hover {
    background-color: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.1);
}

.participant-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary-glow), var(--color-secondary-glow));
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: var(--color-secondary);
    font-family: var(--font-heading);
    font-weight: 700;
}

.participant-name-label {
    font-weight: 600;
    word-break: break-word;
}

.participant-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: var(--transition-smooth);
}

.participant-card:hover .participant-actions {
    opacity: 1;
}

/* ==========================================
   DATA TABLES (MEALS & EXPENSES)
   ========================================== */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tbody tr {
    transition: var(--transition-smooth);
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

.text-right {
    text-align: right;
}

.badge-attendees {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-width: 320px;
}

.attendee-pill {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
}

.expense-amount-val {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--color-secondary);
}

/* ==========================================
   EMPTY STATE STYLING
   ========================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
    gap: 1rem;
}

.empty-state i {
    font-size: 3rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.02));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.empty-state-small {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem 1rem;
    font-size: 0.85rem;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
}

.toast {
    background: rgba(15, 21, 36, 0.95);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    min-width: 280px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast.success {
    border-left: 4px solid var(--color-success);
}
.toast.success i {
    color: var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-danger);
}
.toast.error i {
    color: var(--color-danger);
}

.toast.info {
    border-left: 4px solid var(--color-secondary);
}
.toast.info i {
    color: var(--color-secondary);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-fade-out {
    animation: fadeOut 0.4s ease-out forwards;
}

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

/* ==========================================
   RESPONSIVE MEDIA QUERIES (MOBILE OPTIMIZATIONS)
   ========================================== */

.mobile-logo-wrapper {
    display: none;
}

@media (max-width: 1024px) {
    .main-content {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }

    .app-container {
        flex-direction: column;
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }

    /* Transform Sidebar into Bottom Navigation Bar */
    .sidebar {
        width: 100%;
        height: 65px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-color);
        background-color: var(--bg-sidebar);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
    }

    .logo {
        display: none; /* Hide logo in bottom nav */
    }

    .nav-menu {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        gap: 0;
        margin: 0;
    }

    .nav-item {
        flex-direction: column;
        gap: 3px;
        padding: 8px 0;
        border: none;
        background: none !important;
        flex-grow: 1;
        align-items: center;
        border-radius: 0;
        color: var(--text-muted);
        font-size: 0.7rem;
    }

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

    .nav-item.active {
        color: var(--color-primary);
        box-shadow: none;
        border: none;
    }

    .nav-item.active i {
        color: var(--color-primary);
        transform: translateY(-2px);
    }

    /* Main Workspace adjustments */
    .main-content {
        padding: 1.25rem 0.75rem 85px 0.75rem; /* Extra padding bottom to clear the bottom nav */
        height: auto;
        min-height: calc(100vh - 65px);
        overflow-x: hidden;
    }

    /* Top Header responsive adjustments */
    .top-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        margin-bottom: 1.5rem;
        padding-bottom: 1.25rem;
    }

    .mobile-logo-wrapper {
        display: block;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid rgba(255,255,255,0.03);
        padding-bottom: 0.5rem;
    }

    .mobile-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .mobile-logo .logo-icon {
        font-size: 1.5rem;
    }

    .mobile-logo .logo-text {
        font-size: 1.25rem;
        font-weight: 800;
        font-family: var(--font-heading);
    }

    .header-info {
        order: 2;
    }

    .header-actions {
        order: 3;
        display: flex;
        gap: 0.5rem;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .header-actions .btn {
        flex-grow: 1;
        justify-content: center;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .stats-badge {
        flex-grow: 1;
        justify-content: center;
        padding: 0.6rem 1rem;
    }
    
    .stats-badge .label {
        font-size: 0.75rem;
    }
    
    .stats-badge .value {
        font-size: 1.15rem;
    }

    /* Card Padding and Layouts */
    .card {
        padding: 1.25rem; /* Reduces card padding from 2rem to 1.25rem on mobile */
        min-width: 0; /* Let cards shrink below content size */
        box-sizing: border-box;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .dashboard-grid > * {
        min-width: 0; /* Let dashboard grid cells shrink */
        box-sizing: border-box;
    }

    /* Split layout (forms + lists) */
    .split-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .split-layout > * {
        min-width: 0; /* Let split layout columns shrink to prevent table/form expansion */
        box-sizing: border-box;
    }

    .form-card {
        position: static; /* Disable sticky scrolling on mobile so it scrolls naturally */
    }

    /* Form input fields sizing */
    .input-with-icon {
        width: 100%;
        max-width: 100%;
    }

    .input-with-icon input {
        padding: 0.75rem 1rem 0.75rem 2.5rem;
        font-size: 0.9rem;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    
    input[type="date"] {
        appearance: none;
        -webkit-appearance: none;
    }
    
    select {
        padding: 0.75rem 2rem 0.75rem 1rem;
        font-size: 0.9rem;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    
    .input-with-icon i {
        left: 0.85rem;
    }
    
    .checkbox-group {
        padding: 0.75rem;
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .checkbox-label {
        font-size: 0.85rem;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .checkbox-label span {
        word-break: break-all;
        overflow-wrap: break-word;
        white-space: normal;
    }

    /* Grid layout for participants */
    .grid-list {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.75rem;
    }

    .participant-card {
        padding: 1rem;
    }

    .participant-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
    }

    .participant-actions {
        opacity: 1; /* Show delete buttons immediately on mobile since there is no hover */
    }

    /* Prevent tables from squishing by forcing a min-width inside their scrolling wrapper */
    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-sm);
    }
    
    .data-table {
        min-width: 580px; /* Forces scrollbar on narrow viewports rather than broken row wraps */
    }

    .data-table th, 
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .badge-attendees {
        max-width: 180px;
    }

    /* Toast Container mobile adjustment */
    .toast-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        width: calc(100% - 2rem);
    }

    .toast {
        min-width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    /* Title sizing */
    #page-title {
        font-size: 1.6rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }

    /* Stacking header actions completely for small screen phones */
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .header-actions .btn,
    .stats-badge {
        width: 100%;
        justify-content: center;
    }

    /* Stats Grid: 2 columns on small screens, and stack icon above texts to prevent overflow */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.85rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        text-align: left;
    }

    .stat-icon {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }

    .stat-value {
        font-size: 1.15rem;
        word-break: break-all;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }

    /* Balances bar representation stacked */
    .balance-bars {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    /* Settlement Flow */
    .settlement-card {
        padding: 0.75rem;
    }

    .settlement-flow {
        gap: 0.5rem;
    }

    .actor-name {
        font-size: 0.85rem;
    }

    .settlement-val {
        font-size: 1.05rem;
        padding: 0.2rem 0.5rem;
    }
}

@media (max-width: 380px) {
    .btn-demo-text {
        display: none;
    }
}

/* ==========================================
   PARTICIPANT BALANCES MEALS ATTENDANCE STYLE
   ========================================== */
.balance-item-meals {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.05);
}

.meals-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.attended-meals-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.attended-meal-pill {
    font-size: 0.72rem;
    padding: 0.2rem 0.65rem;
    background-color: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.attended-meal-pill:hover {
    background-color: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.25);
    color: var(--text-main);
}

.no-meals-text {
    font-size: 0.75rem;
    color: var(--color-danger);
    font-style: italic;
    opacity: 0.8;
}

/* ==========================================
   SETTLEMENT STATUS BADGES
   ========================================== */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-status.confirmed {
    background-color: var(--color-success-glow);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.badge-status.pending {
    background-color: var(--color-warning-glow);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.15);
}

/* ==========================================
   SETTLEMENT SUGGESTION CARD ACTIONS
   ========================================== */
.settlement-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.05);
    padding-top: 0.6rem;
    gap: 0.5rem;
}

.settlement-actions .settlement-val {
    margin-top: 0;
}

.settlement-actions .btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    min-height: 0;
}

@media (max-width: 480px) {
    .settlement-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }
    .settlement-actions .settlement-val {
        text-align: center;
        width: 100%;
    }
    .settlement-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================
   SETTLEMENT FILTERS STYLING
   ========================================== */
.settlements-filter-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    box-sizing: border-box;
}

.settlements-filter-row .form-group {
    flex: 1;
    min-width: 120px;
    margin-bottom: 0;
    box-sizing: border-box;
}

.settlements-filter-row label {
    font-size: 0.72rem;
    margin-bottom: 0.25rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settlements-filter-row select {
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    font-size: 0.85rem;
    height: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    box-sizing: border-box;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

@media (max-width: 480px) {
    .settlements-filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .settlements-filter-row .form-group {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
}


