@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ═══════════ KOPERASI PBU — Brand palette
   Diambil dari warna logo: oranye matahari, emas gandum, hijau daun,
   krem hangat untuk latar dan coklat tua untuk teks.
   ═══════════ */
:root {
    /* Background — warm cream/white */
    --bg-primary: #FBF6EE;       /* krem hangat */
    --bg-secondary: #FFFFFF;     /* surface kartu */
    --bg-card: #FFFFFF;
    --bg-card-hover: #FFF6E8;
    --bg-input: #FFFFFF;
    --bg-soft: #FFF1E0;          /* highlight oranye sangat tipis */

    /* Border */
    --border: #EAD6BC;
    --border-light: #F2E4CE;

    /* Brand — oranye dari logo */
    --accent: #E85D1F;           /* oranye utama */
    --accent-hover: #C94A10;
    --accent-soft: #FCE6D4;      /* untuk background hover/aktif */

    /* Aksen lain dari logo */
    --accent-gold: #F2A93A;      /* emas gandum */
    --accent-gold-bg: rgba(242, 169, 58, 0.18);
    --accent-green: #4F9D3A;     /* hijau orang/daun */
    --accent-green-bg: rgba(79, 157, 58, 0.15);
    --accent-red: #D64545;       /* merah peringatan */
    --accent-red-bg: rgba(214, 69, 69, 0.12);
    --accent-yellow: #F2A93A;
    --accent-yellow-bg: rgba(242, 169, 58, 0.18);
    --accent-brown: #8B5A2B;     /* coklat label pita */

    /* Teks — coklat tua hangat */
    --text-primary: #2C1810;
    --text-secondary: #4A3826;
    --text-muted: #8B7355;
    --text-on-accent: #FFFFFF;

    /* Sidebar — sedikit lebih gelap dari konten utama */
    --sidebar-bg: #FFFFFF;
    --sidebar-border: #F2E4CE;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 4px 14px rgba(139, 90, 43, 0.08);
    --shadow-lg: 0 12px 28px rgba(139, 90, 43, 0.15);
    --transition: all 0.2s ease;
    --sidebar-width: 270px;
}

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

html, body {
    max-width: 100%;
    overflow-x: hidden;   /* cegah halaman geser ke samping di HP */
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 17px;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; }

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }

/* ═══════════ LAYOUT ═══════════ */
.app-layout { display: flex; min-height: 100vh; max-width: 100%; }

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(44, 24, 16, 0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(139, 90, 43, 0.04);
}

.sidebar-brand {
    padding: 18px 18px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, #FFF6E8 0%, #FFFFFF 100%);
}

.sidebar-brand .brand-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; color: white;
    flex-shrink: 0;
    background: #FFFFFF;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(232, 93, 31, 0.18);
}

.sidebar-brand .brand-icon img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}

.sidebar-brand h1 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.2px;
    line-height: 1.2;
}
.sidebar-brand small {
    font-size: 11px;
    color: var(--accent);
    display: block;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 2px;
}

.sidebar-nav { padding: 12px 0 24px; }

.nav-section {
    padding: 14px 22px 6px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-brown);
    margin-top: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
    border-left: 3px solid transparent;
    min-height: 50px;
}

.nav-link:hover {
    background: var(--accent-soft);
    color: var(--accent);
}
.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 700;
}
.nav-link svg { width: 22px; height: 22px; flex-shrink: 0; }

/* Search bar di atas tabel */
.table-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 16px;
}
.table-search svg { color: var(--text-secondary); flex-shrink: 0; }
.table-search input[type="search"] {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-primary);
}
.table-search-clear {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.table-search-clear:hover { color: var(--accent); }

/* Filter bar (search + dropdown) di atas tabel */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.filter-bar .filter-field { display: flex; flex-direction: column; gap: 5px; }
.filter-bar .filter-field.grow { flex: 1 1 220px; min-width: 200px; }
.filter-bar label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.filter-bar .form-control { min-height: 42px; padding: 9px 12px; font-size: 14px; }
.filter-bar .filter-actions { display: flex; gap: 8px; align-items: center; }
.filter-bar .filter-reset {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.filter-bar .filter-reset:hover { color: var(--accent); }
@media (max-width: 768px) {
    .filter-bar .filter-field, .filter-bar .filter-actions { flex: 1 1 100%; }
    .filter-bar .filter-actions .btn { flex: 1; justify-content: center; }
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;          /* KUNCI: izinkan area utama menyusut agar tabel lebar tidak melebarkan halaman */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ═══════════ TOPBAR ═══════════ */
.topbar {
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-light);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 1px 3px rgba(139, 90, 43, 0.05);
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.topbar-right { display: flex; align-items: center; gap: 14px; }

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    min-width: 44px; min-height: 44px;
    align-items: center; justify-content: center;
}
.hamburger svg { width: 26px; height: 26px; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.topbar-user .avatar {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-gold) 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; color: white;
    box-shadow: 0 2px 6px rgba(232, 93, 31, 0.25);
}

.btn-logout {
    background: none;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    transition: var(--transition);
    min-height: 44px;
}
.btn-logout:hover { border-color: var(--accent-red); color: var(--accent-red); background: var(--accent-red-bg); }

/* ═══════════ CONTENT ═══════════ */
.content { padding: 24px; flex: 1; min-width: 0; width: 100%; max-width: 1400px; margin: 0 auto; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header h2 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--text-primary);
}

/* ═══════════ CARDS ═══════════ */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.card:hover { border-color: var(--border); box-shadow: var(--shadow-lg); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-gold));
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent-soft); }
.stat-card:hover::before { opacity: 1; }

.stat-card .stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}

.stat-card .stat-icon.blue { background: var(--accent-soft); color: var(--accent); }
.stat-card .stat-icon.orange { background: var(--accent-soft); color: var(--accent); }
.stat-card .stat-icon.green { background: var(--accent-green-bg); color: var(--accent-green); }
.stat-card .stat-icon.red { background: var(--accent-red-bg); color: var(--accent-red); }
.stat-card .stat-icon.yellow { background: var(--accent-gold-bg); color: var(--accent-gold); }
.stat-card .stat-icon.gold { background: var(--accent-gold-bg); color: var(--accent-gold); }
.stat-card .stat-icon.purple { background: var(--accent-gold-bg); color: var(--accent-brown); }
.stat-card .stat-icon svg { width: 24px; height: 24px; }

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 800;
    margin-top: 8px;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}
.stat-value.positive { color: var(--accent-green); }
.stat-value.negative { color: var(--accent-red); }

/* ═══════════ TABLES ═══════════ */
.table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow-x: auto;                  /* tabel lebar menggulir di DALAM kartu, bukan melebarkan halaman */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    box-shadow: var(--shadow);
    max-width: 100%;
}

/* Judul & pagination tetap menempel di kiri saat tabel digulir mendatar */
.table-container > .table-header,
.table-container > .pagination-wrapper {
    position: sticky;
    left: 0;
}

.table-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: linear-gradient(180deg, #FFFAF2 0%, #FFFFFF 100%);
}
.table-header h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); }

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

thead th {
    background: var(--bg-soft);
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent-brown);
    border-bottom: 1.5px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 16px 18px;
    font-size: 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

tbody tr:hover { background: #FFFAF2; }
tbody tr:last-child td { border-bottom: none; }

.table-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 15px; }

/* Tombol aksi di dalam sel tabel tetap sebaris (tabel akan menggulir bila sempit) */
tbody td .btn-group { flex-wrap: nowrap; }
tbody td .btn-group .btn { white-space: nowrap; }

/* Nama baris yang bisa diklik menuju halaman detail */
.row-link {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}
.row-link:hover { color: var(--accent-hover); text-decoration: underline; }
.row-link .row-sub,
.row-sub { display: block; font-weight: 500; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Seluruh baris tabel bisa diklik menuju halaman detail */
tr.clickable-row { cursor: pointer; }
tr.clickable-row:hover { background: var(--accent-soft); }
tr.clickable-row td:first-child { font-weight: 600; }

/* Mobile card layout for tables */
.mobile-cards { display: none; }

.mobile-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 15px;
}

.mobile-card-row .mc-label { color: var(--text-muted); font-size: 13px; font-weight: 600; }
.mobile-card-row .mc-value { font-weight: 600; color: var(--text-primary); text-align: right; }

.mobile-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

/* ═══════════ HEADER TABEL BISA DIURUTKAN ═══════════ */
.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    font: inherit;
}
.sort-link:hover { color: var(--accent); }

/* ═══════════ DROPDOWN EXPORT/IMPORT ═══════════ */
.io-menu { position: relative; display: inline-block; }
.io-menu > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.io-menu > summary::-webkit-details-marker { display: none; }
.io-menu > summary::marker { content: ''; }
.io-menu .io-caret { transition: transform 0.2s ease; }
.io-menu[open] > summary .io-caret { transform: rotate(180deg); }
.io-menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 200;
    min-width: 170px;
    padding: 6px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.io-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}
.io-menu-item:hover { background: var(--accent-soft); color: var(--accent-hover); }
.io-menu-item svg { flex-shrink: 0; color: var(--text-muted); }
.io-menu-item:hover svg { color: var(--accent-hover); }

/* ═══════════ BUTTONS ═══════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    min-height: 52px;
    white-space: nowrap;
}

.btn svg { width: 20px; height: 20px; }

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 3px 8px rgba(232, 93, 31, 0.25);
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(232, 93, 31, 0.35);
}

.btn-success {
    background: var(--accent-green);
    color: white;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(79, 157, 58, 0.25);
}
.btn-success:hover { background: #3F8A2D; color: white; transform: translateY(-1px); }

.btn-danger {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 3px 8px rgba(214, 69, 69, 0.25);
}
.btn-danger:hover { background: #B83838; color: white; transform: translateY(-1px); }

.btn-warning {
    background: var(--accent-gold);
    color: var(--text-primary);
    box-shadow: 0 3px 8px rgba(242, 169, 58, 0.25);
}
.btn-warning:hover { background: #DC9525; transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.btn-sm { padding: 10px 16px; font-size: 14px; min-height: 42px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ═══════════ FORMS ═══════════ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}

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

.form-group label {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.form-control {
    width: 100%;
    padding: 15px 18px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 17px;
    font-family: inherit;
    transition: var(--transition);
    min-height: 54px;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(232, 93, 31, 0.18);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-check { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.form-check input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.error-text { color: var(--accent-red); font-size: 14px; margin-top: 6px; }

/* Select2 (light) */
.select2-container--default .select2-selection--single {
    background: var(--bg-input) !important;
    border: 1.5px solid var(--border) !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--text-primary) !important; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(232, 93, 31, 0.18);
}
.select2-dropdown {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border) !important;
}
.select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--accent) !important;
    color: white !important;
}

/* ═══════════ ALERTS ═══════════ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
}

.alert-success { background: var(--accent-green-bg); color: #2F6B22; border: 1.5px solid rgba(79, 157, 58, 0.35); }
.alert-danger  { background: var(--accent-red-bg);   color: #9F2828; border: 1.5px solid rgba(214, 69, 69, 0.35); }
.alert-warning { background: var(--accent-gold-bg);  color: #8B5A11; border: 1.5px solid rgba(242, 169, 58, 0.45); }
.alert-info    { background: var(--accent-soft);     color: var(--accent-hover); border: 1.5px solid rgba(232, 93, 31, 0.30); }

@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════ BADGE ═══════════ */
.badge {
    display: inline-flex;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge-green  { background: var(--accent-green-bg); color: #2F6B22; }
.badge-red    { background: var(--accent-red-bg);   color: #9F2828; }
.badge-yellow { background: var(--accent-gold-bg);  color: #8B5A11; }
.badge-gold   { background: var(--accent-gold-bg);  color: #8B5A11; }
.badge-blue   { background: var(--accent-soft);     color: var(--accent-hover); }
.badge-orange { background: var(--accent-soft);     color: var(--accent-hover); }

/* ═══════════ PAGINATION ═══════════ */
.pagination-wrapper { padding: 16px 20px; display: flex; justify-content: center; }
.pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.pagination-summary {
    font-size: 13px;
    color: var(--text-secondary);
}
.pagination-summary strong { color: var(--text-primary); font-weight: 600; }
.pagination-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.pagination-list .page-item .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
    line-height: 1;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    user-select: none;
}
.pagination-list .page-item a.page-link:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}
.pagination-list .page-item.active .page-link {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
}
.pagination-list .page-item.disabled .page-link {
    color: var(--text-muted, #9ca3af);
    background: var(--bg-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}
.pagination-list .page-item .page-link[aria-label*="previous" i],
.pagination-list .page-item .page-link[aria-label*="next" i] {
    font-size: 20px;
    font-weight: 600;
    padding: 0 10px;
}

/* Defensive override for any stray Laravel default pagination markup */
.pagination-wrapper nav > div:first-child { display: none; }
.pagination-wrapper svg { width: 16px; height: 16px; }

/* ═══════════ REPORT ═══════════ */
.report-section { margin-bottom: 20px; }

.report-row {
    display: flex;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    font-size: 15px;
    gap: 12px;
}

.report-row:last-child { border-bottom: none; }
.report-row.total { font-weight: 800; background: var(--bg-soft); font-size: 16px; color: var(--text-primary); }
.report-row .label { color: var(--text-secondary); }
.report-row .value { font-weight: 700; white-space: nowrap; color: var(--text-primary); }
.report-row .value.positive { color: var(--accent-green); }
.report-row .value.negative { color: var(--accent-red); }

.report-header {
    padding: 14px 18px;
    background: var(--bg-soft);
    font-weight: 800;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent-brown);
    border-bottom: 1px solid var(--border-light);
}

/* ═══════════ CHART ═══════════ */
.chart-container { position: relative; height: 280px; }

/* ═══════════ LOGIN ═══════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(242, 169, 58, 0.25), transparent 60%),
        radial-gradient(1000px 500px at 110% 110%, rgba(232, 93, 31, 0.22), transparent 60%),
        linear-gradient(180deg, #FFF8EE 0%, #FBF0DE 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #FFFFFF;
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 36px 28px;
    box-shadow: 0 20px 50px rgba(139, 90, 43, 0.20);
}

.login-card .login-header { text-align: center; margin-bottom: 28px; }

.login-card .login-logo {
    width: 96px; height: 96px;
    border-radius: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
    background: #FFFFFF;
    border: 1px solid var(--border-light);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(232, 93, 31, 0.20);
}

.login-card .login-logo img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}

.login-card h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.login-card p { color: var(--text-muted); font-size: 15px; }

.login-card .btn-primary { width: 100%; padding: 14px; font-size: 16px; min-height: 52px; margin-top: 4px; }

/* ═══════════ GRID ═══════════ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

/* Detail anggota: form Tambah Iuran dipersempit, Riwayat Iuran diperlebar */
.detail-iuran-grid { grid-template-columns: minmax(280px, 340px) 1fr; align-items: start; }

/* Riwayat Iuran: kotak tetap, bisa digulir mendatar & vertikal */
.iuran-history { overflow: hidden; }
.iuran-history .iuran-history-scroll {
    max-height: 460px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
/* Kolom Catatan: lebih lebar, teks lebih kecil */
.iuran-history td.col-catatan,
.iuran-history th.col-catatan { min-width: 240px; }
.iuran-history td.col-catatan { font-size: 12px; line-height: 1.45; color: var(--text-secondary); }
/* Header kolom tetap terlihat saat digulir vertikal */
.iuran-history .iuran-history-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-soft);
}
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ═══════════ DETAIL ═══════════ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.detail-item .detail-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 6px;
}

.detail-item { min-width: 0; }
.detail-item .detail-value { font-size: 18px; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; word-break: break-word; }

/* ═══════════ MOBILE FIRST (ramah usia 35-40) ═══════════ */
@media (max-width: 768px) {
    body { font-size: 17px; }

    .sidebar {
        transform: translateX(-100%);
        width: 300px;
    }
    .sidebar.open { transform: translateX(0); }

    .nav-link { padding: 18px 22px; font-size: 17px; min-height: 56px; }
    .nav-link svg { width: 24px; height: 24px; }

    .hamburger { display: flex; min-width: 48px; min-height: 48px; }
    .hamburger svg { width: 28px; height: 28px; }

    .main-content { margin-left: 0; }

    .topbar { padding: 0 14px; height: 64px; }
    .topbar-title { font-size: 18px; font-weight: 700; }
    .topbar-user .avatar-name { display: none; }
    .btn-logout { padding: 10px 16px; font-size: 14px; min-height: 44px; }

    .content { padding: 18px 14px; }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .page-header h2 { font-size: 22px; }
    .page-header .btn { width: 100%; justify-content: center; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 18px 14px; }
    .stat-card .stat-value { font-size: 20px; }
    .stat-card .stat-label { font-size: 12px; }
    .stat-card .stat-icon { width: 42px; height: 42px; }
    .stat-card .stat-icon svg { width: 22px; height: 22px; }

    .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 16px; }

    /* Tables scroll horizontally with bigger touch */
    table { min-width: 560px; }
    thead th { padding: 12px 14px; font-size: 12px; }
    tbody td { padding: 14px 14px; font-size: 15px; }
    .table-header { padding: 14px 16px; }
    .table-header h3 { font-size: 15px; }
    /* Tombol aksi di dalam tabel jangan menumpuk vertikal kebablasan */
    .btn-group .btn-sm { flex: 0 1 auto; min-width: auto; }

    .chart-container { height: 240px; }

    .card { padding: 18px 16px; }

    .form-grid { grid-template-columns: 1fr; gap: 0; }
    .form-group { margin-bottom: 20px; }
    .form-group label { font-size: 15px; margin-bottom: 8px; }
    .form-control { font-size: 17px; padding: 16px 18px; min-height: 56px; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; }

    .btn { font-size: 16px; padding: 16px 24px; min-height: 56px; }
    .btn svg { width: 22px; height: 22px; }
    .btn-sm { font-size: 14px; padding: 10px 16px; min-height: 44px; }

    .btn-group { flex-wrap: wrap; gap: 8px; }
    .btn-group .btn { flex: 1; min-width: 100px; }

    .detail-grid { grid-template-columns: 1fr; gap: 14px; }
    .detail-item .detail-label { font-size: 12px; }
    .detail-item .detail-value { font-size: 17px; }

    .report-row { padding: 14px 14px; font-size: 15px; }
    .report-header { padding: 14px 14px; font-size: 14px; }

    .badge { font-size: 13px; padding: 6px 14px; }

    .alert { font-size: 15px; padding: 14px 16px; }

    .login-card { padding: 28px 22px; }
    .login-card .login-logo { width: 84px; height: 84px; }
    .login-card h2 { font-size: 22px; }
    .login-card p { font-size: 15px; }
}

/* Tablet portrait */
@media (min-width: 481px) and (max-width: 768px) {
    .detail-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile sangat kecil */
@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-header h2 { font-size: 20px; }
    .content { padding: 14px 10px; }
    table { min-width: 480px; }
    .btn { padding: 14px 18px; }
}

/* ═══════════ TABLET (769–1024) — sidebar lebih ramping, grid menyesuaikan ═══════════ */
@media (min-width: 769px) and (max-width: 1024px) {
    :root { --sidebar-width: 230px; }
    .nav-link { padding: 13px 18px; font-size: 14px; }
    .nav-section { padding-left: 18px; padding-right: 18px; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .content { padding: 20px; }
}

/* ═══════════ LAPTOP / DESKTOP (≥1025) — skala ~80% agar lebih padat ═══════════ */
@media (min-width: 1025px) {
    :root { --sidebar-width: 224px; --radius: 12px; --radius-sm: 8px; }

    body { font-size: 14px; }

    .form-grid { grid-template-columns: repeat(2, 1fr); }

    /* Sidebar / brand */
    .sidebar-brand { padding: 14px 16px; gap: 10px; }
    .sidebar-brand .brand-icon { width: 40px; height: 40px; border-radius: 10px; }
    .sidebar-brand h1 { font-size: 14px; }
    .sidebar-brand small { font-size: 10px; }
    .nav-section { font-size: 10px; padding: 12px 18px 5px; }
    .nav-link { padding: 10px 18px; font-size: 13px; min-height: 40px; gap: 11px; }
    .nav-link svg { width: 18px; height: 18px; }

    /* Topbar */
    .topbar { height: 54px; padding: 0 20px; }
    .topbar-title { font-size: 15px; }
    .topbar-user { font-size: 13px; gap: 8px; }
    .topbar-user .avatar { width: 32px; height: 32px; font-size: 13px; }
    .btn-logout { padding: 7px 13px; font-size: 13px; min-height: 36px; }

    /* Content */
    .content { padding: 20px; }
    .page-header { margin-bottom: 20px; }
    .page-header h2 { font-size: 21px; }

    /* Cards & stats */
    .card { padding: 18px; }
    .stats-grid { gap: 12px; margin-bottom: 20px; }
    .stat-card { padding: 16px; }
    .stat-card .stat-icon { width: 38px; height: 38px; border-radius: 10px; margin-bottom: 11px; }
    .stat-card .stat-icon svg { width: 20px; height: 20px; }
    .stat-card .stat-label { font-size: 11px; }
    .stat-card .stat-value { font-size: 21px; margin-top: 6px; }

    /* Tables */
    .table-header { padding: 14px 16px; }
    .table-header h3 { font-size: 14px; }
    thead th { padding: 11px 14px; font-size: 11px; }
    tbody td { padding: 11px 14px; font-size: 13.5px; }

    /* Buttons */
    .btn { padding: 10px 18px; font-size: 13.5px; min-height: 40px; gap: 7px; }
    .btn svg { width: 17px; height: 17px; }
    .btn-sm { padding: 7px 13px; font-size: 12.5px; min-height: 34px; }
    .btn-group { gap: 6px; }

    /* Forms */
    .form-group { margin-bottom: 15px; }
    .form-group label { font-size: 13px; margin-bottom: 7px; }
    .form-control { padding: 11px 14px; font-size: 14px; min-height: 44px; }
    .form-actions { margin-top: 20px; padding-top: 16px; }

    /* Badges & alerts */
    .badge { font-size: 11.5px; padding: 4px 11px; }
    .alert { font-size: 13.5px; padding: 12px 15px; }

    /* Detail & report */
    .detail-item .detail-value { font-size: 15px; }
    .report-row, .report-header { font-size: 13.5px; padding: 12px 15px; }
}

/* Layar sangat lebar — batasi lebar konten agar tetap nyaman dibaca */
@media (min-width: 1600px) {
    .content { max-width: 1500px; }
}
