/* Color Palette: Dark Purple (#4a148c), Light Purple (#7c43bd), Accent Green (#8bc34a) */
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    background-color: #333; /* Dark background */
    color: #fff; 
}

header { 
    text-align: center; 
    padding: 20px 0; 
    background-color: #4a148c; /* Dark Purple Header */
    color: #fff; 
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

h1, h2, h3 { color: #fff; margin-top: 0; }
h3 { border-bottom: 2px solid #7c43bd; padding-bottom: 5px; margin-bottom: 15px; }

/* Tabs */
.tabs { background-color: #383838; padding: 10px 0; display: flex; justify-content: center; }
.tab-button { 
    padding: 12px 25px; 
    cursor: pointer; 
    border: none; 
    background-color: #5d3599; /* Medium Purple for inactive */
    color: #fff; 
    font-weight: bold;
    margin: 0 5px;
    border-radius: 5px;
    transition: background-color 0.3s;
}
.tab-button:hover { background-color: #7c43bd; }
.tab-button.active { 
    background-color: #7c43bd; /* Light Purple for active */
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Content & Boxes */
.tab-content { 
    display: none; 
    padding: 30px; 
    margin: 20px;
    background-color: #424242; /* Darker content background */
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    overflow-x: auto; /* Allows table to slide */
}
.tab-content.active { display: block; }
.header-details label { margin-right: 30px; margin-bottom: 15px; display: inline-block; font-weight: 600; }

/* Table Styling - FIXED FOR SPACING AND VISIBILITY */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
    min-width: 1400px; /* Increased to give more room for all columns */
} 

th, td { 
    border: 1px solid #555; 
    padding: 10px 5px; /* Increased padding for vertical breathing room */
    text-align: center; 
    font-size: 0.85em;
    vertical-align: middle;
}

th { background-color: #6a1b9a; color: #fff; white-space: normal; }
td { background-color: #4e4e4e; position: relative; } /* Added relative for z-index control */

/* Name Column Room */
#memberTable td:nth-child(2) {
    min-width: 220px; 
    text-align: left;
}

/* Input Fields */
input[type="text"], input[type="number"], input[type="date"], input[type="time"] { 
    padding: 5px; 
    border: 1px solid #7c43bd; 
    background-color: #333; 
    color: #fff;
    border-radius: 4px;
    box-sizing: border-box; 
    height: 32px;
}

#memberTable input[type="number"] {
    width: 100%; 
    min-width: 80px;
    text-align: right;
}

#memberTable input[type="text"] {
    width: 100%; 
    text-align: left;
    padding-left: 8px;
}

/* FIX: ADVANCE PAID & SELECT LIST VISIBILITY */
.advance-paid-cell {
    min-width: 150px; /* Wider to accommodate text in dropdown */
    padding: 5px !important;
}

.advance-paid-cell input[type="number"] {
    width: 100% !important;
    margin-bottom: 5px;
}

.advance-paid-cell select.advance-method {
    width: 100% !important;
    display: block;
    background-color: #222;
    color: #8bc34a; /* Accent Green for better visibility */
    border: 1px solid #7c43bd;
    border-radius: 4px;
    height: 30px;
    font-size: 0.8em;
    cursor: pointer;
}

/* Ensure spans don't overlap */
span.cf-savings, span.cf-loan { 
    display: block; 
    padding: 5px; 
    font-weight: bold;
    text-align: right;
    background-color: #222; 
    border-radius: 4px;
    min-width: 90px;
    height: 32px;
    line-height: 22px;
}

/* Summary Boxes */
.section-box { 
    border: 2px solid #7c43bd; 
    padding: 20px; 
    margin-top: 25px; 
    border-radius: 8px; 
    background-color: #3a3a3a; 
}

/* Footer Styling */
tfoot tr td {
    background-color: #6a1b9a !important;
    color: #fff !important;
    font-weight: bold;
    padding: 15px 5px;
    border-top: 3px solid #8bc34a;
}