:root {
    --bg-color: #0f172a;       /* Deep obsidian background */
    --card-bg: #1e293b;        /* Slate gray card background */
    --primary: #38bdf8;        /* Electric cyan */
    --primary-hover: #0ea5e9;  
    --success: #10b981;        
    --success-grad: linear-gradient(135deg, #10b981, #059669);
    --warning-bg: #2e2511;     
    --warning-border: #f59f00; 
    --text-dark: #f8fafc;      
    --text-muted: #94a3b8;     
    --border-color: #334155;   
}

/* Base Responsive Container Styles */
body { 
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; 
    background: var(--bg-color); 
    color: var(--text-dark); 
    padding: 15px; /* Reduced body padding for tight mobile frames */
    margin: 0; 
    -webkit-tap-highlight-color: transparent;
}

.container { 
    max-width: 950px; 
    margin: 0 auto; 
    background: var(--card-bg); 
    padding: 20px; /* Reduced container padding for mobile screen optimization */
    border-radius: 12px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.3); 
    box-sizing: border-box;
}

h2 { font-size: 24px; margin-top: 0; margin-bottom: 5px; }
h3 { font-size: 18px; margin-top: 25px; margin-bottom: 10px; }

/* Flexbox Action Controls */
.action-bar {
    display: flex;
    flex-direction: column; /* Stack buttons vertically by default on phones */
    gap: 10px;
    margin: 15px 0;
}

/* Metric Display Blocks Grid Layout */
.box-row { 
    display: grid; 
    grid-template-columns: 1fr; /* Single column layout for smartphones */
    gap: 15px; 
    margin: 15px 0; 
}

.card { 
    background: var(--success-grad); 
    color: white; 
    padding: 18px; 
    border-radius: 8px; 
    box-shadow: 0 4px 12px rgba(16,185,129,0.15); 
}
.card .val { font-size: 28px; font-weight: bold; margin-top: 5px; }

.alert { 
    background: var(--warning-bg); 
    border-left: 4px solid var(--warning-border); 
    color: #ffdd99; 
    padding: 18px; 
    border-radius: 8px; 
    font-size: 14px;
}

/* Fund Proportions Bars Styles */
.bar-container { background: #1a2236; border: 1px solid var(--border-color); padding: 15px; border-radius: 8px; margin: 20px 0; }
.bar-item { margin-bottom: 12px; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.bar-track { background: #334155; width: 100%; height: 10px; border-radius: 10px; overflow: hidden; }
.bar-fill { background: var(--primary); height: 100%; }

/* Mobile-Friendly Table Containers */
table { width: 100%; border-collapse: collapse; margin-top: 15px; }
th, td { padding: 10px; border-bottom: 1px solid var(--border-color); text-align: left; font-size: 13px; }
th { background: #1a2236; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }
td { color: var(--text-dark); white-space: nowrap; } /* Prevents ugly text wrapping on small displays */

/* Touch Target Button System Optimizations */
.btn { 
    background: #3b82f6; 
    color: white; 
    border: none; 
    padding: 12px 20px; /* Thicker touch space targets to prevent typos */
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: bold; 
    font-size: 14px;
    width: 100%; /* Force buttons to be full-width on mobile */
    text-align: center;
    box-sizing: border-box;
}
.btn:active { background: #2563eb; }

/* Centered Desktop Backdrop Layout Modals */
.modal { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(15,23,42,0.7); backdrop-filter: blur(4px); justify-content: center; align-items: flex-end; z-index: 1000; }
.modal-content { 
    background: var(--card-bg); 
    padding: 25px; 
    border-radius: 16px 12px 0 0; /* Bottom sheet styling feel for phone layout models */
    width: 100%; 
    max-width: 100%;
    border: 1px solid var(--border-color); 
    box-shadow: 0 -10px 25px rgba(0,0,0,0.3); 
    box-sizing: border-box;
}
.modal-wide { width: 100%; max-width: 100%; }

.f-group { margin-bottom: 12px; }
.f-group label { display: block; font-size: 12px; font-weight: bold; margin-bottom: 4px; color: var(--text-muted); }
.f-group input, .f-group select { width: 100%; padding: 12px; background: #0f172a; color: white; border: 1px solid var(--border-color); border-radius: 6px; box-sizing: border-box; font-size: 15px; }

.sub-box { background: #111827; padding: 10px; border-radius: 6px; font-weight: bold; margin-bottom: 15px; border-left: 4px solid var(--success); }

/* --- RESPONSIBLE LAPTOP AND COMPUTER STYLE OVERRIDES --- */
@media (min-width: 600px) {
    body { padding: 25px; }
    .container { padding: 30px; }
    .action-bar { flex-direction: row; }
    .box-row { grid-template-columns: 1fr 2fr; } /* Side-by-side blocks layout on computer monitors */
    .btn { width: auto; }
    .modal { align-items: center; }
    .modal-content { border-radius: 8px; width: 340px; }
    .modal-wide { width: 480px; }
    th, td { font-size: 14px; padding: 12px; }
}

/* Core Popup Modal Structural Display Rule Hooks */
.modal {
    display: none !important;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal.active {
    display: flex !important;
}
.modal-content {
    background: #1e293b;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    border: 1px solid #334155;
    box-sizing: border-box;
}
.modal-wide {
    max-width: 600px;
}
#hModal { z-index: 3000 !important; }

/* Family Last Name Summary Card Layout Blocks */
.family-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 15px; margin: 20px 0; }
.family-card { background: #1e293b; border: 1px solid var(--border-color); padding: 15px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.family-card h4 { margin: 0 0 8px 0; color: var(--primary); font-size: 16px; border-bottom: 1px solid var(--border-color); padding-bottom: 4px; }
.family-stat { font-size: 13px; margin: 4px 0; display: flex; justify-content: space-between; }
.family-stat span { color: var(--text-muted); }
