:root {
    --green-deep: #308f59;
    --green-dark: #225a3a;
    --peach: #ffedd8;
    --mint: #cef3de;
    --text-dark: #0e0e0e;
    --red-late: #c0392b;
    --sidebar-w: 220px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-dark);
    background: #fff;
    font-size: 13px;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--green-deep);
    border-radius: 0 28px 28px 0;
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    color: #fff;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 38px;
}

.sidebar-brand img {
    width: 34px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand span {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 19px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.2s;
}

.sidebar-link:hover {
    color: #fff;
}

.sidebar-link.active {
    font-weight: 700;
    color: #fff;
}

.sidebar-link svg {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
}

.sidebar-admin {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.sidebar-admin svg {
    width: 17px;
    height: 17px;
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
    flex: 1;
    padding: 28px 34px 40px;
    min-width: 0;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: left;
}

/* ---------- FILTER TABS ---------- */
.filter-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.filter-tab {
    padding: 6px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 400;
    background: var(--peach);
    color: var(--text-dark);
    transition: all 0.3s ease;
    height: 32px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.filter-tab.active {
    background: var(--green-dark);
    color: var(--peach);
}

.filter-tab.lunas-active {
    background: var(--green-deep);
    color: #fff;
}

.filter-tab:hover:not(.active):not(.lunas-active) {
    background: #ffddaa;
}

.search-box {
    position: relative;
    margin-left: auto;
}

.search-box input {
    width: 220px;
    height: 32px;
    padding: 0 35px 0 14px;
    border-radius: 12px;
    border: none;
    background: var(--peach);
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    color: var(--text-dark);
    outline: none;
    text-align: left;
}

.search-box input::placeholder {
    color: rgba(0, 0, 0, 0.5);
    font-size: 12px;
    text-align: left;
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--green-deep);
    pointer-events: none;
    width: 14px;
    height: 14px;
}

/* ---------- STATS GRID ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--peach);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 14px;
    padding: 20px 24px;
    text-align: left;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.stat-card h3 {
    font-size: 14px;
    font-weight: 500;
    color: #1a3525;
    margin-bottom: 4px;
    text-align: left;
}

.stat-card p {
    font-size: 32px;
    font-weight: 600;
    color: #1a3525;
    text-align: left;
}

/* ---------- TABLE PANEL ---------- */
.table-panel {
    background: var(--mint);
    border-radius: 18px;
    padding: 20px 22px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--text-dark);
    text-align: left;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table thead th {
    text-align: left;
    font-size: 13px;
    font-weight: 400;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    color: var(--text-dark);
}

.history-table thead th:first-child {
    padding-left: 4px;
}

.history-table tbody td {
    text-align: left;
    font-size: 13px;
    padding: 11px 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    color: var(--text-dark);
    vertical-align: middle;
}

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

.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
}

/* ---------- STATUS TAGS ---------- */
.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    transition: all 0.3s ease;
}

.status-tag.paid {
    background: var(--green-deep);
}

.status-tag.unpaid {
    background: var(--red-late);
}

.status-tag .status-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.status-tag.updated {
    animation: statusPulse 0.5s ease;
}

@keyframes statusPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Tombol Update Status */
.btn-update-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    background: var(--green-deep);
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    margin-left: 8px;
}

.btn-update-status:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.btn-update-status.mark-unpaid {
    background: var(--red-late);
}

/* ---------- NOTIFICATION ---------- */
.notification-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--green-deep);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.notification-toast button {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
}

.notification-toast button:hover {
    opacity: 0.8;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .stat-card:last-child {
        grid-column: span 2;
    }
    
    .history-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 900px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-radius: 0 0 28px 28px;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 16px;
        height: auto;
        position: relative;
        padding: 16px 20px;
    }

    .sidebar-brand {
        margin-bottom: 0;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .sidebar-admin {
        margin-top: 0;
        margin-left: auto;
    }

    .main-content {
        padding: 20px;
    }

    .filter-tabs {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        margin-left: 0;
    }

    .search-box input {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card:last-child {
        grid-column: span 1;
    }

    .stat-card {
        min-height: 80px;
        padding: 16px 20px;
    }

    .stat-card h3 {
        font-size: 14px;
    }

    .stat-card p {
        font-size: 28px;
    }
}

@media (max-width: 600px) {
    .page-title {
        font-size: 20px;
    }

    .section-title {
        font-size: 16px;
    }

    .history-table thead th {
        font-size: 12px;
    }

    .history-table tbody td {
        font-size: 12px;
        padding: 8px 4px;
    }

    .filter-tab {
        font-size: 12px;
        padding: 5px 16px;
        height: 28px;
    }

    .stat-card p {
        font-size: 24px;
    }
    
    .btn-update-status {
        font-size: 10px;
        padding: 3px 8px;
    }
}