:root { --primary: #1f2937; --bg-main: #f8fafc; --bg-card: #ffffff; --text-main: #0f172a; --text-sub: #64748b; --border: #e2e8f0; --green: #10b981; --red: #ef4444; --blue: #3b82f6; --orange: #f59e0b; --radius: 16px; --shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; -webkit-tap-highlight-color: transparent; }
body { background: var(--bg-main); color: var(--text-main); display: flex; justify-content: center; min-height: 100vh; }
body.modal-open { overflow: hidden; touch-action: none; }
.hidden { display: none !important; }
.app-container { width: 100%; max-width: 1000px; padding: 20px; padding-bottom: 90px; display: none; }
.app-container.visible { display: block; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(10px);}to{opacity:1;transform:translateY(0);} }
.main-layout { display: flex; flex-direction: column; gap: 20px; }
@media(min-width: 768px){ .main-layout{flex-direction:row;align-items:flex-start;} .layout-left{width:40%;position:sticky;top:20px;} .layout-right{width:60%;} }
header { display: flex; flex-direction: column; gap: 15px; margin-bottom: 24px; position:relative; }
.header-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.user-info-stack { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.user-row-main { display: flex; align-items: center; gap: 8px; }
#user-greeting { font-size: 1.25rem; font-weight: 700; color: var(--text-main); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-meta { display:flex; align-items:center; gap:8px; margin-top: 4px; flex-wrap: wrap; }
.badge { font-size: 0.7rem; background: #f1f5f9; padding: 3px 8px; border-radius: 6px; font-weight: 600; text-transform: uppercase; color: var(--text-sub); border: 1px solid var(--border); }
.badge-internal { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; font-weight: 700; margin-left: 5px; letter-spacing: 0.5px; }
.clock-text { font-size: 0.75rem; font-family: monospace; font-weight:600; color:var(--text-sub); background:#f1f5f9; padding:3px 8px; border-radius:6px; white-space: nowrap; border: 1px solid var(--border); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.green { background: var(--green); } .status-dot.red { background: var(--red); }
.header-right-panel { display: flex; align-items: center; gap: 10px; position: relative; }
.view-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; background: #fff; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); transition: 0.2s; white-space: nowrap; height: 36px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); flex-shrink: 0; }
.view-toggle:hover { background: #f8fafc; }
.toggle-track { width: 32px; height: 18px; background: #cbd5e1; border-radius: 10px; position: relative; transition: 0.3s; }
.toggle-thumb { width: 14px; height: 14px; background: white; border-radius: 50%; position: absolute; top: 2px; left: 2px; transition: 0.3s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.view-toggle.active .toggle-track { background: var(--blue); } .view-toggle.active .toggle-thumb { transform: translateX(14px); }
#view-mode-label { font-size: 0.75rem; font-weight: 600; color: var(--text-sub); }
.mobile-menu-dropdown { position: absolute; top: 50px; right: 0; background: white; border-radius: 16px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.01); border: 1px solid var(--border); width: 200px; z-index: 500; padding: 8px; animation: fadeIn 0.2s ease; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; cursor: pointer; font-size: 0.95rem; font-weight: 500; color: var(--text-main); transition: 0.2s; }
.menu-item:hover { background: #f1f5f9; }
.menu-item .material-symbols-rounded { font-size: 20px; color: var(--text-sub); }
.menu-item.danger { color: var(--red); } .menu-item.danger .material-symbols-rounded { color: var(--red); }
.menu-divider { height:1px; background:var(--border); margin: 6px 0; }
.relative { position: relative; }
.badge-count { position: absolute; top: -5px; right: -5px; background: var(--red); color: white; border-radius: 50%; width: 18px; height: 18px; font-size: 0.7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid white; }
.project-bar { background: var(--bg-card); padding: 10px 16px; border-radius: var(--radius); display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.project-bar select { border: none; background: transparent; font-weight: 600; flex: 1; outline: none; font-size: 0.95rem; color: var(--primary); cursor: pointer; }
.icon-grey { color: #94a3b8; font-size: 1.25rem; }
.period-indicator-row { display: flex; justify-content: center; margin-bottom: 12px; }
.period-badge { background: #f1f5f9; color: var(--text-main); border: 1px solid var(--border); padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 6px; cursor: pointer; transition: 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.period-badge:hover { background: #e2e8f0; }
.dashboard-stats { display: flex; flex-direction: column; gap: 12px; }
.stat-card { border-radius: 18px; padding: 24px 20px; position: relative; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: transform 0.1s; }
.stat-card:active { transform: scale(0.98); }
.balance-card { background: #1f2937; color: white; display: flex; align-items: center; gap: 16px; }
.icon-box-dark { width: 48px; height: 48px; background: rgba(255,255,255,0.15); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-box-dark span { font-size: 24px; color: white; }
.stat-info { display: flex; flex-direction: column; min-width: 0; }
.stat-info .label { font-size: 0.85rem; opacity: 0.8; font-weight: 500; margin-bottom: 4px; }
.stat-info h3, .stat-card h3 { font-size: clamp(1.4rem, 4vw, 1.8rem); font-weight: 700; margin: 0; line-height: 1.1; word-break: break-all; }
.stat-row { display: flex; gap: 12px; }
.stat-row .stat-card { flex: 1; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; height: 110px; }
.income-card { background: #e0f2f1; color: #004d40; }
.expense-card { background: #ffebee; color: #b71c1c; }
.stat-header { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.stat-header .label { font-size: 0.85rem; font-weight: 600; }
.stat-header .arrow-down { font-size: 18px; font-weight: 700; color: #00695c; }
.stat-header .arrow-up { font-size: 18px; font-weight: 700; color: #c62828; }
.btn-black-pill { width: 100%; background: #000000; color: white; border-radius: 50px; padding: 16px; font-size: 1rem; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); transition: 0.2s; }
.btn-black-pill:active { transform: scale(0.98); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; margin-top: 24px; }
.section-header.header-with-actions { margin-bottom: 0; } 
.section-header h3 { font-size: 1.1rem; font-weight: 600; }
.accounts-scroller { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; min-height: 100px; align-items: center; }
.account-card { min-width: 150px; height: 96px; border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; justify-content: space-between; color: white !important; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.acc-bank { background: linear-gradient(135deg, #4f46e5, #3b82f6); } .acc-cash { background: linear-gradient(135deg, #10b981, #059669); }
.acc-wallet { background: linear-gradient(135deg, #8b5cf6, #6d28d9); } .acc-credit { background: linear-gradient(135deg, #f59e0b, #d97706); }
.acc-name { font-size: 0.9rem; font-weight: 500; opacity: 0.95; color: white; } .acc-bal { font-size: 1.2rem; font-weight: 700; color: white; }
button { cursor: pointer; border: none; font-family: inherit; transition: 0.2s; outline: none; }
button:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; padding: 12px; border-radius: var(--radius); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.95rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.btn-primary:active { transform: translateY(1px); box-shadow: none; }
.btn-secondary { background: white; border: 1px solid var(--border); color: var(--text-main); padding: 10px; border-radius: var(--radius); font-weight: 600; font-size: 0.9rem; }
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-danger { background: #fee2e2; color: #b91c1c; padding: 10px; border-radius: var(--radius); font-weight: 600; }
.btn-text { background: none; color: var(--blue); font-weight: 600; font-size: 0.9rem; padding: 4px 8px; border-radius: 8px; }
.btn-text:hover { background: #eff6ff; }
.btn-icon { background: white; border: 1px solid var(--border); width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--text-main); box-shadow: 0 1px 2px rgba(0,0,0,0.05); flex-shrink: 0; }
.btn-icon:hover { background: #f8fafc; border-color: #cbd5e1; color: var(--blue); }
.btn-icon-small { width: 30px; height: 30px; background: #f1f5f9; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-main); border: 1px solid transparent; }
.btn-icon-small:hover { background: white; border-color: var(--border); }
.btn-icon-square { width: 48px; background: var(--primary); color: white; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-dark { background: #334155; color: white; padding: 10px; border-radius: var(--radius); width: 100%; }
.settlement-btn-group { display: flex; gap: 10px; }
.btn-settle { flex: 1; border: 1px solid var(--border); background: white; color: var(--text-sub); border-radius: 8px; padding: 8px 12px; font-weight: 600; font-size: 0.9rem; }
.btn-settle:hover { background: #f8fafc; color: var(--primary); }
.btn-settle.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.settlement-action-row { display: flex; justify-content: space-between; align-items: center; padding: 8px; background: #fff; border-radius: 8px; margin-top: 8px; border: 1px solid var(--border); }
.status-text { font-size: 0.85rem; font-weight: 600; color: var(--text-sub); }
.btn-action-green { background: #dcfce7; color: #166534; padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 0.8rem; border: 1px solid #bbf7d0; }
.btn-action-red { background: #fee2e2; color: #991b1b; padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 0.8rem; border: 1px solid #fecaca; }
.settlement-summary-box { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.s-row { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--text-sub); margin-bottom: 4px; }
.s-row.highlight { color: var(--primary); font-weight: 700; font-size: 1rem; margin-top: 6px; padding-top: 6px; border-top: 1px solid #f1f5f9; }
.settlement-history-item { font-size: 0.8rem; padding: 12px 8px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items:center; cursor: pointer; }
.settlement-history-item:hover { background: #f8fafc; }
.settlement-history-item:last-child { border-bottom: none; }
.sh-date { color: var(--text-sub); } .sh-amt { font-weight: 600; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; position: relative; padding-right: 10px; }
.btn-close-pro { position: static; width: 36px; height: 36px; border-radius: 50%; background: #f1f5f9; color: var(--text-sub); display: flex; align-items: center; justify-content: center; transition: 0.2s; border: 1px solid var(--border); flex-shrink: 0; margin-left: 15px; }
.btn-close-pro:hover { background: white; color: var(--primary); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.form-card, .settings-card { background: white; border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); margin-bottom: 16px; box-shadow: var(--shadow); }
.settings-card h4 { display: flex; align-items: center; gap: 8px; font-size: 1rem; color: var(--primary); margin-bottom: 16px; font-weight: 600; }
.form-group { margin-bottom: 16px; } .form-group label { display: block; font-size: 0.9rem; font-weight: 500; color: var(--text-sub); margin-bottom: 8px; }
.checkbox-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } 
.check-item { display: flex; align-items: center; gap: 8px; background: #f8fafc; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); width: 100%; }
.check-item input { width: auto; margin: 0; }
.check-item label { margin: 0; font-weight: 600; color: var(--text-main); font-size: 0.9rem; cursor: pointer; }
.form-row { display: flex; gap: 16px; } .flex-grow { flex-grow: 1; } .w-30 { width: 30%; }
.full-width { width: 100%; } .mt-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1rem; }
input, select, textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; font-size: 1rem; background: #fff; outline: none; transition: 0.2s; color: var(--text-main); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
input:disabled, select:disabled, textarea:disabled { background-color: #f1f5f9; color: #64748b; border-color: transparent; cursor: default; }
.textarea-pro { resize: vertical; min-height: 80px; font-family: inherit; }
.input-with-action { display: flex; gap: 10px; }
.segment-control { display: flex; background: #f1f5f9; padding: 4px; border-radius: 14px; margin-bottom: 24px; border: 1px solid var(--border); }
.segment-control input { display: none; } .segment-control label { flex: 1; text-align: center; padding: 10px; font-size: 0.9rem; font-weight: 600; border-radius: 10px; cursor: pointer; color: var(--text-sub); transition: 0.2s; }
.segment-control input:checked + label { background: white; color: var(--primary); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.transactions-list { background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow); }
.transactions-list .section-header { padding: 16px 20px; margin: 0; border-bottom: 1px solid var(--border); background: #f8fafc; }
.transaction-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); cursor: pointer; transition: 0.1s; }
.transaction-item:hover { background: #f8fafc; } .transaction-item:last-child { border-bottom: none; }
.t-icon-box { width: 40px; height: 40px; background: #f1f5f9; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--text-sub); margin-right: 14px; flex-shrink: 0; }
.t-info h4 { font-size: 0.95rem; font-weight: 600; color: var(--primary); margin-bottom: 2px; } .t-info p { font-size: 0.8rem; color: var(--text-sub); }
.t-amount { font-weight: 700; font-size: 1rem; } .amt-inc { color: var(--green); } .amt-exp { color: var(--text-main); }
.filters-container { background: var(--bg-card); padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 20px; box-shadow: var(--shadow); }
.search-box { position: relative; margin-bottom: 14px; }
.search-box span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-sub); } .search-box input { padding-left: 44px; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tab { background: none; color: var(--text-sub); padding: 8px 16px; font-weight: 600; border-radius: 8px; font-size: 0.9rem; }
.tab.active { background: #f1f5f9; color: var(--primary); }
.filter-row { display: flex; gap: 10px; }
.chip-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { background: #f1f5f9; padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 500; display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); }
.chip-del-btn { cursor: pointer; color: #94a3b8; font-size: 16px; display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; transition: 0.2s; }
.chip-del-btn:hover { background: #fee2e2; color: #ef4444; }

/* Enhanced Tags */
.refund-tag, .debt-tag { font-size: 0.65rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; margin-left: 6px; border: 1px solid transparent; text-transform: uppercase; letter-spacing: 0.3px; }
.refund-tag.done, .debt-tag.done { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.refund-tag.pending { background: #fef9c3; color: #854d0e; border-color: #fde047; }
.debt-tag.lent { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.debt-tag.borrowed { background: #e0f2fe; color: #075985; border-color: #bae6fd; }

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 1000; display: none; align-items: center; justify-content: center; }
.modal-content { background: #ffffff; width: 95%; max-width: 480px; border-radius: 24px; padding: 28px; max-height: 90vh; overflow-y: auto; animation: fadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); border: 1px solid rgba(255,255,255,0.1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-footer { display: flex; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.scroll-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; background: white; }
.scroll-list.short { max-height: 200px; }
.suggestions-dropdown { position: absolute; top: 100%; left: 0; width: 100%; background: white; border: 1px solid var(--border); border-radius: 12px; max-height: 200px; overflow-y: auto; z-index: 2000; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); display: none; margin-top: 6px; }
.suggestions-dropdown div { padding: 12px 16px; cursor: pointer; font-size: 0.95rem; border-bottom: 1px solid #f1f5f9; }
.suggestions-dropdown div:hover { background: #f8fafc; }
.login-overlay { display: flex; z-index: 9999; justify-content: center; align-items: center; position: fixed; top:0; left:0; width:100%; height:100%; background:var(--bg-main); } 
.login-card { width: 90%; max-width: 380px; padding: 48px 32px; text-align: center; background: white; border-radius: 24px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04); }
.login-icon { width: 72px; height: 72px; background: var(--primary); color: white; border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.login-icon span { font-size: 32px; }
.input-group { position: relative; margin-bottom: 16px; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-sub); } .input-group input { padding-left: 44px; }
.chart-container { display: flex; flex-direction: column; align-items: center; gap: 20px; margin-bottom: 20px; padding: 20px; background: #f8fafc; border-radius: 16px; border: 1px solid var(--border); }
.pie-chart { width: 160px; height: 160px; border-radius: 50%; background: #e2e8f0; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; font-size: 0.85rem; }
.legend-item { display: flex; align-items: center; gap: 6px; background: white; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; }
.list-item-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.list-item-row.clickable { cursor: pointer; transition: 0.2s; }
.list-item-row.clickable:hover { background: #f8fafc; }
.list-item-row.readonly { opacity: 0.6; cursor: default; }
.row-actions { display: flex; gap: 10px; } .action-icon { color: var(--text-sub); cursor: pointer; font-size: 1.2rem; transition: 0.2s; }
.action-icon:hover { color: var(--primary); }
.z-high { z-index: 2000 !important; } .z-highest { z-index: 3000 !important; }
.project-badge { background: #f1f5f9; padding: 6px 10px; border-radius: 8px; font-size: 0.8rem; margin-bottom: 16px; display: inline-block; font-weight: 600; color: var(--text-sub); border: 1px solid var(--border); }
.account-balance-hint { font-size:0.8rem; color:var(--text-sub); margin-top:6px; font-weight:600; }
.compare-body { padding: 5px; }
.user-cards-row { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 24px; scrollbar-width: none; }
.user-summary-card { min-width: 120px; background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform 0.2s; cursor: pointer; }
.user-summary-card:hover { transform: translateY(-2px); }
.user-summary-card.active { border-color: var(--blue); background: #eff6ff; box-shadow: 0 4px 10px rgba(59, 130, 246, 0.15); }
.user-summary-card h4 { font-size: 0.9rem; color: var(--text-main); margin-bottom: 6px; }
.user-summary-card h2 { font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.compare-list { display: flex; flex-direction: column; gap: 14px; }
.compare-item { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; transition: 0.2s; cursor: pointer; }
.compare-item:hover { border-color: var(--blue); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.compare-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cat-name { font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 5px; }
.cat-total { font-weight: 700; color: var(--text-main); font-size: 0.95rem; }
.compare-bar-stack { height: 12px; background: #f1f5f9; border-radius: 6px; overflow: hidden; display: flex; }
.compare-seg { height: 100%; transition: width 0.3s; }
.grid-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.account-list-stack { display: flex; flex-direction: column; gap: 12px; }
.account-item-box { background: white; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: 0.3s; }
.account-item-header { padding: 16px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; background: #fff; }
.account-item-header:hover { background: #f8fafc; }
.account-item-header h4 { font-size: 1rem; font-weight: 600; margin: 0; color: var(--text-main); }
.account-item-header p { font-size: 0.85rem; color: var(--text-sub); margin: 2px 0 0 0; }
.account-item-header .bal { font-size: 1.15rem; font-weight: 700; color: var(--primary); }
.account-inline-form { padding: 16px; background: #f8fafc; border-top: 1px solid var(--border); display: none; }
.account-inline-form.active { display: block; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.mb-3 { margin-bottom: 1rem; }
.cd-stats-row { display: flex; justify-content: space-between; margin-top: 10px; align-items: flex-end; padding: 0 5px; gap: 15px; }
.stat-block-left, .stat-block-right { flex: 1; min-width: 0; }
.stat-block-right { text-align: right; }
.cd-stats-row h2 { font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 700; margin: 0; line-height: 1.1; color:var(--primary); word-break: break-all; }
.cd-stats-row .label { font-size:0.85rem; color:var(--text-sub); font-weight:600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; display: block; }
.cd-meta-grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 10px 5px; }
.meta-item { display: flex; flex-direction: column; background: white; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); min-width: 45%; flex: 1; }
.meta-item.full { width: 100%; display: flex; flex-direction: row; justify-content: space-between; align-items: center; }
.meta-item .label { font-size: 0.75rem; color: var(--text-sub); font-weight: 600; margin-bottom: 2px; }
.meta-item .value-text { font-size: 1rem; font-weight: 700; color: var(--primary); }
.sort-dropdown { position: absolute; top: 40px; right: 0; background: white; border: 1px solid var(--border); border-radius: 12px; width: 200px; box-shadow: var(--shadow); z-index: 50; padding: 5px; animation: fadeIn 0.2s ease; }
.sort-item { padding: 10px 14px; font-size: 0.9rem; font-weight: 500; cursor: pointer; border-radius: 8px; color: var(--text-main); }
.sort-item:hover { background: #f8fafc; }
.sort-item.selected { background: #eff6ff; color: var(--blue); font-weight: 600; }

/* --- NEW: Full Screen Settlement Modal Overrides --- */
#settlementsModal .modal-content {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}
#settlementsModal .modal-header {
    background: #ffffff;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    margin-bottom: 0;
}
#settlement-user-cards-container {
    padding: 16px 20px 0 20px;
    flex-shrink: 0;
    background: #f8fafc;
}
#settlement-controls-container {
    padding: 0 20px 10px 20px;
    margin-bottom: 0 !important;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: #f8fafc;
}
#settlement-people-container {
    padding: 16px 20px;
    flex-grow: 1;
    overflow-y: auto;
}
#settlement-detail-container {
    padding: 0;
    flex-grow: 1;
    overflow-y: auto;
    background: #ffffff;
}
/* Report List Override inside Settlement Detail */
#settlements-detail-list.report-list {
    max-height: none !important;
    overflow-y: visible !important;
    border: none;
    border-radius: 0;
}

/* --- NEW: 2-Column Responsive Grid --- */
.people-grid {
    display: grid;
    /* 140px ensures two columns on small mobile (320px+) */
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    max-height: none !important;
    overflow-y: visible !important;
}

/* Enhanced Settlement Cards for Grid */
.settlement-person-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-left: 5px solid #cbd5e1; 
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 130px;
    justify-content: space-between;
    position: relative;
}
.settlement-person-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

.sp-card-red { border-left-color: var(--red); background: linear-gradient(145deg, #ffffff 40%, #fef2f2 100%); border-color: #fecaca; }
.sp-card-green { border-left-color: var(--green); background: linear-gradient(145deg, #ffffff 40%, #f0fdf4 100%); border-color: #bbf7d0; }
.sp-card-mixed { border-left-color: var(--orange); background: linear-gradient(145deg, #ffffff 40%, #fffbeb 100%); border-color: #fde68a; }
.sp-card-empty { border-left-color: #cbd5e1; background: #ffffff; border-color: var(--border); opacity: 0.8; }

.sp-name { font-weight: 700; color: var(--primary); font-size: 1rem; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 6px; }

.sp-stat-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: auto; text-align: left; }
.sp-stat-item { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.6); border: 1px solid rgba(0,0,0,0.03); padding: 4px 6px; border-radius: 6px; }
.sp-stat-label { font-size: 0.65rem; color: var(--text-sub); font-weight: 600; text-transform: uppercase; margin-bottom:0; }
.sp-stat-val { font-size: 0.85rem; font-weight: 700; color:var(--text-main); }

.sp-bal-row { padding-top: 8px; border-top: 1px solid rgba(0,0,0,0.05); font-size: 0.9rem; font-weight: 700; color: var(--primary); display: flex; justify-content: space-between; align-items: center; }
.green-text { color: var(--green); } .red-text { color: var(--red); }

/* Animation for Account Pulse */
@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); border-color: #ef4444; }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); border-color: #fecaca; }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); border-color: #ef4444; }
}
.attention-pulse {
  animation: pulse-border 2s infinite;
  border: 1px solid #ef4444 !important;
  background-color: #fff1f2 !important;
}