:root {
    --primary-color: #b66f12;
    /* brownish */
    --primary-light: #d97706;
    /* amber-600 */
    --accent-color: #fca510;
    /* bright orange-gold */
    --success-color: #16a34a;
    /* green-600 */
    --danger-color: #dc2626;
    /* red-600 */
    --bg-color: #f8fafc;
    /* slate-50 */
    --white: #ffffff;
    --text-primary: #1e293b;
    /* slate-800 */
    --text-secondary: #64748b;
    /* slate-500 */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 0.5rem;
}

/* New Action Button Styles to match Theme */
.action-btn {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    flex: 1;
}

.action-btn.received {
    background-color: #b66f12;
    /* Primary Brown */
    color: white;
    box-shadow: 0 4px 6px rgba(182, 111, 18, 0.2);
}

.action-btn.spent {
    background-color: #fca510;
    /* Accent Orange/Gold */
    color: #431407;
    box-shadow: 0 4px 6px rgba(252, 165, 16, 0.2);
}

.action-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    /* fallback and dynamic for mobile */
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--white);
    position: relative;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
}

/* Header & Tabs */
.app-header {
    background-color: var(--primary-color);
    /* Darker brown/coffee */
    color: var(--white);
    padding: 0;
    flex-shrink: 0;
}

.app-title {
    padding: 16px;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    background-color: var(--primary-color);
    /* Even darker header bar */
}

.app-tabs {
    display: flex;
    justify-content: space-around;
    background-color: #6d4c41;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 14px;
    font-size: 1rem;
    text-transform: capitalize;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 4px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--white);
    border-bottom-color: var(--white);
    font-weight: 600;
}

/* Content Area */
.app-content {
    flex: 1;
    overflow: hidden;
    /* Remove global scroll */
    background-color: var(--bg-color);
    position: relative;
    padding: 0;
    /* Remove global padding */
    display: flex;
    flex-direction: column;
}

.view {
    display: none;
    height: 100%;
    width: 100%;
    flex-direction: column;
}

.view.active {
    display: flex;
}

/* Main Views (Team & Sites) with FAB */
#team-view,
#sites-view {
    position: relative;
    overflow: hidden;
    /* Contain the absolute FAB */
}

#team-view .list-container,
#sites-view .list-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 80px;
    /* Space for FAB */
}

/* Detail Views - Full Page Scroll */
#site-detail-view,
#user-detail-view {
    overflow-y: auto;
    padding: 16px;
}

/* Lists */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    background: var(--white);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    border: none;
    position: relative;
}

.card-avatar {
    width: 45px;
    height: 45px;
    background-color: #d7ccc8;
    /* Light brown/tan */
    color: #5d4037;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: 16px;
    flex-shrink: 0;
}

.card-content {
    flex: 1;
}

.card-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.card-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-mark {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-color);
    /* Was light green */
    color: var(--white);
    /* Was green */
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-call {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1rem;
}

/* FAB */
.fab {
    position: absolute;
    bottom: 40px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #6d4c41;
    /* Main Brown */
    color: var(--white);
    border: none;
    font-size: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Modal */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
}

#modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--white);
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
}

/* Site Selection Grid in Modal */
.site-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.site-select-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #64748b;
}

.site-select-card i {
    font-size: 1.2rem;
    color: #cbd5e1;
}

.site-select-card.selected {
    border-color: #8d6e63;
    background-color: #efebe9;
    /* Light brown tint */
    color: #5d4037;
    font-weight: 600;
}

.site-select-card.selected i {
    color: #8d6e63;
    /* Brown */
}


.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #8d6e63;
    box-shadow: 0 0 0 2px rgba(141, 110, 99, 0.2);
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    /* To separate Cancel/Save if needed, or stick together */
    gap: 12px;
    margin-top: 24px;
}

.modal-actions button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}

#modal-cancel {
    background: transparent;
    border: 1px solid #ef5350;
    /* Red outline */
    color: #ef5350;
}

#modal-save {
    background-color: #d2a679;
    /* Tan/Gold color from image */
    color: white;
}


/* Site Card Specifics */
.site-card-icon {
    width: 45px;
    height: 45px;
    background-color: #dbeafe;
    /* Blue-100 */
    color: #3b82f6;
    /* Blue-500 */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-right: 16px;
    flex-shrink: 0;
}

.site-location-text {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.site-location-text i {
    font-size: 0.75rem;
    color: #94a3b8;
}

.site-balance-badge {
    display: inline-block;
    padding: 6px 10px;
    background-color: #f0fdf4;
    /* Green-50 */
    color: #15803d;
    /* Green-700 */
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Site Dashboard Specifics */
.financial-summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

/* ... rest of the existing styles from line 352 ... */
.stat-row {
    display: flex;
    gap: 16px;
}

/* ... (Ensure all previous styles are preserved or re-written if using replace_file with overlap) ... */
/* Since I'm using replace from end, I'll just append. But wait, replace_file_content replaces a block. */
/* I will assume the previous content is known and I should only append new classes if I use a specific range, but here I am creating new classes. */
/* Just adding the new classes at the end of the file or before specific sections is better. */
/* I'll rewrite the section "Site Dashboard Specifics" and insert my new classes before it. */


.stat-row {
    display: flex;
    gap: 16px;
}

.stat-row .stat-card {
    flex: 1;
}

.stat-card {
    background: var(--white);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Balance Hero Card */
.stat-card.balance-hero {
    background-color: #eff6ff;
    /* Very light blue */
    border: 1px solid #bfdbfe;
    text-align: center;
    padding: 24px 16px;
}

.stat-card.balance-hero .stat-label {
    color: #3b82f6;
    /* Blue-500 */
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.stat-card.balance-hero .stat-value {
    color: #15803d;
    /* Green-700 */
    font-size: 2rem;
    font-weight: 700;
}

/* Received & Spent Cards */
.stat-card.is-received,
.stat-card.is-spent {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100px;
    cursor: pointer;
    transition: transform 0.1s;
}

.stat-card.is-received:active,
.stat-card.is-spent:active {
    transform: scale(0.98);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stat-header span {
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-icon {
    font-size: 0.9rem;
    opacity: 0.3;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Received Styling */
.stat-card.is-received {
    background-color: #f0fdf4;
    /* Green-50 */
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.stat-card.is-received .action-icon {
    color: #15803d;
}

/* Spent Styling */
.stat-card.is-spent {
    background-color: #fef2f2;
    /* Red-50 */
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.stat-card.is-spent .action-icon {
    color: #b91c1c;
}


/* Transaction List Styling */
.tx-card {
    display: flex;
    align-items: center;
    padding: 12px;
    gap: 16px;
    position: relative; 
    /* For Delete Button */
}

.tx-date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc;
    /* Slate-50 */
    border-radius: 8px;
    padding: 6px 12px;
    width: 60px;
    flex-shrink: 0;
}

.tx-date-block .day {
    font-size: 0.65rem;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
}

.tx-date-block .date {
    font-size: 1.25rem;
    font-weight: 700;
    color: #334155;
    line-height: 1.2;
}

.tx-date-block .month {
    font-size: 0.7rem;
    color: #64748b;
}

.tx-in {
    color: #16a34a;
    font-weight: 700;
}

.tx-out {
    color: #dc2626;
    font-weight: 700;
}

.card-amount {
    font-size: 1rem;
    margin-left: auto;
    /* Push to right */
}

/* Detail View Styles Override */
.detail-header {
    background-color: var(--primary-color);
    /* The Golden/Brown Color from image */
    margin: -16px -16px 16px -16px;
    /* Reduced bottom margin */
    padding: 16px 16px 24px 16px;
    /* Drastically reduced bottom padding */
    color: white;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.back-btn {
    color: #ffffff;
    /* Pure white */
    margin-bottom: 20px;
    /* Space between back button and title */
    padding: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    opacity: 1;
    /* Ensure full visibility */
    cursor: pointer;
    background: transparent;
    border: none;
}

.back-btn i {
    margin-right: 8px;
}

#site-detail-view h3 {
    margin-top: 24px;
    margin-bottom: 16px;
    color: #64748b;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

#user-detail-view h3 {
    margin-top: 42px;
    margin-bottom: 16px;
    color: #64748b;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

#detail-site-name,
#detail-user-name {
    font-size: 1.75rem;
    line-height: 1.2;
    font-weight: 700;
}

/* Fix main content top padding when in detail view to accommodate header */


.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* NEW USER DETAIL STYLES */

/* Pay Card */
.pay-card {
    background: #fff8eb;
    /* Very light orange/cream */
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.pay-card h3 {
    color: #92400e;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.pay-input-wrapper input {
    width: 100%;
    font-size: 1.25rem;
    padding: 12px;
    border: 1px solid #d97706;
    /* Amber border */
    border-radius: 8px;
    outline: none;
    font-weight: 500;
}

.amount-words {
    color: #b45309;
    font-size: 0.85rem;
    margin-top: 8px;
    margin-bottom: 16px;
    font-style: italic;
}

.pay-btn {
    width: 100%;
    background: var(--primary-color);
    /* The Golden/Brown Color */
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pay-btn:active {
    transform: translateY(1px);
}

/* User Summary Card */
.user-summary-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #64748b;
}

.summary-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 12px 0;
}

.summary-row.total {
    margin-bottom: 0;
    color: #0f172a;
    font-weight: 700;
    font-size: 1.1rem;
}

.val-earned {
    color: #334155;
    font-weight: 600;
}

.val-paid {
    color: #dc2626;
    font-weight: 600;
}

.val-payable {
    color: #16a34a;
}

/* History Section */
.section-title {
    font-size: 0.85rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 24px 0 12px 0;
    font-weight: 700;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    padding-right: 32px;
    /* Space for delete button */
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 12px;
    /* Space between cards */
    border: 1px solid #f1f5f9;
    position: relative;
    /* For absolute positioning of delete button */
}

/* ... existing code ... */

.btn-delete-icon {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: #ef4444;
    padding: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.4;
    transition: opacity 0.2s;
    border-radius: 50%;
}

.history-content h4 {
    color: #334155;
    font-size: 1rem;
    margin-bottom: 4px;
    font-weight: 600;
}

.history-content p {
    color: #94a3b8;
    font-size: 0.8rem;
}

.badge-unit {
    background: #f0fdf4;
    color: #166534;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    border: 1px solid #bbf7d0;
}

/* Specific styling for Payment History items to look distinct */
.history-item.payment-item {
    background: white;
    /* Keep white card base */
    border-left: 4px solid #ef4444;
    /* Red accent on left */
    margin: 0 0 12px 0;
    /* Reset margins to match standard card */
    padding: 16px;
}


.btn-delete-icon {
    background: none;
    border: none;
    color: #ef4444;
    padding: 8px;
    cursor: pointer;
    margin-left: 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
    border-radius: 50%;
}

.btn-delete-icon:hover {
    opacity: 1;
    background-color: #fee2e2;
}

.history-amount {
    color: #dc2626;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Login View */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100dvh;
    background-color: var(--primary-color);
    padding: 16px;
}

.login-card {
    background: var(--white);
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h1 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 2rem;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.primary-btn {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px;
    width: 100%;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
}

.primary-btn:active {
    transform: scale(0.98);
}

/* Secondary Button (for Header Actions) */
.secondary-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.secondary-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(1px);
}

/* Attendance Modal Styles */
.shift-btn-group {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.shift-btn {
    flex: 1;
    padding: 8px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s;
}

.shift-btn.active {
    background: #d97706; /* Primary Light/Amber */
    color: white;
    border-color: #d97706;
}

.btn-absent {
    background: #fee2e2; /* Red-100 */
    color: #dc2626; /* Red-600 */
    border: 1px solid #fecaca;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-absent:hover {
    background: #fecaca;
}

.btn-absent:active {
    transform: translateY(1px);
}