:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); min-height: 100vh; padding-bottom: 80px; }
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.header { background: white; color: var(--primary-color); padding: 25px; border-radius: 15px; text-align: center; margin-bottom: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.header-logo { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 10px; }
.header-logo img { height: 60px; width: auto; }
.header h1 { font-size: 2em; margin: 0; background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.header-tagline { opacity: 0.7; font-size: 0.9em; margin-top: 8px; color: #666; }
.header-subtitle { font-size: 1.3em; margin-top: 15px; color: var(--primary-color); font-weight: 600; padding: 10px 20px; background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%); border-radius: 25px; display: inline-block; cursor: pointer; transition: all 0.3s; }
.header-subtitle:hover { background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%); transform: translateY(-2px); }
.screen { display: none; background: white; border-radius: 15px; padding: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); animation: fadeIn 0.3s; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.screen h2 { color: #333; margin-bottom: 20px; font-size: 1.5em; display: flex; align-items: center; gap: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-bottom: 25px; }
.stat-card { background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); color: white; padding: 20px; border-radius: 12px; text-align: center; }
.stat-value { font-size: 2em; font-weight: 700; margin-bottom: 5px; }
.stat-label { font-size: 0.9em; opacity: 0.9; }
.input-group { display: flex; gap: 10px; margin-bottom: 15px; }
input, select, button, textarea { padding: 12px 15px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 1em; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-color); }
input[type="text"], input[type="number"], textarea { flex: 1; }
button { background: var(--primary-color); color: white; border: none; cursor: pointer; font-weight: 600; transition: all 0.3s; white-space: nowrap; }
button:hover { background: #5568d3; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4); }
button:active { transform: translateY(0); }
button.secondary { background: #f44336; }
button.secondary:hover { background: #d32f2f; }
button.success { background: #4caf50; }
button.success:hover { background: #45a049; }
button.info { background: #2196f3; }
button.info:hover { background: #1976d2; }
button.warning { background: #ff9800; }
button.warning:hover { background: #fb8c00; }
button.full-width { width: 100%; }
.button-group { display: flex; gap: 10px; margin-bottom: 15px; }
.list { list-style: none; }
.list-item { background: #f5f5f5; padding: 15px; border-radius: 8px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; transition: all 0.3s; }
.list-item:hover { background: #eeeeee; transform: translateX(5px); }
.list-item-content { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.list-item-title { font-weight: 600; color: #333; font-size: 1.1em; }
.list-item-subtitle { font-size: 0.9em; color: #666; }
.list-item-actions { display: flex; gap: 8px; align-items: center; }
.list-item-actions button { padding: 8px 12px; font-size: 0.9em; white-space: nowrap; }
.list-item-actions button.info { padding: 8px 10px; }
.amount { font-weight: 700; color: var(--primary-color); font-size: 1.2em; }
.balance-positive { background: linear-gradient(135deg, #d4f1d4 0%, #a8e6a8 100%); }
.balance-negative { background: linear-gradient(135deg, #ffd4d4 0%, #ffb3b3 100%); }
.balance-neutral { background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); }
.settlement-item { background: #fff3e0; border-left: 4px solid #ff9800; }
.settlement-item.settled { background: #e8f5e9; border-left: 4px solid #4caf50; opacity: 0.7; }
.settlement-arrow { display: inline-block; margin: 0 10px; color: #ff9800; font-weight: 700; font-size: 1.2em; }
.empty-state { text-align: center; padding: 50px 20px; color: #999; font-style: italic; font-size: 1.1em; }
.participants-selector { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 15px 0; }
.participant-chip { padding: 8px 16px; background: #e0e0e0; border-radius: 20px; cursor: pointer; transition: all 0.3s; user-select: none; font-size: 0.95em; }
.participant-chip:hover { background: #d0d0d0; }
.participant-chip.selected { background: var(--primary-color); color: white; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: white; box-shadow: 0 -5px 20px rgba(0,0,0,0.1); display: flex; justify-content: space-around; padding: 10px 0; z-index: 1000; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px; cursor: pointer; transition: all 0.3s; color: #666; border: none; background: none; font-size: 0.85em; }
.nav-item:hover { background: #f5f5f5; transform: none; box-shadow: none; }
.nav-item.active { color: var(--primary-color); }
.nav-icon { font-size: 1.8em; margin-bottom: 3px; }
.section-divider { margin: 25px 0; padding: 12px 0; border-bottom: 2px solid #f0f0f0; }
.quick-action { background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); color: white; padding: 20px; border-radius: 12px; margin-bottom: 20px; cursor: pointer; transition: all 0.3s; }
.quick-action:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4); }
.quick-action h3 { margin-bottom: 8px; font-size: 1.2em; }
.quick-action p { opacity: 0.9; font-size: 0.95em; }
.info-box { background: #e3f2fd; border-left: 4px solid #2196f3; padding: 15px; border-radius: 8px; margin-bottom: 20px; }
.info-box h4 { color: #1976d2; margin-bottom: 8px; }
.info-box p { color: #555; font-size: 0.95em; line-height: 1.5; }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.version-update-btn { min-width: 130px; }
.version-update-btn[disabled] { background: #b0bec5; cursor: not-allowed; opacity: 0.8; transform: none; box-shadow: none; }
.version-update-btn[disabled]:hover { background: #b0bec5; transform: none; box-shadow: none; }
input[type="file"] { display: none; }
.file-upload-label {
    display: inline-block;
    padding: 12px 15px;
    background: #2196f3;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    box-sizing: border-box;
    line-height: 1.5;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.file-upload-label:hover { background: #1976d2; transform: translateY(-2px); }
.expense-table-container { overflow-x: auto; margin-top: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.expense-table { width: 100%; border-collapse: collapse; background: white; font-size: 0.9em; }
.expense-table th, .expense-table td { padding: 12px; text-align: left; border: 1px solid #e0e0e0; }
.expense-table th { background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); color: white; font-weight: 600; position: sticky; top: 0; z-index: 10; }
.expense-table tbody tr:hover { background: #f5f5f5; }
.expense-table .total-row { background: #f9f9f9; font-weight: 700; border-top: 3px solid var(--primary-color); }
.expense-table .positive { color: #4caf50; }
.expense-table .negative { color: #f44336; }
.expense-table .neutral { color: #999; }
.settlement-preview { background: #fff3e0; padding: 20px; border-radius: 8px; margin-top: 20px; border-left: 4px solid #ff9800; }
.settlement-preview h3 { color: #e65100; margin-bottom: 15px; }
.settlement-preview-item { padding: 10px; margin-bottom: 8px; background: white; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; }
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 2000; align-items: center; justify-content: center; padding: 20px; }
.modal.active { display: flex; }
.modal-content { background: white; padding: 30px; border-radius: 15px; max-width: 600px; width: 100%; max-height: 80vh; overflow-y: auto; }
.modal-content h3 { margin-bottom: 20px; color: #333; }
.modal-close { float: right; font-size: 1.5em; cursor: pointer; color: #999; }
.modal-close:hover { color: #333; }
.branding-footer { text-align: center; color: #666; padding: 20px; font-size: 0.9em; background: #f8f9fa; border-top: 1px solid #e0e0e0; margin-top: 20px; }
.update-banner { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, #4caf50 0%, #45a049 100%); color: white; padding: 15px 25px; border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.3); z-index: 3000; display: none; align-items: center; gap: 15px; max-width: 90%; }
.update-banner.show { display: flex; animation: slideDown 0.3s ease-out; }
@keyframes slideDown { from { transform: translateX(-50%) translateY(-100px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
.update-banner button { padding: 8px 16px; background: white; color: #4caf50; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; }
.update-banner button:hover { background: #f0f0f0; }
@media (max-width: 600px) {
    .input-group { flex-direction: column; }
    .header h1 { font-size: 1.8em; }
    .header-logo img { height: 40px; }
    .nav-item { font-size: 0.75em; }
    .nav-icon { font-size: 1.5em; }
    .button-group { flex-direction: column; }
    .expense-table { font-size: 0.75em; }
    .expense-table th, .expense-table td { padding: 8px 4px; }
    .list-item { flex-direction: column; gap: 10px; }
    .list-item-actions { width: 100%; justify-content: space-between; }
    .list-item-actions button { flex: 1; font-size: 0.8em; padding: 8px 6px; }
}
.expense-quantity-mobile-label { display: none; }
@media (max-width: 600px) and (orientation: portrait) {
    #expensesScreen .expense-quantity-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 8px; width: 100%; }
    #expensesScreen .expense-quantity-mobile-label { display: inline-block; font-size: 0.95em; font-weight: 600; color: #555; white-space: nowrap; text-align: right; }
    #expensesScreen .expense-quantity-wrap #expenseQuantity { max-width: 90px !important; width: 90px; flex: 0 0 90px; text-align: right; }
}

/* Toast Notifications */
#toastContainer { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 10px; max-width: 400px; }
.toast { background: white; padding: 16px 20px; border-radius: 12px; box-shadow: 0 8px 25px rgba(0,0,0,0.2); display: flex; align-items: center; gap: 12px; animation: slideInRight 0.3s ease-out; border-left: 4px solid #667eea; min-width: 300px; }
.toast.success { border-left-color: #4caf50; }
.toast.error { border-left-color: #f44336; }
.toast.warning { border-left-color: #ff9800; }
.toast.info { border-left-color: #2196f3; }
.toast-icon { font-size: 1.5em; flex-shrink: 0; }
.toast.success .toast-icon { color: #4caf50; }
.toast.error .toast-icon { color: #f44336; }
.toast.warning .toast-icon { color: #ff9800; }
.toast.info .toast-icon { color: #2196f3; }
.toast-message { flex: 1; color: #333; font-weight: 500; }
.toast-close { cursor: pointer; color: #999; font-size: 1.2em; font-weight: bold; transition: color 0.2s; }
.toast-close:hover { color: #333; }
@keyframes slideInRight { from { transform: translateX(400px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(400px); opacity: 0; } }
.toast.removing { animation: slideOutRight 0.3s ease-out forwards; }
@media (max-width: 600px) {
    #toastContainer { top: 10px; right: 10px; left: auto; bottom: auto; max-width: calc(100vw - 20px); }
    .toast { min-width: auto; width: min(92vw, 400px); }
}
