/* =========================================
   BASE CONTAINERS & LAYOUT
   ========================================= */
.rdf-mobile-container, .rdf-container {
    max-width: 900px; 
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    color: #333;
}

/* =========================================
   HEADERS
   ========================================= */
.rdf-compact-header, .rdf-report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f1f1;
}

.rdf-compact-header h3, .rdf-report-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
    font-weight: 700;
}

/* =========================================
   FILTERS & DATE PICKERS
   ========================================= */
.rdf-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    align-items: flex-end;
}

.rdf-filter-group { 
    flex: 1; 
    min-width: 200px; /* Ensure input doesn't get squashed */
}

.rdf-filter-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}

/* Text inputs (Used by Flatpickr) */
.rdf-filters input[type="text"] { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    box-sizing: border-box; 
    background-color: #fff; 
}

/* =========================================
   BUTTONS
   ========================================= */
.rdf-btn { 
    background: #2c3e50; 
    color: #fff; 
    border: none; 
    padding: 11px 25px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 600; 
    width: auto; 
    white-space: nowrap;
    transition: background 0.2s;
}

.rdf-btn:hover {
    background: #1a252f;
}

.rdf-btn-primary, .rdf-submit-fab {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    text-transform: uppercase;
    transition: transform 0.1s;
}

.rdf-btn-primary {
    background: #2196F3;
    color: white;
}

.rdf-submit-fab {
    background: #e91e63; /* Pinkish-Red for action */
    color: white;
    margin-top: 20px;
}

.rdf-btn-primary:active, .rdf-submit-fab:active {
    transform: scale(0.98);
}

/* Delete Button (Small) */
.rdf-btn-delete {
    background: #ff5252;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    transition: background 0.2s;
}

.rdf-btn-delete:hover {
    background: #d32f2f;
}

/* =========================================
   DASHBOARD SUMMARY GRID (P&L)
   ========================================= */
.rdf-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 cols for Tax Calc */
    gap: 15px;
    margin-bottom: 25px;
}

.rdf-dashboard-grid.pl-grid {
    grid-template-columns: repeat(4, 1fr); /* 4 cols for P&L */
}

.rdf-dash-card {
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.rdf-dash-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.rdf-dash-val {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.rdf-dash-raw .rdf-dash-val { color: #607d8b; }
.rdf-dash-inc .rdf-dash-val { color: #2196F3; }
.rdf-dash-exp .rdf-dash-val { color: #ff5252; }
.rdf-dash-net .rdf-dash-val { color: #00c853; }

/* =========================================
   BLACKOUT SECTION (DARK MODE DETAILS)
   ========================================= */
.rdf-blackout-section {
    background: #1a1a1a;
    color: #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.rdf-bo-title {
    margin: 0 0 20px 0;
    color: #fff;
    font-size: 16px;
    text-transform: uppercase;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    letter-spacing: 1px;
}

.rdf-bo-grid-large {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 30px;
}

.rdf-bo-col-large {
    border-right: 1px solid #333;
    padding-right: 20px;
}

.rdf-bo-col-large:last-child {
    border-right: none;
    padding-right: 0;
}

.rdf-bo-subhead {
    color: #888;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Summary Cards inside Blackout */
.rdf-bo-card {
    background: #252525; 
    padding: 10px; 
    border-radius: 6px; 
    margin-bottom: 10px;
    border-left: 3px solid #444;
}

.rdf-bo-label { font-size: 11px; color: #aaa; margin-bottom: 4px; }
.rdf-bo-val { font-size: 15px; font-weight: 700; color: #fff; }

/* Individual List Items in Blackout */
.rdf-bo-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.rdf-bo-item {
    background: #252525;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #333;
}

.rdf-bo-details {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #ccc;
    margin-bottom: 2px;
}

.rdf-bo-name {
    font-weight: 700;
    color: #fff;
    margin-bottom: 5px;
    font-size: 13px;
}

.rdf-bo-net {
    border-top: 1px solid #333;
    padding-top: 5px;
    margin-top: 5px;
    font-size: 12px;
    color: #4caf50;
    font-weight: 700;
    text-align: right;
}

/* Total Block for Lists */
.rdf-bo-total-block {
    background: #333;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 12px;
    border: 1px solid #444;
    color: #ccc;
}

.rdf-tb-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.rdf-tb-net {
    border-top: 1px solid #555;
    padding-top: 4px;
    margin-top: 4px;
    color: #4caf50; 
    font-weight: 700;
    font-size: 13px;
}

.rdf-text-danger { color: #ff5252; }

/* =========================================
   FORM & INPUT STYLES
   ========================================= */
.rdf-section {
    background: #fafafa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #eee;
}

.rdf-section-label {
    font-weight: 700;
    margin-bottom: 15px;
    color: #444;
    font-size: 13px;
    text-transform: uppercase;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

.rdf-input-group {
    margin-bottom: 15px;
}

.rdf-input-group label {
    display: block;
    font-size: 13px;
    color: #444;
    font-weight: 600;
    margin-bottom: 5px;
}

/* Flex Layout for Expense Rows */
.rdf-input-row { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 15px; 
    margin-bottom: 10px;
}

.rdf-label-text { 
    font-size: 13px; 
    color: #444; 
    font-weight: 600;
    flex-grow: 1;
}

/* General Number Input */
input[type="number"], input[type="text"] { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    box-sizing: border-box; 
    font-size: 14px;
}

/* Specific override for expense amount fields to prevent squashing label */
.rdf-input-row input { 
    width: 140px !important; 
    text-align: right; 
    flex-shrink: 0; 
}

.rdf-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: #333;
    box-sizing: border-box;
}

.rdf-info-bar {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 10px;
    text-align: center;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px;
    border: 1px solid #c8e6c9;
}

.rdf-sub-label {
    font-size: 12px;
    font-weight: 700;
    color: #333;
    margin: 20px 0 10px;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 5px;
    text-transform: uppercase;
}

/* =========================================
   TRANSACTION TABLES
   ========================================= */
.rdf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
    border: 1px solid #eee;
    margin-top: 10px;
}

.rdf-table th {
    background: #f8f9fa;
    text-align: left;
    padding: 12px 10px;
    border-bottom: 2px solid #eee;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
}

.rdf-table td {
    padding: 10px;
    border-bottom: 1px solid #f1f1f1;
    color: #333;
    vertical-align: middle;
}

.rdf-table tr:last-child td {
    border-bottom: none;
}

.rdf-table tr:hover {
    background: #fdfdfd;
}

.rdf-list-title {
    font-size: 16px;
    margin-top: 30px;
    margin-bottom: 15px;
    font-weight: 700;
    color: #333;
}

/* =========================================
   PAGINATION CONTROLS
   ========================================= */
.rdf-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.rdf-pagination-btn {
    background: #f1f1f1;
    border: 1px solid #ddd;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    color: #555;
}

.rdf-pagination-btn:hover {
    background: #e0e0e0;
}

/* =========================================
   COLLAPSIBLE SECTIONS
   ========================================= */
.rdf-collapsible-section {
    margin-top: 20px;
}

.rdf-collapsible-btn {
    width: 100%;
    background: #fff;
    border: 1px solid #e91e63; 
    padding: 10px;
    text-align: left;
    font-weight: normal;
    cursor: pointer;
    margin-top: 10px;
    border-radius: 4px;
    color: #e91e63;
    transition: background 0.2s;
}

.rdf-collapsible-btn:hover {
    background: #fff0f3;
}

.rdf-collapsible-content {
    display: none;
    padding: 15px;
    background: #fff;
    border: 1px solid #eee;
    border-top: none;
    margin-top: -4px;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* =========================================
   TAX CALCULATOR STYLES (UPDATED)
   ========================================= */
/* Force override of generic input styles */
.rdf-pct-input-inline {
    width: 50px !important;
    padding: 2px 4px !important;
    height: 28px !important;
    text-align: center !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    margin: 0 4px !important;
    display: inline-block !important;
    color: #333 !important;
    background-color: #fff !important;
    line-height: normal !important;
}

.rdf-calc-input-large {
    width: 100%;
    font-size: 24px !important;
    font-weight: 800;
    color: #2c3e50;
    border: none !important;
    background: transparent !important;
    text-align: center;
    padding: 0 !important;
}

.rdf-calc-display {
    width: 100%;
    font-size: 20px !important;
    font-weight: 700;
    color: #333;
    border: none !important;
    background: transparent !important;
    text-align: center;
    padding: 0 !important;
}

/* Tax Calculation Rows Grid */
.rdf-tax-rows {
    margin-top: 15px;
}

.rdf-tax-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
    align-items: center;
}

.rdf-tax-input-col {
    display: flex;
    flex-direction: column;
}

.rdf-tax-input-col label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    margin-bottom: 5px;
}

.rdf-pct-box {
    width: 100% !important;
    padding: 10px !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    text-align: center !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    color: #333 !important;
    background: #fff !important;
}

.rdf-calc-val {
    width: 100% !important;
    padding: 10px !important;
    border: 1px solid #999 !important;
    border-radius: 4px !important;
    text-align: right !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    background: #fff !important;
    color: #333 !important;
}

.rdf-calc-val-total {
    width: 100% !important;
    padding: 10px !important;
    border: 1px solid #d32f2f !important;
    background: #ffebee !important;
    border-radius: 4px !important;
    text-align: right !important;
    font-weight: 800 !important;
    font-size: 16px !important;
    color: #d32f2f !important;
}

.rdf-calc-val-final {
    width: 100% !important;
    padding: 10px !important;
    border: 1px solid #2e7d32 !important;
    background: #e8f5e9 !important; 
    border-radius: 4px !important;
    text-align: right !important;
    font-weight: 800 !important;
    font-size: 18px !important;
    color: #2e7d32 !important;
}

/* =========================================
   MOBILE RESPONSIVENESS (UPDATED)
   ========================================= */
@media (max-width: 768px) {
    /* Make Dashboard Grid Horizontally Scrollable (Interactive) */
    .rdf-dashboard-grid, .rdf-dashboard-grid.pl-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 15px;
        padding-bottom: 15px; /* Space for scrollbar */
        grid-template-columns: none; /* Override grid */
    }

    .rdf-dash-card {
        min-width: 260px; /* Fixed width for swipe cards */
        flex-shrink: 0;
        scroll-snap-align: center;
        border: 1px solid #eee;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }
    
    /* Hide scrollbar for cleaner look but allow scroll */
    .rdf-dashboard-grid::-webkit-scrollbar {
        height: 4px;
    }
    .rdf-dashboard-grid::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 4px;
    }

    /* Stack Blackout Columns */
    .rdf-bo-grid-large {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .rdf-bo-col-large {
        border-right: none;
        border-bottom: 1px solid #333;
        padding-right: 0;
        padding-bottom: 20px;
    }

    .rdf-bo-col-large:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    /* Filter Bar Logic */
    .rdf-filters {
        flex-direction: row;
        flex-wrap: wrap;
    }

    /* Range Filter: Full width input */
    .rdf-range-filter .rdf-filter-group {
        flex: 0 0 100%;
        margin-bottom: 10px;
        min-width: 0;
    }
    
    .rdf-range-filter .rdf-btn {
        flex: 0 0 100%;
        width: 100%;
    }

    /* Single Date Logic: Side-by-side */
    .rdf-single-filter .rdf-filter-group {
        flex: 0 0 60%;
        min-width: 0;
    }
    
    .rdf-single-filter .rdf-btn {
        flex: 0 0 38%;
        margin-top: 0;
        height: auto;
        width: auto;
        padding: 10px;
    }
}