:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --dark-text: #343a40;
    --border-color: #ced4da;
    --card-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

body {
    background-color: var(--light-bg);
    color: var(--dark-text);
    line-height: 1.6;
}

.container {
    width: 95%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
}

h1, h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

/* --- Form & Input Styles --- */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"], input[type="number"], input[type="password"], select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-readonly {
    background-color: #e9ecef;
    cursor: default;
}

.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-group label {
    font-weight: normal;
    cursor: pointer;
}

.custom-split-container {
    padding: 10px;
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    margin-top: 10px;
}

.split-persons-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

/* --- Buttons --- */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
    margin-top: 20px;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-logout {
    background-color: var(--secondary-color);
    color: white;
    width: auto;
    margin-top: 0;
}

.btn-edit, .btn-delete {
    padding: 5px 10px;
    margin: 2px;
    font-size: 14px;
    width: auto;
}

.btn-edit { background-color: var(--success-color); color: white; }
.btn-delete { background-color: var(--danger-color); color: white; }
.btn-export { background-color: var(--primary-color); color: white; margin-right: 10px; }
.btn-danger { background-color: var(--danger-color); color: white; }

/* --- Dashboard Specific Layout --- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* KPI Cards */
.kpi-cards {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.kpi-card {
    flex: 1 1 200px;
    padding: 15px;
    background-color: var(--light-bg);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    min-width: 45%; 
}

.kpi-card h3 {
    margin-bottom: 5px;
    font-size: 1em;
    color: var(--secondary-color);
}

.kpi-card p {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary-color);
}

/* Tabs */
.tab-controls {
    display: flex;
    border-bottom: 2px solid #ccc;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px 15px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 16px;
    color: var(--secondary-color);
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    font-weight: bold;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* List Controls */
.list-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* Tables */
.expense-table, .spend-borrow-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.expense-table th, .spend-borrow-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 10px;
    text-align: left;
}

.expense-table td, .spend-borrow-table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.expense-table tr:hover {
    background-color: #f1f1f1;
}

/* Balance colors */
.text-success { color: var(--success-color); font-weight: bold; }
.text-danger { color: var(--danger-color); font-weight: bold; }

/* Pagination */
.pagination {
    text-align: center;
    padding: 10px;
}

/* --- Responsive & Mobile First --- */
@media (max-width: 768px) {
    .container {
        margin: 10px auto;
        padding: 15px;
    }

    h1 { font-size: 1.8em; }

    .kpi-card { min-width: 100%; }
    
    .list-controls {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .list-actions, .list-options {
        margin-bottom: 10px;
    }
    
    /* Hide non-essential columns on small screens */
    .expense-table .desktop-only,
    .expense-table .desktop-only {
        display: none;
    }
}