/* ============================================
   Program Kas RW 006 - Style Sheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #DBEAFE;
    --secondary: #7C3AED;
    --success: #059669;
    --danger: #DC2626;
    --warning: #D97706;
    --bg-body: #0F172A;
    --bg-card: rgba(30, 41, 59, 0.85);
    --bg-card-solid: #1E293B;
    --bg-input: rgba(15, 23, 42, 0.7);
    --border: rgba(100, 116, 139, 0.3);
    --border-focus: rgba(37, 99, 235, 0.8);
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --shadow-glow: 0 0 40px rgba(37, 99, 235, 0.15);
    --radius: 14px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ---- Custom Scrollbar ---- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.8);
}

/* ---- Background Gradient Blobs ---- */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
}

body::before {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.18) 0%, transparent 70%);
    top: -150px;
    left: -150px;
}

body::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.14) 0%, transparent 70%);
    bottom: -100px;
    right: -100px;
}

/* ---- Layout ---- */
.page-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 30px 24px 60px;
    max-width: 1240px;
    margin: 0 auto;
}

/* ---- Header ---- */
.app-header {
    width: 100%;
    margin-bottom: 28px;
    text-align: center;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 100px;
    margin-bottom: 14px;
}

.app-title {
    font-size: clamp(24px, 5vw, 36px);
    font-weight: 800;
    background: linear-gradient(135deg, #F1F5F9 30%, #93C5FD 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    margin-bottom: 8px;
}

.app-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ---- Card ---- */
.card {
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 40px;
    box-shadow: var(--shadow-glow), 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* ---- Section Divider ---- */
.section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    margin-top: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.section-label:first-child {
    margin-top: 0;
}

/* ---- Form Group ---- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group label span.required {
    color: #F87171;
    margin-left: 3px;
}

/* ---- Inputs ---- */
.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    padding: 11px 14px;
    transition: var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    background: rgba(15, 23, 42, 0.9);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
    cursor: pointer;
}

select.form-control option {
    background: #1E293B;
    color: var(--text-primary);
}

input[type="date"].form-control::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

/* ---- Radio / Toggle Buttons ---- */
.toggle-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.toggle-option {
    flex: 1;
    min-width: 140px;
}

.toggle-option input[type="radio"] {
    display: none;
}

.toggle-option label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-input);
    transition: var(--transition);
    text-align: center;
    user-select: none;
}

.toggle-option label:hover {
    border-color: rgba(37, 99, 235, 0.5);
    color: var(--text-primary);
}

.toggle-option input[type="radio"]:checked+label {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.15);
    color: #93C5FD;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    font-weight: 600;
}

.toggle-option.sinoman input[type="radio"]:checked+label {
    border-color: var(--secondary);
    background: rgba(124, 58, 237, 0.15);
    color: #C4B5FD;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* ---- Month Grid (Checkbox) ---- */
#bulanSection {
    display: none;
    animation: fadeSlideIn 0.3s ease forwards;
}

#bulanSection.visible {
    display: block;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 4px;
}

.month-item input[type="checkbox"] {
    display: none;
}

.month-item label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px 8px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-input);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    text-align: center;
}

.month-item label:hover {
    border-color: rgba(37, 99, 235, 0.5);
    color: var(--text-primary);
}

.month-item input[type="checkbox"]:checked+label {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.2);
    color: #93C5FD;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.bulan-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-text:hover {
    color: #93C5FD;
    background: rgba(37, 99, 235, 0.1);
}

/* ---- Nominal Input ---- */
.input-prefix-wrap {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.input-prefix {
    background: rgba(37, 99, 235, 0.12);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 700;
    color: #93C5FD;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.input-prefix-wrap .form-control {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Readonly state (auto-calculated nominal) */
.form-control.readonly {
    cursor: default;
    border-color: rgba(217, 119, 6, 0.45);
    background: rgba(217, 119, 6, 0.06);
    color: #FCD34D;
    font-weight: 700;
    font-size: 15px;
    caret-color: transparent;
}

.form-control.readonly:focus {
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
    border-color: rgba(217, 119, 6, 0.6);
}

/* Nominal hint (breakdown label) */
.nominal-hint {
    display: none;
    margin-top: 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 5px;
}

.nominal-hint::before {
    content: '🧮';
    font-size: 11px;
}

/* ---- Keterangan ---- */
#keteranganSection {
    display: none;
    animation: fadeSlideIn 0.3s ease forwards;
}

#keteranganSection.visible {
    display: block;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ---- Submit Button ---- */
.btn-submit {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    opacity: 0;
    transition: var(--transition);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(37, 99, 235, 0.45);
}

.btn-submit:hover::before {
    opacity: 1;
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-submit .spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.btn-submit.loading .spinner {
    display: block;
}

.btn-submit.loading .btn-icon {
    display: none;
}

/* ---- Toast Notification ---- */
#toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    opacity: 0;
    min-width: 280px;
    max-width: 480px;
    white-space: nowrap;
    backdrop-filter: blur(20px);
}

#toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

#toast .toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

#toast.success {
    border-color: rgba(5, 150, 105, 0.5);
}

#toast.success .toast-icon {
    color: #34D399;
}

#toast.error {
    border-color: rgba(220, 38, 38, 0.5);
}

#toast.error .toast-icon {
    color: #F87171;
}

/* ---- Footer ---- */
.app-footer {
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

/* ---- Animations ---- */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.card {
    animation: fadeSlideIn 0.4s ease forwards;
}

/* ---- Responsive ---- */
@media (max-width: 560px) {
    .card {
        padding: 20px 16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .month-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .toggle-group {
        flex-direction: column;
    }

    .toggle-option {
        min-width: unset;
    }
}

/* ============================================
   DATA TABLE SECTION
   ============================================ */

.data-card {
    animation: fadeSlideIn 0.5s ease 0.1s both;
    padding: 28px 32px;
}

/* ── Data Header ── */
.data-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.data-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.data-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* ── Refresh Button ── */
.btn-refresh {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 8px 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-refresh:hover {
    border-color: var(--border-focus);
    color: #93C5FD;
    background: rgba(37, 99, 235, 0.1);
}

.btn-refresh.spinning svg {
    animation: spin 0.7s linear infinite;
}

/* ── Summary Cards ── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.summary-card {
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    border: 1px solid var(--border);
}

.summary-rw6 {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.25);
}

.summary-sinoman {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.25);
}

.summary-total {
    background: rgba(5, 150, 105, 0.08);
    border-color: rgba(5, 150, 105, 0.25);
}

.summary-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.summary-rw6 .summary-value {
    color: #93C5FD;
}

.summary-sinoman .summary-value {
    color: #C4B5FD;
}

.summary-total .summary-value {
    color: #6EE7B7;
}

.summary-value {
    font-size: 16px;
    font-weight: 700;
}

/* ── Table Loading Spinner ── */
.tbl-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

/* ── Table Wrapper (scroll) ── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ── Data Table ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 640px;
}

.data-table thead th {
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 11px 14px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
    border-bottom: 1px solid rgba(100, 116, 139, 0.12);
    transition: background 0.15s;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.05);
}

.data-table tbody td {
    padding: 10px 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody td.td-nominal {
    font-weight: 600;
    color: #FCD34D;
    white-space: nowrap;
}

.data-table tbody td.td-no {
    color: var(--text-muted);
    font-size: 12px;
    width: 40px;
}

.data-table tbody td.td-date {
    white-space: nowrap;
    color: var(--text-secondary);
}

.data-table tbody td.td-keterangan {
    color: var(--text-muted);
    font-size: 12px;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Sumber Badges ── */
.sumber-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-rw6 {
    background: rgba(37, 99, 235, 0.18);
    color: #93C5FD;
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.badge-sinoman {
    background: rgba(124, 58, 237, 0.18);
    color: #C4B5FD;
    border: 1px solid rgba(124, 58, 237, 0.3);
}

/* ── Bulan badge ── */
.bulan-badge {
    background: rgba(217, 119, 6, 0.12);
    color: #FCD34D;
    border: 1px solid rgba(217, 119, 6, 0.25);
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}

@media (max-width: 560px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .data-card {
        padding: 20px 16px;
    }
}

/* ============================================
   MODAL SYSTEM
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal-box-sm {
    max-width: 380px;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Modal Header ── */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
}

/* ── Modal Body ── */
.modal-body {
    padding: 20px 22px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-info-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ── Modal Footer ── */
.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.4);
}

.btn-modal-cancel {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-modal-cancel:hover {
    border-color: var(--border-focus);
    color: var(--text-primary);
}

.btn-modal-save {
    background: linear-gradient(135deg, #2563EB, #1d4ed8);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-modal-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}

.btn-modal-save:active {
    transform: none;
}

.btn-modal-delete {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-modal-delete:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.4);
}

.btn-modal-delete:active {
    transform: none;
}

/* ── Row Action Buttons ── */
.td-aksi {
    text-align: center;
    white-space: nowrap;
}

.btn-edit,
.btn-delete {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid;
    transition: var(--transition);
}

.btn-edit {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.3);
    color: #93C5FD;
}

.btn-edit:hover {
    background: rgba(37, 99, 235, 0.25);
    border-color: rgba(37, 99, 235, 0.6);
    transform: translateY(-1px);
}

.btn-delete {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(220, 38, 38, 0.3);
    color: #FCA5A5;
    margin-left: 4px;
}

.btn-delete:hover {
    background: rgba(220, 38, 38, 0.25);
    border-color: rgba(220, 38, 38, 0.6);
    transform: translateY(-1px);
}

/* ============================================
   TAB BAR
   ============================================ */

.tab-bar {
    display: flex;
    gap: 0;
    margin: 0 0 20px 0;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 5px;
    backdrop-filter: blur(8px);
}


.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
    background: transparent;
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

/* Pemasukan — active = green */
.tab-btn.tab-pemasukan.active {
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.35);
}

/* Pengeluaran — active = red */
.tab-btn.tab-pengeluaran.active {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    color: #fff;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.35);
}

/* ── Pemasukan indicator dot ── */
.tab-btn.tab-pemasukan svg {
    color: #34D399;
}

.tab-btn.tab-pemasukan.active svg {
    color: #fff;
}

/* ── Pengeluaran indicator dot ── */
.tab-btn.tab-pengeluaran svg {
    color: #F87171;
}

.tab-btn.tab-pengeluaran.active svg {
    color: #fff;
}

/* ============================================
   PENGELUARAN CARD & FORM
   ============================================ */

.card-pengeluaran {
    border-color: rgba(220, 38, 38, 0.2);
    box-shadow: var(--shadow-glow), 0 0 40px rgba(220, 38, 38, 0.05);
}

/* Red submit button */
.btn-submit-red {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%) !important;
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.35) !important;
}

.btn-submit-red:hover:not(:disabled) {
    box-shadow: 0 12px 35px rgba(220, 38, 38, 0.5) !important;
}

/* Red Rp prefix */
.input-prefix-red {
    color: #FCA5A5 !important;
}

/* Pengeluaran summary cards */
.summary-red {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.12), rgba(185, 28, 28, 0.08)) !important;
    border-color: rgba(220, 38, 38, 0.25) !important;
}

.summary-red .summary-label {
    color: #FCA5A5 !important;
}

.summary-red .summary-value {
    color: #F87171 !important;
}

.summary-redsoft {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.08), rgba(153, 27, 27, 0.06)) !important;
    border-color: rgba(220, 38, 38, 0.2) !important;
}

.summary-redsoft .summary-label {
    color: #FCA5A5 !important;
}

.summary-redsoft .summary-value {
    color: #F87171 !important;
}

.summary-redtotal {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(185, 28, 28, 0.1)) !important;
    border-color: rgba(220, 38, 38, 0.3) !important;
}

.summary-redtotal .summary-label {
    color: #FECACA !important;
}

.summary-redtotal .summary-value {
    color: #EF4444 !important;
    font-size: 22px !important;
}

/* ============================================
   CALCULATOR
   ============================================ */

/* Trigger button inside input-prefix-wrap */
.btn-calc {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(100, 116, 139, 0.35);
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.12);
    color: #93C5FD;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 6px;
}

.btn-calc:hover {
    background: rgba(37, 99, 235, 0.25);
    border-color: rgba(37, 99, 235, 0.5);
    transform: translateY(-1px);
}

/* Overlay flex */
#calcOverlay {
    display: none;
}

#calcOverlay.open {
    display: flex !important;
}

/* Calculator buttons — base */
.calc-btn {
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    padding: 14px 6px;
    cursor: pointer;
    transition: filter .12s, transform .1s;
    line-height: 1;
}

.calc-btn:hover {
    filter: brightness(1.2);
}

.calc-btn:active {
    transform: scale(.93);
}

/* Digit keys */
.calc-num {
    background: rgba(30, 41, 59, 0.95);
    color: #F1F5F9;
}

/* Function keys (AC, ±, %) */
.calc-fn {
    background: rgba(100, 116, 139, 0.25);
    color: #CBD5E1;
}

/* Operator keys */
.calc-op {
    background: rgba(217, 119, 6, 0.22);
    color: #FCD34D;
}

.calc-op.active-op {
    background: rgba(217, 119, 6, 0.55);
}

/* Equals key */
.calc-eq {
    background: linear-gradient(135deg, #2563EB, #7C3AED);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Wide zero button */
.calc-wide {
    text-align: left;
    padding-left: 20px;
}

/* ============================================
   DASHBOARD
   ============================================ */

.tab-dashboard.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    color: #A78BFA;
    border-bottom: 3px solid #7C3AED;
}

/* Header row */
.dash-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.dash-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    letter-spacing: -.3px;
}

.dash-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* KPI Grid */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 0;
}

/* KPI Card base */
.dash-kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 16px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}

.dash-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 14px 14px 0 0;
}

.dash-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

.kpi-icon {
    font-size: 22px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, .05);
}

.kpi-body {
    flex: 1;
    min-width: 0;
}

.kpi-label {
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
    margin-bottom: 4px;
    line-height: 1.2;
}

.kpi-value {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -.5px;
}

/* KPI color accents */
.kpi-green::before {
    background: #10B981;
}

.kpi-teal::before {
    background: #14B8A6;
}

.kpi-red::before {
    background: #EF4444;
}

.kpi-orange::before {
    background: #F97316;
}

.kpi-blue::before {
    background: #3B82F6;
}

.kpi-purple::before {
    background: #8B5CF6;
}

.kpi-indigo::before {
    background: #6366F1;
}

.kpi-rose::before {
    background: #F43F5E;
}

.kpi-slate::before {
    background: #64748B;
}

.kpi-green .kpi-value {
    color: #10B981;
}

.kpi-teal .kpi-value {
    color: #14B8A6;
}

.kpi-red .kpi-value {
    color: #F87171;
}

.kpi-orange .kpi-value {
    color: #FB923C;
}

.kpi-blue .kpi-value {
    color: #60A5FA;
}

.kpi-purple .kpi-value {
    color: #A78BFA;
}

.kpi-indigo .kpi-value {
    color: #818CF8;
}

.kpi-rose .kpi-value {
    color: #FB7185;
}

.kpi-slate .kpi-value {
    color: #94A3B8;
}

/* Chart containers */
.dash-chart-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 16px;
    margin-top: 16px;
}

.dash-grid-half {
    grid-template-columns: 1fr 1fr;
}

.dash-grid-full {
    grid-template-columns: 1fr;
}

.dash-chart-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 4px;
}

.dash-card-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.dash-card-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.dash-chart-wrap {
    flex: 1;
    position: relative;
    min-height: 220px;
    max-height: 280px;
}

.dash-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Recent transactions list */
.recent-tx-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 310px;
    overflow-y: auto;
    padding-right: 6px;
    margin-right: -2px;
    /* Pull it slightly right to balance the scrollbar padding */
}

.recent-tx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 10px;
    transition: background .15s;
}

.recent-tx-item:hover {
    background: rgba(255, 255, 255, .06);
}

.tx-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 5px;
    white-space: nowrap;
    letter-spacing: .3px;
    flex-shrink: 0;
}

.tx-badge.in {
    background: rgba(16, 185, 129, .15);
    color: #10B981;
}

.tx-badge.out {
    background: rgba(239, 68, 68, .15);
    color: #F87171;
}

.tx-info {
    flex: 1;
    min-width: 0;
}

.tx-desc {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-meta {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 1px;
}

.tx-amount {
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.tx-amount.in {
    color: #10B981;
}

.tx-amount.out {
    color: #F87171;
}

.dash-loading {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 20px;
}

/* Responsive */
@media (max-width: 1200px) {
    .dash-kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1100px) {
    .dash-kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .dash-chart-grid,
    .dash-grid-half {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dash-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-wrapper {
        padding: 20px 16px 60px;
        /* Reduce padding to give more width to content */
    }
}

@media (max-width: 650px) {
    .page-wrapper {
        padding: 12px 6px 60px;
        /* Minimal padding for full-width feel */
    }

    .dash-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        /* Tighter gap */
    }

    .dash-kpi-card {
        padding: 14px 6px;
        flex-direction: column;
        justify-content: center;
        text-align: center;
        gap: 8px;
        border-radius: 12px;
    }

    .dash-kpi-card .kpi-icon {
        width: 36px;
        height: 36px;
        font-size: 20px;
        margin: 0 auto;
    }

    .dash-kpi-card .kpi-body {
        align-items: center;
        width: 100%;
    }

    .dash-kpi-card .kpi-value {
        font-size: 14.5px;
        margin-top: 2px;
    }

    .dash-kpi-card .kpi-label {
        font-size: 10px;
    }

    .dash-chart-card,
    .dash-ledger-card {
        padding: 16px 10px;
        border-radius: 12px;
    }
}

/* ── Ledger / Buku Kas table ─────────────────────────────── */
.dash-ledger-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
}

.ledger-table-wrap {
    overflow-x: auto;
    max-height: 520px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .08);
    padding-right: 4px;
}

.ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 650px;
    /* Prevent table from squishing below this width. Forces horiz scroll. */
}

/* ── Header ── */
.ledger-table thead th {
    position: sticky;
    top: 0;
    background: #1A4731;
    color: #D1FAE5;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    padding: 11px 14px;
    white-space: nowrap;
    border-bottom: 2px solid rgba(16, 185, 129, .3);
    z-index: 2;
}

/* ── Body rows ── */
.ledger-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    transition: background .12s;
}

.ledger-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, .018);
}

.ledger-table tbody tr:hover {
    background: rgba(16, 185, 129, .06);
}

/* Left border accent */
.ledger-table tbody tr.ledger-in td:first-child {
    border-left: 3px solid #10B981;
}

.ledger-table tbody tr.ledger-out td:first-child {
    border-left: 3px solid #EF4444;
}

/* Saldo Awal row */
.ledger-table tbody tr.ledger-saldo-awal {
    background: rgba(16, 185, 129, .08) !important;
}

.ledger-table tbody tr.ledger-saldo-awal td:first-child {
    border-left: 3px solid #F59E0B;
}

.ledger-table tbody tr.ledger-saldo-awal td {
    font-style: italic;
}

/* Dana Talangan Highlight - Column/Info Only */
.ledger-table tbody tr.row-talangan td:nth-child(3),
.data-table tbody tr.row-talangan td:nth-child(4),
.data-table tbody tr.row-talangan td.td-keterangan {
    background-color: rgba(168, 85, 247, 0.22) !important;
    color: #F8FAFC;
    font-weight: 500;
}

.ledger-table tbody tr.row-talangan td:first-child,
.data-table tbody tr.row-talangan td:first-child {
    border-left: 4px solid #A855F7 !important;
}

.recent-tx-item.row-talangan .tx-info {
    background-color: rgba(168, 85, 247, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
}

.recent-tx-item.row-talangan {
    border-left: 4px solid #A855F7 !important;
    background: transparent !important;
}

/* Last row (bold saldo akhir) */
.ledger-table tbody tr.ledger-last {
    background: rgba(16, 185, 129, .05) !important;
    border-top: 2px solid rgba(16, 185, 129, .2);
}

.ledger-table tbody tr.ledger-last td:first-child {
    border-left: 3px solid #34D399;
}

/* ── Cells ── */
.ledger-table tbody td {
    padding: 9px 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

/* Numeric alignment */
.ledger-table th.num,
.ledger-table td.num {
    text-align: right;
}

.ledger-table td.num-sm {
    text-align: center;
    color: var(--text-muted);
    width: 44px;
    font-size: 12px;
}

.ledger-table td.nowrap {
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 12.5px;
}

/* Deskripsi bold untuk saldo awal */
.ledger-table td.desc-bold {
    font-weight: 700;
    color: #D1FAE5;
}

/* Rp prefix / number formatting */
.rp-pfx {
    font-size: 11px;
    font-weight: 600;
    color: inherit;
    opacity: .75;
    margin-right: 2px;
}

.rp-num {
    font-weight: 600;
}

.rp-bold {
    font-weight: 800 !important;
    opacity: 1 !important;
    font-size: 13.5px !important;
}

/* Pemasukan column */
.ledger-table td.in-val {
    color: #10B981;
    font-weight: 600;
    text-align: right;
}

/* Pengeluaran column */
.ledger-table td.out-val {
    color: #F87171;
    font-weight: 600;
    text-align: right;
}

/* Saldo cell */
.ledger-table td.saldo-cell {
    text-align: right;
    color: #34D399;
    font-weight: 700;
    white-space: nowrap;
}

.saldo-pos {
    color: #34D399;
    font-weight: 700;
}

.saldo-neg {
    color: #F87171;
    font-weight: 700;
}

/* Empty state */
.ledger-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-size: 13px;
}

/* Kas Source Badges */
.kas-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 6px;
    vertical-align: middle;
}

.kas-badge.rw6 {
    background: rgba(59, 130, 246, 0.15);
    color: #60A5FA;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.kas-badge.sinoman {
    background: rgba(139, 92, 246, 0.15);
    color: #A78BFA;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-talangan {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: lowercase;
    background: rgba(168, 85, 247, 0.15);
    color: #C084FC;
    border: 1px solid rgba(168, 85, 247, 0.3);
    margin-left: 6px;
    font-style: italic;
}

.badge-repayment {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: lowercase;
    background: rgba(16, 185, 129, 0.15);
    /* Emerald green background */
    color: #34D399;
    /* Emerald text */
    border: 1px solid rgba(16, 185, 129, 0.3);
    margin-left: 6px;
    font-style: italic;
}

/* ── Aksi Buttons ── */
.btn-aksi {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    margin: 0 4px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0.8;
}

.btn-aksi.btn-edit {
    color: #60A5FA;
}

.btn-aksi.btn-edit:hover {
    opacity: 1;
    background: rgba(59, 130, 246, 0.15);
}

.btn-aksi.btn-print {
    color: #6EE7B7;
}

.btn-aksi.btn-print:hover {
    opacity: 1;
    background: rgba(16, 185, 129, 0.15);
}

.btn-aksi.btn-delete {
    color: #F87171;
}

.btn-aksi.btn-delete:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.15);
}

/* Uppercase all table cells as requested */
table tbody td {
    text-transform: uppercase;
}

/* ── Mobile Overrides ── */
@media (max-width: 640px) {
    .tab-bar {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        padding: 8px !important;
        height: auto !important;
    }
    .tab-btn {
        padding: 10px 8px !important;
        font-size: 13px !important;
        flex-direction: column !important;
        gap: 6px !important;
        width: 100% !important;
        margin: 0 !important;
    }
}