: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; overflow-x: hidden; }
body.modal-open { overflow: hidden; touch-action: none; }
body.auth-booting .login-overlay { display: none !important; }
.boot-splash { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; background: var(--bg-main); color: var(--text-main); }
.boot-card { display: flex; flex-direction: column; align-items: center; gap: 14px; font-weight: 800; color: var(--text-sub); }
.hidden { display: none !important; }
.ai-processing-overlay { position: fixed; inset: 0; z-index: 12000; background: rgba(15, 23, 42, 0.72); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.ai-processing-panel { width: min(90vw, 320px); background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 28px 24px; text-align: center; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25); }
.ai-processing-panel h3 { font-size: 1.05rem; margin: 14px 0 6px; color: var(--text-main); }
.ai-processing-panel p { color: var(--text-sub); font-size: 0.9rem; line-height: 1.4; min-height: 20px; }
.ai-progress-ring { width: 58px; height: 58px; border-radius: 50%; border: 5px solid #e2e8f0; border-top-color: var(--blue); margin: 0 auto; animation: aiSpin 0.85s linear infinite; }
@keyframes aiSpin { to { transform: rotate(360deg); } }
.app-container { width: 100%; max-width: 1000px; min-width: 0; 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; }
.offline-banner { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 13000; width: min(calc(100vw - 24px), 976px); display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid #f59e0b; border-radius: 10px; background: #fffbeb; color: #92400e; font-size: .82rem; font-weight: 700; line-height: 1.35; box-shadow: 0 10px 24px rgba(146, 64, 14, 0.16); }
.offline-banner .material-symbols-rounded { font-size: 19px; flex-shrink: 0; }
.view-mode-toggle { display: flex; background: #e2e8f0; border-radius: 12px; padding: 4px; width: fit-content; flex-shrink: 1; min-width: 0; }
.view-mode-toggle button { background: transparent; color: #64748b; border-radius: 9px; padding: 8px 14px; font-weight: 800; font-size: .82rem; }
.view-mode-toggle button.active { background: #fff; color: #0f172a; box-shadow: 0 1px 3px rgba(15,23,42,.12); }
body.household-mode .view-mode-toggle { background: #dbeafe; border: 1px solid #93c5fd; }
body.household-mode .view-mode-toggle button.active { background: #1d4ed8; color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .22); }
.view-mode-toggle-inline { margin-bottom: 12px; }
.header-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-width: 0; }
.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; }
.badge-transfer { background: #ecfccb; color: #3f6212; border-color: #bef264; }
.badge-ai { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.txn-type-label { font-size: 0.65rem; padding: 2px 6px; border-radius: 5px; font-weight: 800; margin-left: 6px; border: 1px solid transparent; white-space: nowrap; }
.txn-label-lent { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.txn-label-refund { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.txn-label-borrowed { background: #eff6ff; color: #0369a1; border-color: #bfdbfe; }
.txn-label-investment { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.txn-label-lent-repay { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.txn-label-refund-repay { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.txn-label-borrowed-repay { background: #eff6ff; color: #0369a1; border-color: #bfdbfe; }
.txn-label-investment-return { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.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; justify-content: flex-end; gap: 10px; position: relative; margin-left: auto; }
.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-label { flex: 1; }
.mobile-menu-dropdown .badge-count { position: static; width: auto; min-width: 18px; padding: 0 5px; border-radius: 999px; }
.notification-page-list { display: flex; flex-direction: column; gap: 10px; }
.notification-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fff; display: flex; gap: 10px; align-items: flex-start; }
.notification-card.unread { border-color: #bfdbfe; background: #eff6ff; }
.notification-card-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: #e0f2fe; color: #0369a1; flex: 0 0 auto; }
.notification-card-body { min-width: 0; flex: 1; }
.notification-card-title { font-weight: 700; font-size: 0.9rem; color: var(--text-main); margin-bottom: 3px; }
.notification-card-text { font-size: 0.84rem; color: var(--text-sub); line-height: 1.35; overflow-wrap: anywhere; }
.notification-card-date { font-size: 0.74rem; color: #94a3b8; margin-top: 6px; }
.notification-empty { padding: 24px 12px; text-align: center; color: var(--text-sub); }
.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; }
.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; min-width: 0; }
.stat-card:active { transform: scale(0.98); }
.balance-card { background: #1f2937; color: white; display: flex; align-items: center; gap: 16px; }
body.household-mode .balance-card { background: #1d4ed8; border: 1px solid #60a5fa; box-shadow: 0 12px 26px rgba(37, 99, 235, .22); }
.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; flex: 1; }
.stat-info .label { font-size: 0.85rem; opacity: 0.8; font-weight: 500; margin-bottom: 4px; line-height: 1.2; overflow-wrap: anywhere; }
.stat-info h3, .stat-card h3 { font-size: clamp(1.2rem, 5vw, 1.8rem); font-weight: 700; margin: 0; line-height: 1.12; overflow-wrap: anywhere; word-break: break-word; max-width: 100%; }
.stat-row { display: flex; gap: 12px; }
.stat-row .stat-card { flex: 1 1 0; padding: 18px 16px; display: flex; flex-direction: column; justify-content: space-between; min-height: 112px; height: auto; min-width: 0; }
.income-card { background: #e0f2f1; color: #004d40; }
.expense-card { background: #ffebee; color: #b71c1c; }
body.household-mode .income-card { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }
body.household-mode .expense-card { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.stat-header { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 8px; min-width: 0; }
.stat-header .label { font-size: 0.85rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; min-width: 0; }
.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; }
@media(max-width: 380px) {
  .view-mode-toggle button { padding: 8px 10px; }
  .header-right-panel { gap: 6px; }
  .btn-icon { width: 38px; height: 38px; border-radius: 10px; }
}
@media(max-width: 520px) {
  .app-container { padding-left: 12px; padding-right: 12px; }
  .balance-card { padding: 18px 16px; gap: 12px; }
  .icon-box-dark { width: 42px; height: 42px; }
  .stat-row { gap: 8px; }
  .stat-row .stat-card { padding: 14px 12px; min-height: 118px; }
  .stat-header { gap: 5px; }
  .stat-header .material-symbols-rounded { flex: 0 0 auto; }
  body.household-mode .stat-info .label,
  body.household-mode .stat-header .label { font-size: 0.74rem; }
  body.household-mode .stat-info h3,
  body.household-mode .stat-card h3 { font-size: clamp(1rem, 6vw, 1.35rem); }
  .modal-content { width: calc(100vw - 20px); padding: 20px; }
  .modal-footer > button { flex: 1 1 130px; min-width: 0; }
  .form-row { flex-direction: column; gap: 0; }
  .input-with-action { gap: 8px; }
  .settlement-actions-shell,
  .reports-filter-actions,
  .row-actions { flex-wrap: wrap; }
}
.btn-dark { background: #334155; color: white; padding: 10px; border-radius: var(--radius); width: 100%; }
.settlement-btn-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; width: 100%; }
.btn-settle { min-width: 0; border: 1px solid var(--border); background: white; color: var(--text-sub); border-radius: 8px; padding: 8px 10px; font-weight: 600; font-size: 0.9rem; white-space: normal; line-height: 1.2; }
.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); }
@media(max-width: 420px) {
  .settlement-btn-group { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .btn-settle { font-size: 0.78rem; padding: 8px 6px; }
}
.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; } .form-row > * { min-width: 0; } .flex-grow { flex-grow: 1; min-width: 0; } .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; min-width: 0; }
.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; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); cursor: pointer; transition: 0.1s; }
.transaction-item > div:first-child { flex: 1 1 auto; min-width: 0; }
.transaction-item:hover { background: #f8fafc; } .transaction-item:last-child { border-bottom: none; }
.transaction-item-transfer { background: linear-gradient(90deg, #f7fee7 0%, #ffffff 14%); border-left: 4px solid #84cc16; }
.transaction-item-transfer:hover { background: linear-gradient(90deg, #ecfccb 0%, #f8fafc 18%); }
.transaction-item-lent { background: linear-gradient(90deg, #fff1f2 0%, #ffffff 14%); border-left: 4px solid #e11d48; }
.transaction-item-lent:hover { background: linear-gradient(90deg, #ffe4e6 0%, #f8fafc 18%); }
.transaction-item-borrowed { background: linear-gradient(90deg, #eff6ff 0%, #ffffff 14%); border-left: 4px solid #0284c7; }
.transaction-item-borrowed:hover { background: linear-gradient(90deg, #dbeafe 0%, #f8fafc 18%); }
.transaction-row-actions { display: flex; align-items: center; gap: 10px; margin-left: 12px; flex-shrink: 0; }
.transaction-reorder-btn { width: 30px; height: 30px; padding: 0; flex-shrink: 0; }
.transaction-reorder-btn:disabled { opacity: 0.28; cursor: default; }
.transaction-clone-btn { opacity: .72; }
.transaction-item:hover .transaction-clone-btn { opacity: 1; }
.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-icon-box-transfer { background: #d9f99d; color: #3f6212; }
.t-icon-box-lent { background: #ffe4e6; color: #be123c; }
.t-icon-box-borrowed { background: #dbeafe; color: #0369a1; }
.t-info { min-width: 0; overflow: hidden; }
.t-info h4 { font-size: 0.95rem; font-weight: 600; color: var(--primary); margin-bottom: 2px; overflow-wrap: anywhere; } .t-info p { font-size: 0.8rem; color: var(--text-sub); overflow-wrap: anywhere; }
.t-amount { font-weight: 700; font-size: 1rem; text-align: right; white-space: nowrap; flex-shrink: 0; } .amt-inc { color: var(--green); } .amt-exp { color: var(--text-main); }
.t-amount-details { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.15; white-space: nowrap; }
.t-amount-spent { font-size: 0.8rem; font-weight: 600; color: #475569; }
.t-amount-paid { font-size: 0.8rem; font-weight: 700; color: #b91c1c; }
.t-amount-received { font-size: 0.8rem; font-weight: 700; color: #047857; }
.t-amount-pending { font-size: 0.78rem; font-weight: 700; color: #92400e; }
.t-amount-balance { font-size: 0.95rem; font-weight: 700; color: var(--text-main); }
.t-amount-balance-current { font-size: 1.1rem; }
.t-amount-balance-total { font-size: 0.75rem; color: #94a3b8; margin-left: 4px; }
.t-amount-transfer { color: #3f6212; }
.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; padding-right: 48px; }
.filter-toggle-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 10px; background: #f8fafc; color: var(--text-sub); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; padding: 0; }
.filter-toggle-btn .material-symbols-rounded { font-size: 20px; }
.filter-toggle-btn.active { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.transaction-filter-panel { display: grid; gap: 10px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; 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; }
.filter-row select, .filter-row input { min-width: 0; }
.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; }
.danger-soft { color: #b91c1c; background: #fef2f2; }
.subcategory-editor-list { display: grid; gap: 8px; margin-top: 12px; }
.subcategory-editor-row { display: grid; grid-template-columns: 1fr 38px 38px; gap: 8px; align-items: center; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px; }
.subcategory-editor-row input { min-width: 0; border: 0; background: transparent; padding: 7px 8px; font-weight: 600; color: #0f172a; }
.subcategory-editor-row input:focus { background: #fff; box-shadow: 0 0 0 2px rgba(59,130,246,.18); }
.subcategory-empty { color: #94a3b8; font-size: .86rem; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 12px; text-align: center; }

/* 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: #dcfce7; color: #166534; border-color: #bbf7d0; }
.debt-tag.pending { background: #fef9c3; color: #854d0e; border-color: #fde047; }
.refund-tag.refund, .debt-tag.refund { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.debt-tag.lent { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.debt-tag.borrowed { background: #eff6ff; color: #0369a1; border-color: #bfdbfe; }

.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; flex-wrap: wrap; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.modal-footer .btn-icon-small { width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; }
.route-page { background: #f8fafc; backdrop-filter: none; align-items: stretch; justify-content: stretch; }
.route-page .modal-content { width: 100%; height: 100%; max-width: none; max-height: none; border-radius: 0; padding: 0; display: flex; flex-direction: column; background: #f8fafc; box-shadow: none; border: none; }
.route-page .modal-header { background: #ffffff; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; margin-bottom: 0; }
#settingsModal .modal-content { overflow-y: auto; }
#settingsModal .modal-content > :not(.modal-header) { margin-left: 20px; margin-right: 20px; }
#settingsModal .modal-content > :last-child { margin-bottom: 20px; }
.reports-page { padding: 18px; overflow-y: auto; position: relative; overscroll-behavior-y: auto; }
.reports-native-refresh { --pull-progress: 0; position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; z-index: 14000; width: 42px; height: 42px; margin-left: -21px; border-radius: 50%; background: #fff; border: 1px solid #e2e8f0; box-shadow: 0 10px 24px rgba(15,23,42,.16); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transform: translateY(calc(-58px + (var(--pull-progress) * 58px))) scale(calc(.82 + (var(--pull-progress) * .18))); transition: opacity .14s ease, transform .14s ease; }
.reports-native-refresh.visible { opacity: 1; }
.reports-native-refresh-ring { width: 24px; height: 24px; border-radius: 50%; border: 3px solid #e2e8f0; border-top-color: var(--blue); transform: rotate(calc(var(--pull-progress) * 270deg)); }
.reports-native-refresh.armed .reports-native-refresh-ring,
.reports-native-refresh.refreshing .reports-native-refresh-ring { animation: aiSpin .85s linear infinite; }
.reports-route-header h3 { font-size: 1.05rem; }
.reports-filter-panel { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); margin-bottom: 14px; }
.reports-filter-head { margin-bottom: 12px; align-items: center; }
.reports-filter-head .report-collapse-icon { min-height: 34px; width: 34px; padding: 0; }
.reports-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.reports-filter-grid .form-group { margin: 0; }
.reports-toggle-group { display: flex; flex-direction: column; gap: 6px; }
.reports-toggle { min-height: 42px; border: 1px solid #fecaca; border-radius: 12px; background: #fff1f2; color: #991b1b; font-weight: 800; cursor: pointer; }
.reports-toggle.active { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.reports-filter-actions { display: flex; gap: 8px; align-items: center; }
.reports-filter-actions button { min-height: 42px; padding: 0 14px; }
.reports-section { margin-bottom: 14px; }
.reports-section-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.reports-section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.reports-section-head h3 { font-size: 1rem; margin: 0; color: #0f172a; }
.reports-section-head p { margin: 3px 0 0; color: #64748b; font-size: 0.82rem; line-height: 1.35; }
.reports-overview-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.reports-metric-card { border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; background: linear-gradient(180deg, #f8fafc 0%, #fff 100%); min-width: 0; }
.reports-metric-card span { display: block; color: #64748b; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.reports-metric-card strong { display: block; color: #0f172a; font-size: 1.05rem; line-height: 1.2; word-break: break-word; }
.reports-metric-card small { display: block; color: #94a3b8; font-size: 0.74rem; margin-top: 5px; }
.reports-metric-card.green strong, .reports-amount-green { color: #047857; }
.reports-metric-card.red strong, .reports-amount-red { color: #dc2626; }
.reports-metric-card.amber strong, .reports-amount-amber { color: #b45309; }
.reports-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.reports-tab { border: 1px solid #dbe3f0; background: #f8fafc; color: #334155; border-radius: 999px; padding: 8px 12px; font-weight: 800; cursor: pointer; font-size: .82rem; }
.reports-tab.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.reports-table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 12px; }
.reports-table { width: 100%; border-collapse: collapse; font-size: .84rem; min-width: 760px; background: #fff; }
.reports-table th { text-align: left; padding: 10px; background: #f8fafc; color: #475569; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.reports-table td { padding: 11px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; color: #0f172a; }
.reports-table tr:last-child td { border-bottom: none; }
.reports-table button.linkish { border: none; background: transparent; color: #2563eb; font-weight: 800; cursor: pointer; padding: 0; text-align: left; }
.reports-compact-list { display: grid; gap: 10px; }
.reports-row-card { border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; background: #fff; display: grid; gap: 8px; }
.reports-row-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.reports-row-card h4 { margin: 0; font-size: .95rem; color: #0f172a; }
.reports-row-card p { margin: 2px 0 0; color: #64748b; font-size: .78rem; }
.reports-row-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-size: .8rem; }
.reports-row-grid span { color: #64748b; display: block; font-size: .72rem; text-transform: uppercase; font-weight: 800; }
.reports-row-grid b { color: #0f172a; display: block; margin-top: 2px; }
.reports-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: .72rem; font-weight: 900; white-space: nowrap; }
.reports-badge.green { background: #dcfce7; color: #166534; }
.reports-badge.red { background: #fee2e2; color: #991b1b; }
.reports-badge.amber { background: #fef3c7; color: #92400e; }
.reports-badge.blue { background: #dbeafe; color: #1d4ed8; }
.reports-empty { border: 1px dashed #cbd5e1; border-radius: 12px; padding: 18px; text-align: center; color: #64748b; background: #f8fafc; }
.reports-entry-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.reports-entry-button { border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; padding: 14px; text-align: left; display: grid; gap: 8px; cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; min-width: 0; }
.reports-entry-button:hover { border-color: #93c5fd; box-shadow: 0 8px 18px rgba(37,99,235,.08); transform: translateY(-1px); }
.reports-entry-button .material-symbols-rounded { color: #1f2937; font-size: 26px; }
.reports-entry-button strong { color: #0f172a; font-size: .94rem; }
.reports-entry-button small { color: #64748b; font-size: .78rem; line-height: 1.35; }
.reports-split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.reports-category-inline-stats { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: #64748b; font-size: .78rem; }
.reports-category-inline-stats b { color: #0f172a; margin-left: 3px; }
.reports-category-card { cursor: pointer; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.reports-category-card:hover { border-color: #93c5fd; box-shadow: 0 8px 18px rgba(37, 99, 235, .08); transform: translateY(-1px); }
.reports-category-card.active { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }
.reports-category-drilldown { margin-top: 12px; border: 1px solid #dbeafe; background: #f8fbff; border-radius: 12px; padding: 12px; }
.reports-settlement-calc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.reports-settlement-calc div { border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; padding: 10px; }
.reports-settlement-calc span { display: block; color: #64748b; font-size: .7rem; text-transform: uppercase; font-weight: 800; }
.reports-settlement-calc b { display: block; margin-top: 3px; color: #0f172a; }
.reports-transaction-row { cursor: pointer; }
.reports-card-only { display: none; }
.reports-details { padding: 0; overflow: hidden; }
.reports-details > summary { cursor: pointer; padding: 14px; font-weight: 900; color: #0f172a; list-style: none; }
.reports-details > summary::-webkit-details-marker { display: none; }
.reports-details > summary::after { content: "Open"; float: right; color: #2563eb; font-size: .78rem; }
.reports-details[open] > summary::after { content: "Hide"; }
.reports-details[open] { padding: 0 14px 14px; }
.reports-details[open] > summary { margin: 0 -14px 12px; border-bottom: 1px solid #e2e8f0; }
.reports-dashboard-hero { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.reports-dashboard-title { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px; }
.reports-dashboard-title span { color: #2563eb; font-size: .74rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.reports-dashboard-title h3 { margin: 0; color: #0f172a; font-size: 1.18rem; }
.reports-dashboard-title p { margin: 0; color: #64748b; font-size: .84rem; line-height: 1.35; }
.reports-dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reports-basic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.reports-graph-card { display: grid; gap: 14px; }
.report-graph-actions { justify-content: flex-end; flex-wrap: wrap; }
.report-graph-actions button { min-height: 38px; }
.report-graph-actions .report-collapse-icon { min-height: 34px; width: 34px; padding: 0; }
.report-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.report-category-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #dbe3f0; background: #fff; color: #334155; border-radius: 999px; padding: 8px 11px; font-size: .78rem; font-weight: 900; max-width: 100%; }
.report-category-chip span { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--chip-color); opacity: .55; }
.report-category-chip.active { border-color: var(--chip-color); background: #f8fafc; color: #0f172a; box-shadow: 0 0 0 2px color-mix(in srgb, var(--chip-color) 14%, transparent); }
.report-category-chip.active span { opacity: 1; }
.report-category-chip.expanded { border-style: solid; background: color-mix(in srgb, var(--chip-color) 9%, #fff); }
.report-subcategory-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 2px; }
.report-subcategory-tools > span { color: #64748b; font-size: .76rem; font-weight: 900; text-transform: uppercase; }
.report-subcategory-panel { border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; padding: 10px; display: grid; gap: 8px; animation: reportSubPanelIn .18s ease-out; }
@keyframes reportSubPanelIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.report-subcategory-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.report-subcategory-panel-head span { color: #0f172a; font-size: .84rem; font-weight: 900; overflow-wrap: anywhere; }
.report-subcategory-panel-head small { color: #64748b; font-size: .72rem; font-weight: 800; text-align: right; }
.report-graph-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.report-graph-scroll { overflow: hidden; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; width: 100%; min-width: 0; position: relative; }
.report-line-graph { display: block; width: 100%; height: clamp(230px, 38vw, 330px); min-width: 0; }
.report-graph-landscape-btn { position: absolute; right: 8px; top: 8px; z-index: 3; min-height: 34px; width: 34px; padding: 0; background: rgba(255,255,255,.92); border-color: #cbd5e1; box-shadow: 0 6px 14px rgba(15,23,42,.10); }
.report-graph-grid { stroke: #e2e8f0; stroke-width: 1; }
.report-graph-axis { fill: #64748b; font-size: 11px; font-weight: 700; }
.report-graph-hit { fill: transparent; cursor: pointer; pointer-events: all; }
.report-graph-bubble line { stroke: #334155; stroke-width: 1; stroke-dasharray: 3 3; }
.report-graph-bubble rect { fill: #0f172a; stroke: #1e293b; stroke-width: 1; filter: drop-shadow(0 8px 14px rgba(15,23,42,.18)); }
.report-graph-bubble-title { fill: #fff; font-size: 12px; font-weight: 900; }
.report-graph-bubble-row { fill: #e2e8f0; font-size: 11px; font-weight: 700; }
.report-graph-bubble-row-action { cursor: pointer; }
.report-graph-bubble-row-action:hover .report-graph-bubble-row { fill: #fff; text-decoration: underline; }
.report-graph-legend { display: flex; flex-wrap: wrap; gap: 8px 12px; color: #475569; font-size: .78rem; font-weight: 800; }
.report-graph-legend span { display: inline-flex; align-items: center; gap: 6px; }
.report-graph-legend i { width: 18px; height: 3px; border-radius: 999px; display: inline-block; }
.report-graph-landscape-overlay { position: fixed; inset: 0; z-index: 5000; background: #f8fafc; display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.report-graph-landscape-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 2px 10px; flex: 0 0 auto; }
.report-graph-landscape-head h3 { margin: 0; color: #0f172a; font-size: 1rem; }
.report-graph-landscape-head p { margin: 2px 0 0; color: #64748b; font-size: .76rem; }
.report-graph-landscape-body { flex: 1 1 auto; min-height: 0; display: flex; }
.report-graph-rotated-shell { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; }
.report-graph-scroll.landscape { flex: 1 1 auto; }
.report-graph-scroll.landscape .report-line-graph { height: 100%; }
@media (orientation: portrait) {
  .report-graph-landscape-overlay.manual-rotate .report-graph-landscape-body { align-items: center; justify-content: center; overflow: hidden; }
  .report-graph-landscape-overlay.manual-rotate .report-graph-rotated-shell { flex: 0 0 auto; width: calc(100vh - 86px); height: calc(100vw - 20px); transform: rotate(90deg); transform-origin: center; }
}
.reports-category-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.reports-category-summary-card { border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; padding: 12px; display: grid; gap: 10px; text-align: left; cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.reports-category-summary-card:hover { border-color: #93c5fd; box-shadow: 0 8px 18px rgba(37,99,235,.08); transform: translateY(-1px); }
.reports-category-summary-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.reports-category-summary-head strong { color: #0f172a; font-size: .94rem; overflow-wrap: anywhere; }
.reports-category-summary-head b { white-space: nowrap; font-size: .94rem; }
.reports-category-summary-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.reports-category-summary-stats span { border: 1px solid #e2e8f0; border-radius: 8px; padding: 7px; background: #f8fafc; color: #64748b; font-size: .72rem; font-weight: 800; }
.reports-category-summary-stats b { display: block; margin-top: 2px; color: #0f172a; font-size: .82rem; overflow-wrap: anywhere; }
.reports-category-detail-page { display: grid; gap: 12px; }
.reports-detail-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; padding: 10px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; }
.reports-detail-filters .form-group { margin: 0; }
.report-transaction-list { display: grid; gap: 8px; }
.report-transaction-row { width: 100%; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; }
.report-transaction-row strong { display: block; color: #0f172a; font-size: .9rem; overflow-wrap: anywhere; }
.report-transaction-row span, .report-transaction-row small { display: block; margin-top: 2px; color: #64748b; font-size: .74rem; }
.report-transaction-row b { white-space: nowrap; }
.reports-dashboard-section { padding: 16px; }
.reports-category-dashboard-list { display: grid; gap: 10px; }
.reports-category-dashboard-row { border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; background: #fff; display: grid; gap: 10px; }
.reports-category-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.reports-category-name { min-width: 0; }
.reports-category-name h4 { margin: 0; color: #0f172a; font-size: .98rem; line-height: 1.25; overflow-wrap: anywhere; }
.reports-category-name p { margin: 3px 0 0; color: #64748b; font-size: .78rem; }
.reports-category-main strong { color: #dc2626; font-size: 1rem; line-height: 1.25; white-space: nowrap; }
.reports-spend-bar { height: 7px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.reports-spend-bar span { display: block; height: 100%; border-radius: inherit; background: #2563eb; }
.reports-category-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.reports-category-stats div { border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px; background: #f8fafc; min-width: 0; }
.reports-category-stats span { display: block; color: #64748b; font-size: .68rem; font-weight: 900; text-transform: uppercase; }
.reports-category-stats b { display: block; margin-top: 3px; color: #0f172a; font-size: .85rem; overflow-wrap: anywhere; }
.reports-subcategory-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.reports-subcategory-row { border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px; background: #ffffff; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; align-items: baseline; }
.reports-subcategory-row span { color: #334155; font-size: .82rem; font-weight: 800; overflow-wrap: anywhere; }
.reports-subcategory-row b { color: #0f172a; font-size: .82rem; white-space: nowrap; }
.reports-subcategory-row small { grid-column: 1 / -1; color: #64748b; font-size: .74rem; }
@media(max-width: 900px) {
  .reports-filter-grid { grid-template-columns: 1fr 1fr; }
  .reports-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-basic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-entry-grid { grid-template-columns: 1fr; }
  .reports-category-card-grid { grid-template-columns: 1fr; }
  .report-graph-metrics { grid-template-columns: 1fr; }
  .reports-split-grid { grid-template-columns: 1fr; }
}
@media(max-width: 640px) {
  .reports-page { padding: 12px; }
  .reports-section-card { padding: 10px; border-radius: 12px; }
  .reports-filter-grid { grid-template-columns: 1fr; }
  .reports-filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .reports-overview-grid { grid-template-columns: 1fr; }
  .reports-dashboard-grid { grid-template-columns: 1fr; }
  .reports-basic-grid { grid-template-columns: 1fr; }
  .report-line-graph { height: 245px; }
  .report-graph-axis { font-size: 9px; }
  .report-graph-actions { justify-content: flex-start; }
  .reports-category-main { align-items: flex-start; }
  .reports-category-stats, .reports-subcategory-list { grid-template-columns: 1fr; }
  .reports-settlement-calc { grid-template-columns: 1fr; }
  .reports-table-wrap { display: none; }
  .reports-card-only { display: grid; }
  .reports-row-grid { grid-template-columns: 1fr 1fr; }
}
.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; }
.login-card h2 { margin-bottom: 8px; }
.login-subtext { color: var(--text-sub); margin-bottom: 22px; line-height: 1.5; }
.remember-row { display: flex; align-items: center; gap: 10px; margin: -2px 0 14px; color: var(--text-sub); font-size: 0.92rem; cursor: pointer; user-select: none; }
.remember-row input { width: auto; margin: 0; }
.login-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; padding: 10px 12px; border-radius: 12px; margin-bottom: 14px; font-size: 0.9rem; }
.settings-note { color: var(--text-sub); font-size: 0.88rem; line-height: 1.5; }
.fcm-admin-card select,
.fcm-admin-card input,
.fcm-admin-card textarea { width: 100%; }
.fcm-result { border-radius: 10px; padding: 10px 12px; font-size: 0.86rem; line-height: 1.4; border: 1px solid var(--border); background: #f8fafc; color: var(--text-sub); overflow-wrap: anywhere; }
.fcm-result.success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.fcm-result.error { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.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; }
.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; }
.cat-total.negative { color: #dc2626; }
.cat-total.positive { color: #16a34a; }
.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; }
.category-master-shell { padding: 18px 20px 0; }
.category-master-toolbar { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin: 14px 0; }
.category-tabs { margin-bottom: 0; padding-bottom: 0; border: 0; background: #e2e8f0; border-radius: 12px; padding: 4px; }
.category-tabs .tab.active { background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.category-search-wrap { position: relative; }
.category-search-wrap span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #64748b; font-size: 18px; }
.category-search-wrap input { padding-left: 38px; border-radius: 12px; }
.category-editor-card { margin: 0 20px 16px; }
.category-master-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; padding: 0 20px 20px; overflow-y: auto; }
.category-master-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px; box-shadow: 0 6px 14px rgba(15,23,42,.06); display: grid; gap: 10px; }
.category-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.category-type-pill, .category-lock-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: .68rem; font-weight: 900; text-transform: uppercase; }
.category-type-pill.expense { background: #fee2e2; color: #991b1b; }
.category-type-pill.income { background: #dcfce7; color: #166534; }
.category-lock-pill { background: #e2e8f0; color: #475569; margin-left: 6px; }
.category-master-card h4 { margin: 0; color: #0f172a; font-size: 1rem; }
.category-subchips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.category-subchips span { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; border-radius: 999px; padding: 5px 8px; font-size: .74rem; font-weight: 700; }
.category-subchips .empty { color: #94a3b8; font-weight: 600; }
.category-empty-state { grid-column: 1 / -1; padding: 24px; text-align: center; color: #64748b; background: #fff; border: 1px dashed #cbd5e1; border-radius: 14px; }
.permission-grid { display: grid; gap: 10px; margin: 12px 0; }
.permission-row { border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px; background: #f8fafc; }
.permission-row strong { display: block; margin-bottom: 8px; }
.permission-actions { display: flex; gap: 12px; flex-wrap: wrap; font-size: .82rem; font-weight: 700; color: #475569; }
.permission-actions label { display: flex; align-items: center; gap: 5px; }
.permission-actions input { width: auto; }
.admin-modal-content { width: min(940px, calc(100vw - 24px)); max-width: 940px; padding: 0; overflow: hidden; background: #f8fafc; border-radius: 22px; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; background: #ffffff; border-bottom: 1px solid #e2e8f0; }
.admin-topbar h3 { margin: 0; color: #0f172a; font-size: 1.2rem; line-height: 1.2; }
.admin-kicker { margin: 0 0 3px; color: #64748b; font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.admin-logout-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 92px; }
.admin-logout-btn .material-symbols-rounded { font-size: 18px; }
.admin-console-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr); gap: 16px; padding: 18px; max-height: calc(90vh - 76px); overflow-y: auto; }
.admin-panel { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 16px; box-shadow: 0 10px 22px rgba(15, 23, 42, .06); min-width: 0; }
.admin-form-panel { grid-column: 1; }
.admin-users-panel { grid-column: 2; grid-row: 1 / span 2; }
.admin-restore-zone { grid-column: 1; border-color: #bfdbfe; background: linear-gradient(180deg, #fff 0%, #f8fbff 100%); }
.admin-data-safety-zone { grid-column: 1; border-color: #bbf7d0; background: linear-gradient(180deg, #fff 0%, #f7fff9 100%); }
.admin-danger-zone { grid-column: 1; border-color: #fecaca; background: linear-gradient(180deg, #fff 0%, #fff7f7 100%); }
.admin-section-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.admin-section-head h4 { margin: 0; color: #0f172a; font-size: 1rem; line-height: 1.25; }
.admin-section-head p { margin: 4px 0 0; color: #64748b; font-size: .82rem; line-height: 1.35; }
.admin-section-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #eff6ff; color: #1d4ed8; flex-shrink: 0; }
.admin-section-icon .material-symbols-rounded { font-size: 21px; }
.admin-section-icon.restore { background: #dbeafe; color: #1d4ed8; }
.admin-section-icon.safety { background: #dcfce7; color: #166534; }
.admin-section-icon.danger { background: #fee2e2; color: #b91c1c; }
.admin-active-row { margin-top: 2px; }
.admin-form-actions { margin-top: 18px; }
.admin-user-list { display: grid; gap: 10px; }
.admin-user-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid #e2e8f0; border-radius: 12px; background: #ffffff; }
.admin-user-meta { min-width: 0; }
.admin-user-name-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.admin-user-name-line b { color: #0f172a; font-size: .95rem; overflow-wrap: anywhere; }
.admin-user-id { color: #64748b; font-size: .78rem; margin-top: 4px; overflow-wrap: anywhere; }
.admin-pill { display: inline-flex; align-items: center; min-height: 20px; border-radius: 999px; padding: 3px 8px; font-size: .68rem; font-weight: 900; text-transform: uppercase; line-height: 1; }
.admin-pill.admin { background: #e0e7ff; color: #3730a3; }
.admin-pill.user { background: #ecfeff; color: #155e75; }
.admin-pill.active { background: #dcfce7; color: #166534; }
.admin-pill.inactive { background: #fee2e2; color: #991b1b; }
.admin-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.danger-copy { color: #7f1d1d; background: #fff1f2; border: 1px solid #fecdd3; border-radius: 12px; padding: 12px; margin-bottom: 12px; font-size: .85rem; line-height: 1.45; }
.restore-warning { color: #1e3a8a; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px; padding: 12px; margin-bottom: 12px; font-size: .85rem; line-height: 1.45; }
.restore-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.restore-preview div { border: 1px solid #dbeafe; background: #ffffff; border-radius: 10px; padding: 10px; }
.restore-preview span { display: block; color: #64748b; font-size: .72rem; font-weight: 900; text-transform: uppercase; margin-bottom: 4px; }
.restore-preview b { color: #0f172a; font-size: 1rem; }
.admin-restore-zone .btn-primary { min-height: 44px; }
.admin-restore-zone .btn-primary .material-symbols-rounded { font-size: 20px; }
.data-safety-output { display: grid; gap: 10px; margin-top: 12px; }
.data-safety-output pre { max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 12px; font-size: .78rem; line-height: 1.45; }
.data-safety-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.data-safety-counts div { border: 1px solid #bbf7d0; border-radius: 10px; padding: 9px; background: #fff; }
.data-safety-counts span { display: block; color: #64748b; font-size: .68rem; font-weight: 900; text-transform: uppercase; }
.data-safety-counts b { display: block; color: #0f172a; margin-top: 3px; }
.admin-danger-zone .btn-danger { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; background: #b91c1c; color: #ffffff; border: 1px solid #991b1b; border-radius: 12px; box-shadow: 0 8px 18px rgba(185, 28, 28, .18); }
.admin-danger-zone .btn-danger:hover { background: #991b1b; }
.admin-danger-zone .btn-danger .material-symbols-rounded { font-size: 20px; }
.reset-confirm-content { max-width: 420px; text-align: center; }
.reset-confirm-icon { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: #fee2e2; color: #b91c1c; }
.reset-confirm-icon .material-symbols-rounded { font-size: 30px; }
.reset-confirm-content h3 { margin: 0 0 8px; color: #0f172a; font-size: 1.15rem; }
.reset-confirm-copy { color: #64748b; font-size: .9rem; line-height: 1.45; margin-bottom: 18px; }
.reset-confirm-content .form-group { text-align: left; }
.reset-default-note { margin-top: 4px; color: #7f1d1d; background: #fff1f2; border: 1px solid #fecdd3; border-radius: 12px; padding: 10px 12px; font-size: .82rem; line-height: 1.4; text-align: left; }
.reset-confirm-content .btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: #b91c1c; color: #ffffff; border-radius: 12px; padding: 12px 14px; font-weight: 800; }
.reset-confirm-content .btn-danger:hover { background: #991b1b; }
@media(max-width: 760px) {
  .admin-modal-content { width: calc(100vw - 16px); max-height: calc(100vh - 16px); border-radius: 18px; }
  .admin-topbar { padding: 14px; align-items: flex-start; }
  .admin-console-grid { grid-template-columns: 1fr; padding: 12px; gap: 12px; max-height: calc(100vh - 82px); }
  .admin-form-panel, .admin-users-panel, .admin-restore-zone, .admin-data-safety-zone, .admin-danger-zone { grid-column: auto; grid-row: auto; }
  .admin-user-row { align-items: flex-start; }
  .admin-row-actions { padding-top: 2px; }
}
.template-manage-row small { display: block; color: #64748b; margin-top: 4px; font-size: .78rem; line-height: 1.35; }
.template-picker-item { width: 100%; display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: center; text-align: left; padding: 14px 16px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; color: #0f172a; margin-bottom: 10px; }
.template-picker-item:hover { background: #f8fafc; border-color: #cbd5e1; }
.template-picker-item .material-symbols-rounded { color: #2563eb; }
.template-picker-item small { display: block; color: #64748b; margin-top: 3px; font-size: .78rem; line-height: 1.35; }
@media(max-width: 640px) {
  .category-master-toolbar { grid-template-columns: 1fr; display: grid; }
}
.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; }
.draft-row { align-items: flex-start; gap: 12px; }
.draft-info { display: grid; gap: 4px; min-width: 0; }
.draft-info span, .draft-info small { color: #64748b; font-size: .78rem; line-height: 1.3; overflow-wrap: anywhere; }
.draft-info small { color: #94a3b8; }
.draft-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.draft-actions strong { margin-right: 4px; }

/* --- NEW: Full Screen Settlement Modal Overrides --- */
#settlementsModal .modal-content,
#investmentsModal .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,
#investmentsModal .modal-header {
    background: #ffffff;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    margin-bottom: 0;
}
#settlement-user-cards-container,
#investment-summary-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;
}
.settlement-intro {
    padding: 0 20px 12px 20px;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 980px;
    margin: 0 auto 16px auto;
}
.settlement-intro p {
    margin: 0;
}
#settlement-top-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0 20px;
}
.settlement-search-shell input {
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}
.settlement-actions-shell button {
    min-width: 120px;
}
.settlement-filter-chips {
    margin-top: 8px;
}
.settlement-chip {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.settlement-chip[data-filter="all"] { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.settlement-chip[data-filter="lent"] { background: #ecfdf5; border-color: #86efac; color: #166534; }
.settlement-chip[data-filter="debt"] { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.settlement-chip[data-filter="refund"] { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.settlement-chip:hover { box-shadow: 0 0 0 0 rgba(59,130,246,0.08); }
.settlement-chip[data-filter="all"].active { background: #bfdbfe; border-color: #60a5fa; color: #1d4ed8; }
.settlement-chip[data-filter="lent"].active { background: #d1fae5; border-color: #4ade80; color: #166534; }
.settlement-chip[data-filter="debt"].active { background: #ffedd5; border-color: #fdba74; color: #c2410c; }
.settlement-chip[data-filter="refund"].active { background: #dde4ff; border-color: #a5b4fc; color: #3730a3; }
.settlement-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 20px 20px 20px;
    flex-grow: 1;
}
@media (min-width: 1024px) {
    .settlement-body {
        display: grid;
        grid-template-columns: 1.3fr 0.9fr;
        gap: 20px;
        align-items: start;
    }
}
.settlement-detail-shell {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(15, 23, 42, 0.06);
    min-height: 400px;
}
.settlement-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
    flex-wrap: wrap;
}
.settlement-detail-header > div { flex: 1 1 150px; min-width: 0; }
.settlement-detail-header button { flex: 0 0 auto; }
.btn-sm {
    padding: 7px 10px;
    font-size: 0.78rem;
    border-radius: 10px;
}
.settlement-detail-header h4 {
    margin: 0;
    font-size: 0.9rem;
    color: #0f172a;
}
.settlement-detail-subtitle {
    margin: 3px 0 0;
    color: #64748b;
    font-size: 0.72rem;
    line-height: 1.25;
}
#settlements-detail-list.settlement-list {
    max-height: none !important;
    overflow-y: visible !important;
    border: none;
    border-radius: 0;
}
.settlement-detail-section {
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}
.settlement-detail-section:last-child {
    border-bottom: none;
}
.section-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

/* --- NEW: Settlement Summary Card Enhancements --- */
#settlement-user-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    width: 100%;
}
.user-summary-card {
    min-height: 120px;
    padding: 18px 16px;
    text-align: left;
    border-radius: 18px;
}
.user-summary-card h4 {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    color: #334155;
}
.user-summary-card h2 {
    font-size: 1.7rem;
    line-height: 1.1;
    margin: 0;
}
.user-summary-card p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 0.82rem;
}

/* Enhanced Settlement Cards for Grid */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}
.settlement-person-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-left: 5px solid #cbd5e1; 
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.07);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 150px;
    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-purple { border-left-color: #7c3aed; background: linear-gradient(145deg, #ffffff 40%, #f3e8ff 100%); border-color: #ddd6fe; }
.sp-card-empty { border-left-color: #cbd5e1; background: #ffffff; border-color: var(--border); opacity: 0.9; }

.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: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: auto; text-align: left; }
.sp-stat-item { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.7); border: 1px solid rgba(0,0,0,0.05); padding: 8px 10px; border-radius: 8px; }
.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); }

.settlement-person-card-detailed {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    min-height: auto;
}
.settlement-person-card-detailed:hover {
    transform: translateY(-2px);
    box-shadow: none;
}
.settlement-money-card {
    border: 1px solid #e2e8f0;
    border-left: 5px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    display: grid;
    gap: 10px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}
.settlement-money-card h4 {
    margin: 0;
    color: #0f172a;
    font-size: .98rem;
}
.settlement-money-card p {
    margin: 3px 0 0;
    color: #64748b;
    font-size: .78rem;
    line-height: 1.35;
}
.settlement-pending-hero { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: #fffbeb; border: 1px solid #fcd34d; }
.settlement-pending-hero span { color: #92400e; font-size: .72rem; font-weight: 900; text-transform: uppercase; }
.settlement-pending-hero strong { color: #78350f; font-size: 1.35rem; line-height: 1; }
.settlement-money-card-detail .settlement-pending-hero.pending {
    padding: 14px;
    background: #fff7ed;
    border-color: #fb923c;
}
.settlement-money-card-detail .settlement-pending-hero.pending span {
    font-size: .86rem;
    color: #9a3412;
}
.settlement-money-card-detail .settlement-pending-hero.pending strong {
    font-size: 1.85rem;
    color: #7c2d12;
}
.settlement-money-card-detail .settlement-pending-hero.completed {
    padding: 8px 10px;
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.settlement-money-card-detail .settlement-pending-hero.completed span {
    font-size: .74rem;
    color: #166534;
}
.settlement-money-card-detail .settlement-pending-hero.completed strong {
    font-size: .95rem;
    color: #166534;
}
.settlement-status-large .reports-badge {
    font-size: .9rem;
    padding: 7px 10px;
    border-radius: 999px;
}
.settlement-money-card.receivable { border-left-color: #16a34a; background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%); }
.settlement-money-card.payable { border-left-color: #dc2626; background: linear-gradient(180deg, #ffffff 0%, #fef2f2 100%); }
.settlement-money-card.refund { border-left-color: #4f46e5; background: linear-gradient(180deg, #ffffff 0%, #eef2ff 100%); }
.settlement-money-card.mixed { border-left-color: #d97706; background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%); }
.settlement-summary-row.user-cards-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    padding-bottom: 0;
    margin-bottom: 10px;
}
.settlement-summary-card.user-summary-card {
    min-width: 0;
    min-height: 0;
    width: 100%;
    padding: 8px 6px;
    border-radius: 10px;
}
.settlement-summary-card h4 {
    font-size: .64rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}
.settlement-summary-card h2 {
    font-size: clamp(.82rem, 3.6vw, 1.05rem);
    line-height: 1.05;
    overflow-wrap: anywhere;
}
.settlement-summary-main-label {
    margin: 4px 0 0;
    font-size: .6rem;
    font-weight: 800;
    color: #64748b;
}
.settlement-summary-split {
    margin: 4px 0 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    color: #64748b;
    font-size: .58rem;
    line-height: 1.2;
}
.settlement-summary-split span {
    min-width: 0;
    overflow-wrap: anywhere;
}
@media(max-width: 680px) {
    .settlement-summary-row.user-cards-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
    }
    .settlement-summary-card.user-summary-card {
        padding: 7px 4px;
    }
    .settlement-summary-split {
        display: none;
    }
    .settlement-detail-header {
        gap: 6px;
        padding: 9px 10px;
    }
    .settlement-detail-header > div {
        flex-basis: 100%;
    }
    .settlement-detail-header .btn-sm {
        padding: 6px 8px;
        font-size: 0.72rem;
    }
}
.settlement-detail-money-card {
    cursor: pointer;
    padding: 10px 14px;
    background: #f8fafc;
}
.settlement-detail-money-card + .settlement-detail-money-card {
    border-top: 1px solid #f1f5f9;
}
.settlement-detail-slim-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
    cursor: pointer;
}
.settlement-detail-slim-row:hover { background: #f8fafc; }
.settlement-detail-slim-main { display: flex; align-items: center; min-width: 0; }
.settlement-detail-slim-values { text-align: right; flex-shrink: 0; display: grid; gap: 3px; }
.settlement-detail-slim-values div { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; }
.settlement-detail-slim-values span { font-size: .68rem; font-weight: 900; text-transform: uppercase; color: #64748b; }
.settlement-detail-slim-values b { font-size: 1rem; color: #0f172a; }
.settlement-detail-slim-values small { color: #94a3b8; font-size: .72rem; }
.settlement-detail-pending b { color: #92400e; }
.settlement-detail-complete b { color: #166534; font-size: .82rem; }
.investment-detail-row { border-bottom: 1px solid #eef2f7; }
.investment-subtype-manager { display: grid; gap: 12px; margin-bottom: 10px; }
.investment-subtype-form-card { margin: 0; display: grid; gap: 10px; }
.investment-subtype-manager-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.investment-subtype-manager-head h3 { margin: 0; color: #0f172a; font-size: .98rem; }
.investment-subtype-manager-head p { margin: 3px 0 0; color: #64748b; font-size: .78rem; line-height: 1.35; }
.investment-subtype-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.investment-subtype-input-shell { min-width: 0; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #dbe3f0; border-radius: 10px; padding: 0 10px; }
.investment-subtype-input-shell span { color: #64748b; font-size: 19px; flex: 0 0 auto; }
.investment-subtype-input-shell input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 10px 0; font-size: .9rem; color: #0f172a; background: transparent; }
.investment-subtype-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.investment-subtype-card-wrap { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: stretch; }
.investment-subtype-card { min-width: 0; width: 100%; border: 1px solid #e2e8f0; background: #fff; border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 8px; align-items: center; text-align: left; color: #0f172a; }
.investment-subtype-card.active { border-color: var(--subtype-color); background: color-mix(in srgb, var(--subtype-color) 8%, #fff); box-shadow: 0 0 0 2px color-mix(in srgb, var(--subtype-color) 14%, transparent); }
.investment-subtype-card:hover { border-color: var(--subtype-color); }
.investment-subtype-color { width: 9px; height: 100%; min-height: 54px; border-radius: 99px; background: var(--subtype-color); opacity: .72; }
.investment-subtype-main { min-width: 0; display: grid; gap: 6px; }
.investment-subtype-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.investment-subtype-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #64748b; font-size: .7rem; font-weight: 800; }
.investment-subtype-card-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.investment-subtype-card-stats span { min-width: 0; padding: 6px; border-radius: 8px; background: #f8fafc; display: grid; gap: 2px; }
.investment-subtype-card-stats em { font-style: normal; color: #64748b; font-size: .62rem; font-weight: 900; text-transform: uppercase; }
.investment-subtype-card-stats strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #0f172a; font-size: .72rem; }
.investment-subtype-amount { justify-self: end; white-space: nowrap; color: #0f172a; font-weight: 900; font-size: .82rem; }
.investment-subtype-open { color: #94a3b8; font-size: 20px; }
.investment-subtype-card-actions { display: grid; grid-template-columns: 34px; gap: 6px; }
.investment-subtype-card-actions .btn-icon-small { width: 34px; height: 34px; }
.investment-subtype-delete { padding: 0; color: #991b1b; background: #fff1f2; border-color: #fecdd3; }
.investment-subtype-delete:hover { background: #fee2e2; border-color: #fca5a5; }
.investment-subtype-empty { grid-column: 1/-1; padding: 16px; text-align: center; color: #64748b; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; font-weight: 800; }
.investment-subtype-selected-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; margin-bottom: 8px; }
.investment-subtype-selected-bar h4 { margin: 0; color: #0f172a; font-size: .98rem; }
.investment-subtype-selected-bar p { margin: 2px 0 0; color: #64748b; font-size: .76rem; font-weight: 800; }
@media(max-width: 520px) {
  .investment-subtype-manager-head { align-items: stretch; flex-direction: column; }
  .investment-subtype-manager-head .btn-sm { width: 100%; }
  .investment-subtype-card-grid { grid-template-columns: 1fr; }
  .investment-subtype-card-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.settlement-pending-hero.investment { background: #ecfdf5; border-color: #86efac; }
.settlement-pending-hero.investment span { color: #166534; }
.settlement-pending-hero.investment strong { color: #065f46; }
.settlement-detail-money-card .settlement-money-card-detail {
    border-left-width: 0;
    border-radius: 10px;
    box-shadow: none;
    background: #ffffff;
    grid-template-columns: minmax(116px, .45fr) 1fr;
    align-items: stretch;
    gap: 12px;
    border-color: #cbd5e1;
}
.settlement-detail-money-card .settlement-money-card-detail .settlement-pending-hero {
    min-height: 100%;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}
.settlement-detail-money-card .settlement-money-card-detail .reports-row-card-head,
.settlement-detail-money-card .settlement-money-card-detail .reports-row-grid {
    grid-column: 2;
}
.settlement-detail-money-card .settlement-money-card-detail .reports-row-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media(max-width: 640px) {
  .filter-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .filter-row select, .filter-row input { width: 100%; font-size: 0.95rem; }
  .transaction-item { gap: 10px; align-items: flex-start; }
  .transaction-item > div:first-child { align-items: flex-start !important; }
  .transaction-row-actions { gap: 6px; }
  .settlement-detail-slim-row { align-items: flex-start; flex-direction: column; }
  .settlement-detail-slim-values { width: 100%; text-align: left; }
  .settlement-detail-slim-values div { justify-content: flex-start; }
  .settlement-detail-money-card .settlement-money-card-detail { grid-template-columns: 1fr; }
  .settlement-detail-money-card .settlement-money-card-detail .reports-row-card-head,
  .settlement-detail-money-card .settlement-money-card-detail .reports-row-grid { grid-column: auto; }
}

@media(max-width: 420px) {
  .transaction-item { flex-direction: column; }
  .transaction-row-actions,
  .transaction-item > .t-amount { align-self: flex-end; }
}

/* 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;
}

/* Phase 2 performance: transaction list loads in batches to avoid heavy DOM rendering. */
.load-more-transactions-btn {
  width: 100%;
  margin: 12px 0 20px;
  justify-content: center;
}

/* Phase 2J Notification Manager */
.nm-section { margin: 12px 0; }
.nm-section h5 { margin: 8px 0; font-size: 0.9rem; color: var(--text-secondary); }
.nm-list { display: flex; flex-direction: column; gap: 8px; }
.nm-row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--card-bg); }
.nm-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nm-main span, .nm-main small { color: var(--text-secondary); word-break: break-all; }
.nm-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* Phase 2K Notification Manager professional layout */
.notification-manager-pro {
  overflow: hidden;
  border: 1px solid #dbeafe !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
}
.nm-hero {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 55%, #eef2ff 100%);
  border: 1px solid #dbeafe;
  margin-bottom: 14px;
}
.nm-hero-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #1d4ed8;
  background: #dbeafe;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.12);
  flex: 0 0 auto;
}
.nm-hero-copy h4 { margin: 2px 0 4px; font-size: 1.05rem; color: #0f172a; }
.nm-kicker { margin: 0; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; color: #2563eb; text-transform: uppercase; }
.nm-description { margin: 8px 0 0; color: #64748b; font-size: 0.84rem; line-height: 1.45; }
.nm-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.nm-toolbar button, .nm-send-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.nm-result { margin: 10px 0 12px; }
.nm-stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0 16px; }
.nm-stat-card { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid #e2e8f0; background: #fff; border-radius: 16px; box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04); }
.nm-stat-card > span { color: #2563eb; background: #eff6ff; border-radius: 12px; padding: 7px; }
.nm-stat-card.success > span { color: #059669; background: #ecfdf5; }
.nm-stat-card.warning > span { color: #d97706; background: #fffbeb; }
.nm-stat-card b { display: block; color: #0f172a; font-size: 1.15rem; line-height: 1.1; }
.nm-stat-card small { display: block; color: #64748b; font-size: 0.72rem; margin-top: 2px; }
.nm-manager-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; align-items: start; }
.nm-panel, .nm-send-panel { border: 1px solid #e2e8f0; background: #fff; border-radius: 18px; padding: 14px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04); }
.nm-send-panel { margin-top: 14px; }
.nm-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.nm-panel-head h5 { margin: 2px 0 0; color: #0f172a; font-size: 0.95rem; display: flex; align-items: center; gap: 6px; }
.nm-soft-pill { display: inline-flex; align-items: center; white-space: nowrap; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 0.7rem; font-weight: 700; padding: 5px 9px; }
.nm-card-list { max-height: 430px; overflow: auto; padding-right: 2px; }
.nm-entity-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 12px; border: 1px solid #e2e8f0; border-radius: 16px; background: #ffffff; margin-bottom: 8px; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.nm-entity-card:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06); }
.nm-avatar { width: 38px; height: 38px; border-radius: 14px; display: grid; place-items: center; color: #2563eb; background: #eff6ff; }
.nm-avatar.device { color: #7c3aed; background: #f5f3ff; }
.nm-entity-body { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.nm-entity-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nm-entity-title-row b { min-width: 0; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm-status-pill { border-radius: 999px; font-size: 0.68rem; font-weight: 800; padding: 4px 8px; }
.nm-status-pill.active { color: #047857; background: #d1fae5; }
.nm-status-pill.inactive { color: #92400e; background: #fef3c7; }
.nm-meta-line { display: flex; flex-wrap: wrap; gap: 6px; color: #64748b; font-size: 0.72rem; }
.nm-meta-line span { background: #f8fafc; border: 1px solid #edf2f7; border-radius: 999px; padding: 3px 7px; }
.nm-id-box { display: grid; gap: 3px; }
.nm-id-box label { color: #94a3b8; font-size: 0.66rem; text-transform: uppercase; font-weight: 800; letter-spacing: 0.04em; }
.nm-id-box code { display: block; max-width: 100%; overflow-wrap: anywhere; color: #334155; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 6px 8px; font-size: 0.72rem; }
.nm-note-line { font-size: 0.72rem; color: #64748b; background: #f8fafc; border-left: 3px solid #bfdbfe; padding: 6px 8px; border-radius: 8px; }
.nm-card-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.nm-card-actions .btn-icon-small.danger { color: #dc2626; background: #fff1f2; border-color: #fecdd3; }
.nm-empty { display: grid; place-items: center; text-align: center; gap: 4px; color: #64748b; padding: 24px 10px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 16px; }
.nm-empty .material-symbols-rounded { color: #94a3b8; font-size: 30px; }
.nm-help-box { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; color: #64748b; font-size: 0.78rem; }
.nm-help-box .material-symbols-rounded { color: #2563eb; }
.nm-send-form .form-row { align-items: flex-start; }
@media(max-width: 900px) {
  .nm-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nm-manager-grid { grid-template-columns: 1fr; }
}
@media(max-width: 520px) {
  .nm-hero { padding: 12px; }
  .nm-toolbar { display: grid; grid-template-columns: 1fr; }
  .nm-toolbar button { width: 100%; }
  .nm-stats-grid { grid-template-columns: 1fr; }
  .nm-entity-card { grid-template-columns: auto minmax(0, 1fr); }
  .nm-card-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
}

/* Phase 2N: Notification Manager visibility/locked state */
.notification-manager-pro.nm-locked {
  opacity: 0.96;
}
.notification-manager-pro.nm-locked .nm-toolbar,
.notification-manager-pro.nm-locked .nm-manager-grid,
.notification-manager-pro.nm-locked .nm-send-panel {
  filter: saturate(0.85);
}

/* Phase 2O: Notification Manager must always be visible in Settings; server endpoints enforce access. */
#notification-manager-card { display: block !important; }
#notification-manager-card.nm-locked { opacity: 0.96; }

/* Phase 2R: Notification Manager RCA fix - force Settings module visibility; backend enforces access. */
#notification-manager-card,
#settingsModal #notification-manager-card,
.notification-manager-pro.nm-force-visible {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}
#settingsModal #notification-manager-card {
  order: 0 !important;
  flex-shrink: 0;
  margin-top: 20px;
  margin-bottom: 16px;
}


/* Phase 2S: Notification Manager layout fix.
   The module must stay inside Settings content below the header, not float above the title. */
#settingsModal .modal-header {
  order: -100 !important;
  position: sticky;
  top: 0;
  z-index: 5;
}
#settingsModal #notification-manager-card {
  order: 0 !important;
  position: relative !important;
  top: auto !important;
  transform: none !important;
  margin-top: 20px !important;
  margin-bottom: 16px !important;
}
#settingsModal .settings-card:not(#notification-manager-card) {
  order: 10;
}
#settingsModal #notification-manager-card .nm-hero {
  align-items: center;
}
#settingsModal #notification-manager-card .nm-description {
  max-width: 780px;
}

/* Phase 2T: Notification Manager editable identities + polished toggles */
.nm-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.nm-edit-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.nm-edit-field span {
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nm-edit-field input {
  width: 100%;
  min-width: 0;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  color: #0f172a;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.78rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.nm-edit-field input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.nm-id-box.compact code {
  font-size: 0.68rem;
  padding: 5px 7px;
  background: #f8fafc;
}
.nm-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  user-select: none;
  cursor: pointer;
  flex: 0 0 auto;
}
.nm-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.nm-switch-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  transition: background .18s ease, border-color .18s ease;
}
.nm-switch-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  transform: translateX(0);
  transition: transform .18s ease;
}
.nm-switch input:checked + .nm-switch-track {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #059669;
}
.nm-switch input:checked + .nm-switch-track .nm-switch-thumb {
  transform: translateX(18px);
}
.nm-switch-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #92400e;
  min-width: 48px;
}
.nm-switch.is-active .nm-switch-label { color: #047857; }
@media(max-width: 640px) {
  .nm-edit-grid { grid-template-columns: 1fr; }
  .nm-switch-label { display: none; }
}

/* Phase 2U: Notification Manager standalone module */
#settingsModal #notification-manager-card { display: none !important; }
.notification-manager-route .modal-content,
.notification-manager-page-content {
  max-width: 1180px;
  width: min(1180px, calc(100vw - 24px));
  min-height: min(860px, calc(100vh - 24px));
  background: #f8fafc;
}
.nm-page-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(248, 250, 252, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
}
.page-subtitle { margin: 2px 0 0; color: #64748b; font-size: .82rem; }
.notification-manager-pro.nm-standalone {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  display: block !important;
}
.nm-command-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin: 14px 0;
  padding: 18px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 55%, #7c3aed 100%);
  box-shadow: 0 18px 44px rgba(37, 99, 235, 0.22);
}
.nm-command-hero .nm-kicker,
.nm-command-hero .nm-description,
.nm-command-hero .settings-note { color: rgba(255,255,255,.82); }
.nm-command-hero h4 { margin: 2px 0 4px; font-size: 1.45rem; color: #fff; }
.nm-command-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.nm-command-actions .btn-secondary { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); }
.nm-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
  padding: 6px;
  background: #e2e8f0;
  border-radius: 16px;
}
.nm-tabs button {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: #475569;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.nm-tabs button.active { background: #fff; color: #1d4ed8; box-shadow: 0 6px 16px rgba(15,23,42,.08); }
.nm-tab-panel.hidden { display: none !important; }
.nm-rule-builder { margin-top: 0; }
.nm-rule-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(160px, 1fr) minmax(160px, 1fr) minmax(120px, .8fr) minmax(120px, .8fr) auto;
  gap: 10px;
  margin: 14px 0;
}
.nm-rule-form input,
.nm-rule-form select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  font-weight: 700;
}
.nm-rule-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  margin-bottom: 8px;
}
.mobile-menu-dropdown .menu-item .menu-item-label { flex: 1; }
@media (max-width: 900px) {
  .nm-command-hero { grid-template-columns: 1fr; }
  .nm-command-actions { justify-content: stretch; }
  .nm-command-actions button { width: 100%; }
  .nm-rule-form { grid-template-columns: 1fr; }
}

/* Phase 2V notification rule engine */
.nm-rule-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}
.nm-engine-status {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}
.nm-subhead {
  margin: 18px 0 10px;
  font-size: 14px;
  color: #0f172a;
}
.nm-rule-card.success {
  border-left: 4px solid #16a34a;
}
.nm-rule-card.warning {
  border-left: 4px solid #f59e0b;
}
.nm-rule-card.muted {
  border-left: 4px solid #94a3b8;
}
.nm-status-pill.pending {
  background: #fef3c7;
  color: #92400e;
}

/* Phase 2W: admin-only Notification Manager, app-consistent styling */
.notification-manager-route .modal-content,
.notification-manager-page-content {
  max-width: 1000px;
  width: min(1000px, calc(100vw - 24px));
  background: var(--bg-main);
  border-radius: 24px;
}
.nm-page-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow);
}
.nm-command-hero {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 20px;
  padding: 16px;
}
.nm-command-hero .nm-kicker,
.nm-command-hero .nm-description,
.nm-command-hero .settings-note { color: var(--text-sub); }
.nm-command-hero h4 { color: var(--text-main); font-size: 1.25rem; }
.nm-command-actions .btn-secondary { background: #fff; color: var(--text-main); border: 1px solid var(--border); }
.nm-tabs { background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.nm-tabs button { color: var(--text-sub); }
.nm-tabs button.active { color: var(--text-main); background: #f1f5f9; box-shadow: none; }
.nm-panel,
.nm-send-panel,
.nm-entity-card,
.nm-rule-card,
.nm-stat-card {
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
  background: var(--bg-card) !important;
  box-shadow: var(--shadow) !important;
}
.nm-stat-card span.material-symbols-rounded,
.nm-avatar.user,
.nm-avatar.device { background: #f1f5f9 !important; color: var(--primary) !important; }
.nm-soft-pill,
.nm-id-box,
.nm-engine-status {
  background: #f8fafc !important;
  border: 1px solid var(--border) !important;
  color: var(--text-sub) !important;
}
.nm-edit-field input,
.nm-send-form input,
.nm-send-form select,
.nm-send-form textarea,
.nm-rule-form input,
.nm-rule-form select {
  border: 1px solid var(--border) !important;
  background: #fff !important;
  color: var(--text-main) !important;
  border-radius: 12px !important;
}
.nm-switch .nm-switch-track { border: 1px solid var(--border); }
.nm-switch.is-active .nm-switch-track { background: var(--green); }
.nm-switch:not(.is-active) .nm-switch-track { background: #cbd5e1; }


/* Phase 2X: Notification Manager full-width route + layout/error polish */
.notification-manager-route {
  align-items: stretch !important;
  justify-content: flex-start !important;
  padding: 0 !important;
  background: var(--bg-main) !important;
}
.notification-manager-route .modal-content,
.notification-manager-page-content {
  width: 100% !important;
  max-width: none !important;
  min-height: 100vh !important;
  height: auto !important;
  border-radius: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  background: var(--bg-main) !important;
}
.notification-manager-route .modal-header,
.nm-page-header {
  border-radius: 0 !important;
  position: sticky;
  top: 0;
  z-index: 20;
}
#notification-manager-page-host {
  width: 100% !important;
  max-width: 1240px !important;
  margin: 0 auto !important;
  padding: 14px 16px 28px !important;
  box-sizing: border-box !important;
}
#notification-manager-card {
  width: 100% !important;
  max-width: none !important;
}
.notification-manager-pro .nm-command-hero {
  grid-template-columns: minmax(0, 1fr) auto;
}
.notification-manager-pro .nm-result.error,
.notification-manager-pro .fcm-result.error {
  border-radius: 14px;
  font-weight: 700;
}
@media (max-width: 760px) {
  #notification-manager-page-host { padding: 10px 10px 22px !important; }
  .notification-manager-pro .nm-command-hero { grid-template-columns: 1fr; }
  .nm-command-actions { justify-content: stretch; }
  .nm-command-actions button { flex: 1 1 100%; }
}


/* Inline editing for AI-analyzed transaction drafts */
.analyzed-ai-draft-row {
  align-items: stretch;
}
.analyzed-ai-draft-row .draft-info {
  flex: 1;
  width: 100%;
}
.draft-inline-editor {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(150px, 1.1fr) minmax(130px, 1fr);
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}
.draft-inline-editor label {
  display: grid;
  gap: 4px;
  font-size: .7rem;
  font-weight: 700;
  color: #64748b;
}
.draft-inline-input {
  min-height: 34px;
  font-size: .82rem;
}
.draft-inline-category-row {
  gap: 5px;
}
.draft-inline-category-row .txn-input-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
}
.draft-suggestions-dropdown {
  z-index: 3500;
}
@media (max-width: 780px) {
  .analyzed-ai-draft-row {
    flex-direction: column;
  }
  .draft-inline-editor {
    grid-template-columns: 1fr;
  }
  .analyzed-ai-draft-row .draft-actions {
    justify-content: flex-start;
  }
}

/* Browser password-manager suppression: keep sensitive app-only fields as normal text inputs while visually masking them. */
.browser-nonpassword-field {
    -webkit-text-security: disc;
    text-security: disc;
}
