
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 15px;
}
.container {
    max-width: 1200px;
    margin: 5px auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header h2 { font-size: 18px; }
.btn-back {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
}
.content { padding: 12px 15px; }

/* Portfolio Section */
.portfolio-section {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    color: white;
}
.portfolio-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.portfolio-card {
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}
.portfolio-card.red-alert { border-left-color: #dc3545; }
.portfolio-card .p-label { font-size: 9px; text-transform: uppercase; opacity: 0.7; margin-bottom: 3px; font-weight: 600; }
.portfolio-card .p-value { font-size: 16px; font-weight: 700; }
.portfolio-card .p-sub { font-size: 10px; opacity: 0.6; margin-top: 2px; }
.capital-edit { background: none; border: none; color: rgba(255,255,255,0.6); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.capital-edit:hover { color: white; }
.exposure-list { margin-top: 8px; }
.exposure-item { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; font-size: 11px; border-radius: 4px; margin-bottom: 3px; background: rgba(255,255,255,0.05); }
.exposure-item.over-limit { background: rgba(220,53,69,0.2); color: #ff7675; }
.exposure-bar { height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; flex: 1; margin: 0 8px; }
.exposure-fill { height: 100%; border-radius: 2px; background: #667eea; }
.exposure-fill.danger { background: #dc3545; }

/* Dashboard cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}
.card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}
.card.warning { background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%); border-left-color: #ffc107; }
.card.danger { background: linear-gradient(135deg, #f8d7da 0%, #ff7675 100%); border-left-color: #dc3545; }
.card.success { background: linear-gradient(135deg, #d4edda 0%, #00b894 100%); border-left-color: #28a745; }
.card-title { font-size: 10px; color: #666; margin-bottom: 4px; text-transform: uppercase; font-weight: 600; }
.card-value { font-size: 18px; font-weight: 700; color: #333; margin-bottom: 2px; }
.card-subtitle { font-size: 10px; color: #666; }

/* Status filter buttons */
.status-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.status-filter-btn {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}
.status-filter-btn.active { border-color: #333; transform: scale(1.05); }
.sf-all { background: #e0e0e0; color: #333; }
.sf-pending { background: #fff3cd; color: #856404; }
.sf-approved { background: #cce5ff; color: #004085; }
.sf-funded { background: #d4edda; color: #155724; }
.sf-active { background: #d4edda; color: #155724; }
.sf-completed { background: #e2e3e5; color: #383d41; }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; border-bottom: 2px solid #e0e0e0; flex-wrap: wrap; }
.tab {
    padding: 8px 15px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}
.tab.active { color: #667eea; border-bottom-color: #667eea; }
.loans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    padding: 10px 0;
}
.loan-item {
    background: white;
    padding: 18px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
}
.loan-item:hover { border-color: #667eea; box-shadow: 0 8px 20px rgba(102,126,234,0.25); transform: translateY(-3px); }
.loan-item.late { border-color: #dc3545; background: linear-gradient(135deg, #fff 0%, #fff5f5 100%); }
.loan-item.needs-approval { border-color: #ffc107; border-width: 3px; }
.loan-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; padding-bottom: 10px; border-bottom: 2px solid #f0f0f0; }
.loan-business { font-size: 14px; font-weight: 700; color: #1a1a2e; margin-bottom: 2px; }
.loan-client { font-size: 12px; color: #666; font-weight: 500; }
.loan-status { padding: 3px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.status-active { background: #d4edda; color: #155724; }
.status-late { background: #f8d7da; color: #721c24; }
.status-finished { background: #d1ecf1; color: #0c5460; }
.status-archived { background: #e2e3e5; color: #383d41; }
.status-pending-approval { background: #fff3cd; color: #856404; }
.status-approved { background: #cce5ff; color: #004085; }
.status-funded { background: #d4edda; color: #155724; }
.status-completed { background: #e2e3e5; color: #383d41; }

.loan-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.badge-apr { background: #e8eaf6; color: #3949ab; padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: 600; }
.badge-compliance { background: #e8f5e9; color: #2e7d32; padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: 600; }
.badge-needs-approval {
    display: inline-block;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 6px;
    animation: pulse-approval 1.5s ease-in-out infinite;
}
@keyframes pulse-approval {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-bar { width: 100%; height: 8px; background: #e0e0e0; border-radius: 10px; overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #667eea 0%, #764ba2 100%); }
.progress-text { font-size: 11px; color: #888; margin-bottom: 8px; }
.loan-next { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 6px; background: #f8f9fa; font-size: 12px; }
.next-payment { color: #667eea; font-weight: 700; }
.empty-state { text-align: center; padding: 40px 20px; color: #999; }
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.floating-add {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
    text-decoration: none;
    transition: all 0.3s;
}
.floating-add:hover { transform: scale(1.1); }
.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 15px; z-index: 9999;
    font-size: 18px; color: #667eea; font-weight: 600;
}
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .portfolio-grid { grid-template-columns: 1fr 1fr; }
}

/* Dark Mode */
body.dark-mode { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); }
body.dark-mode .container { background: #0f0f23; color: #e0e0e0; }
body.dark-mode .header { }
body.dark-mode .content { color: #e0e0e0; }
body.dark-mode input, body.dark-mode select, body.dark-mode textarea { background: #16213e; color: #e0e0e0; border-color: #333; }
body.dark-mode .card-item, body.dark-mode .summary-card { border-color: #333; }

