/*
  PALET WARNA TEMA KAYU
  ======================
  Background Utama   : #f4f1ea (Krem muda seperti kertas tua)
  Sidebar/Panel Gelap: #3D2B1F (Coklat Tua - Bistre)
  Card/Widget        : #FFFFFF (Putih, untuk kontras)
  Aksen & Hover      : #A0522D (Coklat Sedang - Sienna)
  Teks Utama         : #3D2B1F (Coklat Tua)
  Teks di Sidebar    : #F5DEB3 (Krem - Wheat)
  Aksen Aktif        : #D2691E (Coklat Terang - Chocolate)
*/

body {
    font-family: 'Poppins', sans-serif;
    /* Alternatif: Menggunakan gradient halus */
    background-color: #f4f1ea; /* Fallback */
    background-image: linear-gradient(135deg, #f8f5f0 0%, #e9e4d9 100%);
    color: #3D2B1F;
    line-height: 1.6;
}

/* Default theme class for Wood theme */
body.theme-wood {
    /* Wood theme is the default, so no override needed */
}

/* Splash Screen Wood Theme Pattern - Puzzle Style */
/* Menggunakan warna referensi dari login-visual: #3D2B1F → #2E2016 */
body.theme-wood .splash-screen {
    background-color: #2E2016 !important; /* Warna referensi dari login-visual (lebih gelap) */
    background-image: 
        /* Puzzle pattern - horizontal puzzle pieces - solid colors */
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 35px,
            #2E2016 35px,
            #281C14 38px,
            #2E2016 42px,
            transparent 42px,
            transparent 77px
        ),
        /* Puzzle pattern - vertical puzzle pieces - solid colors */
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 35px,
            #281C14 35px,
            #221810 38px,
            #281C14 42px,
            transparent 42px,
            transparent 77px
        ),
        /* Puzzle interlocking pattern - diagonal - solid colors */
        repeating-linear-gradient(
            45deg,
            transparent 0px,
            transparent 50px,
            #2E2016 50px,
            #281C14 53px,
            #2E2016 56px,
            transparent 56px,
            transparent 106px
        ),
        /* Puzzle interlocking pattern - diagonal reverse - solid colors */
        repeating-linear-gradient(
            -45deg,
            transparent 0px,
            transparent 50px,
            #281C14 50px,
            #221810 53px,
            #281C14 56px,
            transparent 56px,
            transparent 106px
        ),
        /* Base wood color gradient - menggunakan warna referensi login-visual dengan variasi lebih gelap */
        linear-gradient(135deg, #2E2016 0%, #281C14 20%, #221810 40%, #1E140C 50%, #221810 60%, #281C14 80%, #2E2016 100%) !important;
    background-size: 
        100% 100%, 
        100% 100%, 
        200% 200%, 
        200% 200%,
        100% 100% !important;
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0 !important;
}

/* Add puzzle overlay pattern with semi-transparent gradient */
body.theme-wood .splash-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        /* Puzzle piece shapes - circular gradients menggunakan solid colors */
        radial-gradient(circle at 20% 30%, #2E2016 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, #2E2016 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, #281C14 0%, transparent 50%),
        radial-gradient(circle at 15% 80%, #221810 0%, transparent 45%),
        radial-gradient(circle at 85% 20%, #221810 0%, transparent 45%),
        /* Additional puzzle pieces menggunakan solid colors */
        radial-gradient(ellipse 100px 60px at 30% 60%, #281C14 0%, transparent 60%),
        radial-gradient(ellipse 100px 60px at 70% 40%, #281C14 0%, transparent 60%),
        radial-gradient(ellipse 70px 100px at 15% 80%, #2E2016 0%, transparent 55%),
        radial-gradient(ellipse 70px 100px at 85% 20%, #2E2016 0%, transparent 55%),
        /* Gradient overlay dengan solid colors menggunakan warna referensi */
        linear-gradient(
            135deg,
            #2E2016 0%,
            transparent 20%,
            transparent 80%,
            #2E2016 100%
        ),
        linear-gradient(
            45deg,
            #281C14 0%,
            transparent 25%,
            transparent 75%,
            #281C14 100%
        );
    pointer-events: none;
    z-index: 0;
}

a {
    text-decoration: none;
    transition: all 0.3s;
}

a:hover {
    text-decoration: none;
}

.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* ===================================================
    SIDEBAR STYLE
====================================================== */
#sidebar {
    min-width: 300px;
    max-width: 300px;
    background: #3D2B1F; /* Coklat Tua */
    color: #F5DEB3; /* Teks Krem */
    transition: all 0.3s;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;

    /* 1. Jadikan sidebar sebagai flex container vertikal */
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-header {
    padding: 20px;
    background: #2a1d15; /* Lebih gelap untuk header */
    text-align: center;
    /* Mencegah header menyusut */
    flex-shrink: 0;
}

.sidebar-header h3 {
    color: #fff;
    font-weight: 600;
    margin-bottom: 0;
}

#sidebar ul.components {
    padding: 20px 0;
    /* 2. Buat area daftar menu bisa di-scroll */
    flex-grow: 1; /* Biarkan elemen ini tumbuh mengisi ruang */
    overflow-y: auto; /* Tambahkan scrollbar vertikal HANYA jika konten meluap */
    padding-bottom: 20px; /* Beri sedikit ruang di bawah */
    /* Jadikan <ul> sebagai flex container agar mt-auto pada <li> logout berfungsi */
    display: flex;
    flex-direction: column;
}

#sidebar ul li a {
    padding: 12px 25px;
    font-size: 1em;
    display: block;
    color: #F5DEB3;
    border-left: 3px solid transparent;
}

#sidebar ul li a:hover {
    color: #fff;
    background: #A0522D; /* Aksen Hover */
    border-left: 3px solid #D2691E;
}

#sidebar ul li.active > a,
a[aria-expanded="true"] {
    color: #fff;
    background: #D2691E; /* Aksen Aktif */
    border-left: 3px solid #F5DEB3;
}

a[data-toggle="collapse"] {
    position: relative;
}

.dropdown-toggle::after {
    display: block;
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

ul ul a {
    font-size: 0.9em !important;
    padding-left: 40px !important;
    background: #332419;
}

ul ul a:hover {
    background: #A0522D !important;
}

/* Styling untuk submenu level 3 (grandchild) */
ul ul ul a {
    font-size: 0.85em !important;
    padding-left: 60px !important;
    background: #2a1d15;
}

ul ul ul a:hover {
    background: #A0522D !important;
}

#sidebar ul li a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* 3. Styling untuk scrollbar (Opsional, tapi membuat tampilan lebih bagus) */
#sidebar ul.components::-webkit-scrollbar {
    width: 8px;
}

#sidebar ul.components::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

#sidebar ul.components::-webkit-scrollbar-thumb {
    background: #A0522D; /* Warna sienna, sesuaikan dengan tema Anda */
    border-radius: 4px;
}


/* ===================================================
    CONTENT STYLE
====================================================== */
/* Main content sits to the right of the fixed sidebar. Use margin+width so the
   fixed-position sidebar does not visually overlap content when the window is
   resized or when the sidebar is toggled. */
#content {
    margin-left: 300px; /* reserve space for the fixed sidebar */
    width: calc(100% - 300px);
    min-height: 100vh;
    transition: margin-left 0.3s ease, width 0.3s ease;
    display: flex;
    flex-direction: column;
}

.content-body {
    flex: 1 0 auto; /* Membuat area konten ini tumbuh mengisi ruang kosong */
    padding: 1.5rem;
}

/* Style untuk sidebar saat ditutup (memiliki class 'active') */
/* When sidebar is hidden, slide it out and expand the content area */
#sidebar.active {
    margin-left: -300px;
}

/* Style untuk konten saat sidebar ditutup */
#content.active {
    margin-left: 0;
    width: 100%;
}


.navbar {
    padding: 15px 20px;
    background: #fff;
    border: none;
    border-radius: 0;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===================================================
    CARD/WIDGET STYLE
====================================================== */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    background-color: #FFFFFF;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 1.1rem;
    color: #3D2B1F;
}

.main-footer {
    padding: 1rem;
    text-align: center;
    background-color: #fff;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
    flex-shrink: 0; /* Mencegah footer 'tertelan' oleh konten */
}

/* ===================================================
    TABLE STYLE (Zebra-striping)
====================================================== */
.table-hover tbody tr:nth-of-type(even) {
    background-color: #f8f5f0; /* Warna krem yang sangat lembut, turunan dari background utama */
}

/* Efek hover untuk kartu statistik di dashboard */
.card-hover {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* ===================================================
    CUSTOM TAB STYLE
====================================================== */
.nav-tabs {
    border-bottom: 2px solid #A0522D; /* Aksen Sienna */
}

.nav-tabs .nav-item {
    margin-bottom: -2px; /* Tarik tab ke bawah untuk menutupi border */
}

.nav-tabs .nav-link {
    border: 1px solid transparent;
    border-top-left-radius: .5rem;
    border-top-right-radius: .5rem;
    color: #A0522D; /* Warna teks normal */
    background-color: #f8f5f0; /* Warna krem lembut */
    padding: 0.75rem 1.25rem;
    transition: all 0.2s ease-in-out;
}

.nav-tabs .nav-link:hover {
    border-color: #e9ecef #e9ecef #dee2e6;
    background-color: #fff;
    color: #3D2B1F;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: #fff;
    background-color: #A0522D; /* Aksen Sienna */
    border-color: #A0522D #A0522D #A0522D;
    font-weight: 600;
}

.nav-tabs .nav-link i {
    margin-right: 8px;
}

.tab-content {
    border: 1px solid #dee2e6;
    border-top: none;
    border-bottom-left-radius: .5rem;
    border-bottom-right-radius: .5rem;
    background-color: #fff;
}

/* ===================================================
    POS (POINT OF SALE) STYLE
====================================================== */
.pos-total-display {
    background-color: #f4f1ea; /* Warna background utama */
    border: 2px dashed #A0522D;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.pos-total-display .total-label {
    font-size: 1.2rem;
    font-weight: 500;
    color: #3D2B1F;
    margin-bottom: 0.5rem;
}

.pos-total-display .total-amount {
    font-size: 2.8rem;
    font-weight: 700;
    color: #D2691E; /* Warna coklat terang */
    line-height: 1;
}

.pos-payment-actions {
    display: flex;
    gap: 10px; /* Menambahkan jarak antar tombol */
    width: 100%;
    margin-top: 1.5rem;
}

.btn-pos {
    flex: 1 1 0; /* Membuat tombol fleksibel (grow, shrink, basis) */
    border: none;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-pos:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(210, 105, 30, 0.4);
}

.btn-pos-cancel {
    background-color: #e74c3c;
    color: white;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}
.btn-pos-cancel:hover {
    background-color: #c0392b;
    color: white;
}

.btn-pos-confirm {
    background-color: #2ecc71;
    color: white;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}
.btn-pos-confirm:hover {
    background-color: #27ae60;
    color: white;
}
.btn-pos-confirm:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* ===================================================
    DASHBOARD STATS CARDS (MODERN)
====================================================== */
.card-stats {
    border: none;
    border-radius: 12px;
    color: white;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-stats:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.card-stats .card-body {
    position: relative;
    z-index: 2;
}

.card-stats .stat-icon {
    position: absolute;
    top: 50%;
    right: -20px;
    transform: translateY(-50%);
    font-size: 5rem;
    opacity: 0.15;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-stats:hover .stat-icon {
    right: 15px;
    opacity: 0.3;
    transform: translateY(-50%) scale(1.1) rotate(-10deg);
}

.card-stats .stat-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* ==========================
   Custom-file improvements
   - hide browser "No file chosen" fallback text and rely on .custom-file-label
   - ensure the santri preview/placeholder have explicit rules so global CSS won't show both
   ========================== */
/* Hide the default file input text for modern browsers (works by hiding the native file input's ::-webkit-file-upload-button and related parts) */
input[type="file"].custom-file-input::-webkit-file-upload-button {
    visibility: hidden;
}
/* For some browsers the pseudo-element shows; this ensures default text area hidden */
input[type="file"].custom-file-input::file-selector-button {
    visibility: hidden;
}

/* Ensure our custom label is visible */
.custom-file-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Strong rules for santri preview/placeholder to avoid duplication */
.santri-foto-preview { display: none !important; width: 150px; height: 150px; object-fit: cover; }
.santri-icon-placeholder { display: flex !important; width: 150px; height: 150px; align-items: center; justify-content: center; }

/* When preview has src attribute set, JS will set display:block but enforce via CSS as well using a helper class if needed */
.has-santri-photo .santri-foto-preview { display: block !important; }
.has-santri-photo .santri-icon-placeholder { display: none !important; }

.card-stats .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.card-stats .stat-subvalue {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Varian Warna */
.card-stats--primary { background: linear-gradient(45deg, #2980b9, #3498db); }
.card-stats--dark { background: linear-gradient(45deg, #2c3e50, #34495e); }
.card-stats--success { background: linear-gradient(45deg, #27ae60, #2ecc71); }
.card-stats--info { background: linear-gradient(45deg, #16a085, #1abc9c); }
.card-stats--warning { background: linear-gradient(45deg, #f39c12, #f1c40f); }
.card-stats--danger { background: linear-gradient(45deg, #c0392b, #e74c3c); }

/* Override untuk teks gelap pada background terang */
.card-stats--warning .stat-title,
.card-stats--warning .stat-value,
.card-stats--warning .stat-subvalue {
    color: #42310b;
}
.card-stats--warning .stat-icon {
    color: #42310b;
    opacity: 0.1;
}
.card-stats--warning:hover .stat-icon {
    opacity: 0.2;
}

/* ===================================================
    DASHBOARD KOPERASI PESANTREN
====================================================== */
.dashboard-koperasi {
    --coop-ink: #163426;
    --coop-forest: #124f2f;
    --coop-green: #1f7a45;
    --coop-gold: #b8872f;
    --coop-gold-soft: #fff7df;
    --coop-surface: #ffffff;
    --coop-muted: #6f7b76;
    --coop-line: #dfe7e2;
    --coop-bg: #f3f7f2;
}

body.theme-wood,
body.theme-islami {
    background-color: #f3f7f2 !important;
    background-image: linear-gradient(180deg, #f7faf6 0%, #edf4ee 100%) !important;
}

.dashboard-koperasi .dashboard-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #0f3d26 0%, #145c36 100%);
    color: #fff;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 22px rgba(15, 61, 38, 0.16);
}

.dashboard-koperasi .dashboard-eyebrow {
    color: #e4c06f;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.dashboard-koperasi h1,
.dashboard-koperasi h2 {
    margin: 0;
    letter-spacing: 0;
}

.dashboard-koperasi h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
}

.dashboard-koperasi .dashboard-topbar p {
    max-width: 760px;
    margin: 4px 0 0;
    color: rgba(255,255,255,0.78);
    font-size: 0.86rem;
}

.dashboard-koperasi .dashboard-userbox {
    min-width: 170px;
    padding: 9px 12px;
    border-radius: 6px;
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.12);
    text-align: right;
}

.dashboard-koperasi .dashboard-userbox span,
.dashboard-koperasi .dashboard-userbox small {
    display: block;
}

.dashboard-koperasi .dashboard-userbox span {
    font-weight: 700;
    line-height: 1.2;
}

.dashboard-koperasi .dashboard-userbox small {
    color: rgba(255,255,255,0.72);
    margin-top: 2px;
}

.dashboard-koperasi .kpi-card,
.dashboard-koperasi .ops-panel,
.dashboard-koperasi .ops-item {
    border: 1px solid var(--coop-line);
    border-radius: 8px;
    background: var(--coop-surface);
    box-shadow: 0 4px 14px rgba(22, 52, 38, 0.06);
}

.dashboard-koperasi .kpi-card {
    position: relative;
    display: block;
    min-height: 116px;
    padding: 14px 14px 12px;
    color: var(--coop-ink);
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.dashboard-koperasi .kpi-card:hover,
.dashboard-koperasi .ops-item:hover,
.dashboard-koperasi .pending-item:hover,
.dashboard-koperasi .quick-actions a:hover {
    color: var(--coop-ink);
    border-color: rgba(31, 122, 69, 0.45);
    box-shadow: 0 8px 20px rgba(22, 52, 38, 0.10);
    transform: translateY(-1px);
}

.dashboard-koperasi .kpi-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    border-radius: 6px;
    background: #e7f2ea;
    color: var(--coop-green);
}

.dashboard-koperasi .kpi-label,
.dashboard-koperasi .ops-title {
    display: block;
    color: var(--coop-muted);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dashboard-koperasi .kpi-card strong {
    display: block;
    margin-top: 2px;
    font-size: 1.3rem;
    line-height: 1.25;
    font-weight: 800;
}

.dashboard-koperasi .kpi-card small,
.dashboard-koperasi .ops-item small,
.dashboard-koperasi .ops-panel-header p {
    color: var(--coop-muted);
    font-size: 0.78rem;
}

.dashboard-koperasi .ops-panel {
    padding: 14px;
}

.dashboard-koperasi .ops-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--coop-line);
}

.dashboard-koperasi .ops-panel-header.compact {
    margin-bottom: 8px;
}

.dashboard-koperasi .ops-panel-header h2 {
    color: var(--coop-ink);
    font-size: 0.98rem;
    font-weight: 800;
}

.dashboard-koperasi .ops-panel-header p {
    margin: 3px 0 0;
}

.dashboard-koperasi .ops-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.dashboard-koperasi .ops-item {
    display: block;
    padding: 12px;
    color: var(--coop-ink);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.dashboard-koperasi .ops-item strong {
    display: block;
    margin: 4px 0 2px;
    font-size: 1.25rem;
    color: var(--coop-forest);
}

.dashboard-koperasi .ops-item.is-warning {
    background: #fff8ea;
    border-color: #ecd39f;
}

.dashboard-koperasi .ops-item.is-warning strong {
    color: #9a5c00;
}

.dashboard-koperasi .ops-item.is-good {
    background: #f4fbf5;
}

.dashboard-koperasi .dashboard-table thead th {
    color: var(--coop-muted);
    background: #f5f8f5;
    border-top: 0;
    border-bottom: 1px solid var(--coop-line);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.dashboard-koperasi .dashboard-table td {
    border-color: #eef3ef;
    color: var(--coop-ink);
    vertical-align: middle;
}

.dashboard-koperasi .pending-total {
    min-width: 38px;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--coop-gold-soft);
    color: #81530a;
    font-weight: 800;
    text-align: center;
}

.dashboard-koperasi .pending-list {
    display: grid;
    gap: 8px;
}

.dashboard-koperasi .pending-item,
.dashboard-koperasi .quick-actions a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 11px;
    border: 1px solid var(--coop-line);
    border-radius: 7px;
    color: var(--coop-ink);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.dashboard-koperasi .pending-item i,
.dashboard-koperasi .quick-actions i {
    width: 20px;
    color: var(--coop-green);
}

.dashboard-koperasi .pending-item strong {
    min-width: 32px;
    padding: 3px 7px;
    border-radius: 999px;
    background: #e7f2ea;
    color: var(--coop-forest);
    text-align: center;
}

.dashboard-koperasi .pending-panel.has-urgent-data {
    border-color: #d9a927;
    animation: dashboardUrgentGlow 1.6s ease-in-out infinite;
}

.dashboard-koperasi .pending-item.is-urgent {
    border-color: #d9a927;
    background: #fff6d8;
    animation: dashboardUrgentBlink 1.25s ease-in-out infinite;
}

.dashboard-koperasi .pending-item.is-urgent i {
    color: #9a5c00;
}

.dashboard-koperasi .pending-item.is-urgent strong {
    background: #b45309;
    color: #fff;
}

.dashboard-koperasi .pending-order-list {
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px dashed #e5c56b;
    border-radius: 7px;
    background: #fffbeb;
}

.dashboard-koperasi .pending-order-mini {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 6px;
    color: var(--coop-ink);
    background: #fff;
    border: 1px solid #f1df9c;
}

.dashboard-koperasi .pending-order-mini:hover {
    color: var(--coop-ink);
    text-decoration: none;
    border-color: #d9a927;
}

.dashboard-koperasi .pending-order-mini span,
.dashboard-koperasi .pending-order-mini small,
.dashboard-koperasi .pending-order-mini strong {
    display: block;
}

.dashboard-koperasi .pending-order-mini strong {
    font-size: 0.78rem;
    color: var(--coop-forest);
}

.dashboard-koperasi .pending-order-mini small {
    color: var(--coop-muted);
    font-size: 0.72rem;
}

.dashboard-koperasi .pending-order-mini em {
    color: #81530a;
    font-style: normal;
    font-weight: 800;
    font-size: 0.78rem;
    white-space: nowrap;
}

@keyframes dashboardUrgentBlink {
    0%, 100% {
        background: #fff6d8;
        box-shadow: 0 0 0 rgba(217, 169, 39, 0);
    }
    50% {
        background: #ffe8a3;
        box-shadow: 0 0 0 4px rgba(217, 169, 39, 0.16);
    }
}

@keyframes dashboardUrgentGlow {
    0%, 100% {
        box-shadow: 0 4px 14px rgba(22, 52, 38, 0.06);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(217, 169, 39, 0.13), 0 8px 22px rgba(154, 92, 0, 0.10);
    }
}

.dashboard-koperasi .sync-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    color: var(--coop-muted);
    font-size: 0.76rem;
}

.dashboard-koperasi .quick-actions {
    display: grid;
    gap: 8px;
}

.pulse-badge {
    animation: pulseBadge 0.5s ease-in-out 2;
}

@keyframes pulseBadge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

@media (max-width: 1199.98px) {
    .dashboard-koperasi .ops-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .dashboard-koperasi .dashboard-topbar {
        display: block;
    }

    .dashboard-koperasi .dashboard-userbox {
        margin-top: 12px;
        text-align: left;
    }

    .dashboard-koperasi .ops-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================================
    GLOBAL DASHBOARD THEME
    Menyatukan halaman lain dengan gaya dashboard operasional.
====================================================== */
body.theme-wood,
body.theme-islami {
    --app-ink: #163426;
    --app-forest: #124f2f;
    --app-green: #1f7a45;
    --app-green-dark: #0f3d26;
    --app-green-soft: #e7f2ea;
    --app-gold: #b8872f;
    --app-gold-soft: #fff7df;
    --app-surface: #ffffff;
    --app-muted: #6f7b76;
    --app-line: #dfe7e2;
    --app-bg: #f3f7f2;
    --app-danger: #b94a48;
    --app-warning: #b8872f;
    color: var(--app-ink);
    font-size: 0.92rem;
}

body.theme-wood #sidebar,
body.theme-islami #sidebar {
    background: #123d2a;
    color: #edf7ef;
    box-shadow: 3px 0 12px rgba(18, 61, 42, 0.18);
}

body.theme-wood .sidebar-header,
body.theme-islami .sidebar-header {
    padding: 16px 18px;
    background: #0b2d1e;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

body.theme-wood .sidebar-header h3,
body.theme-islami .sidebar-header h3 {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

body.theme-wood #sidebar ul.components,
body.theme-islami #sidebar ul.components {
    padding: 12px 0 16px;
}

body.theme-wood #sidebar ul li a,
body.theme-islami #sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 9px 18px;
    color: #edf7ef;
    font-size: 0.88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

body.theme-wood #sidebar ul li a i,
body.theme-islami #sidebar ul li a i {
    width: 20px;
    margin-right: 0;
    color: #d1a84f;
    text-align: center;
    opacity: 0.95;
}

body.theme-wood #sidebar ul li a:hover,
body.theme-islami #sidebar ul li a:hover,
body.theme-wood #sidebar ul li.active > a,
body.theme-islami #sidebar ul li.active > a,
body.theme-wood #sidebar a[aria-expanded="true"],
body.theme-islami #sidebar a[aria-expanded="true"] {
    color: #ffffff;
    background: #1f7044;
    border-left-color: #d1a84f;
}

body.theme-wood #sidebar ul ul a,
body.theme-islami #sidebar ul ul a {
    padding-left: 42px;
    background: #103522;
    color: #dcefe3;
    font-size: 0.84rem;
}

body.theme-wood #sidebar ul ul ul a,
body.theme-islami #sidebar ul ul ul a {
    background: #0c2a1c;
}

body.theme-wood #sidebar ul.components::-webkit-scrollbar-thumb,
body.theme-islami #sidebar ul.components::-webkit-scrollbar-thumb {
    background: rgba(209, 168, 79, 0.55);
}

body.theme-wood .navbar,
body.theme-islami .navbar {
    min-height: 56px;
    margin-bottom: 12px;
    padding: 9px 16px;
    background: #ffffff !important;
    border-bottom: 1px solid var(--app-line);
    box-shadow: 0 2px 10px rgba(22, 52, 38, 0.06);
}

#sidebarCollapse {
    padding: 0.42rem 0.72rem;
    border-radius: 6px;
    background-color: var(--app-green) !important;
    border-color: var(--app-green) !important;
    color: #ffffff !important;
    font-size: 0.86rem;
    font-weight: 700;
}

#sidebarCollapse:hover,
#sidebarCollapse:focus {
    background-color: var(--app-forest) !important;
    border-color: var(--app-forest) !important;
}

.content-body {
    padding: 1rem 1.1rem 80px;
}

.content-body h1,
.content-body h2,
.content-body h3,
.content-body h4,
.content-body h5,
.content-body h6 {
    color: var(--app-ink);
    letter-spacing: 0;
}

.content-body h1,
.content-body h2,
.content-body .h1,
.content-body .h2 {
    margin-bottom: 0.85rem;
    font-weight: 800;
}

.content-body h1,
.content-body .h1 {
    font-size: 1.34rem;
}

.content-body h2,
.content-body .h2 {
    font-size: 1.18rem;
}

.content-body h3,
.content-body .h3 {
    font-size: 1.04rem;
    font-weight: 750;
}

.card {
    border: 1px solid var(--app-line);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(22, 52, 38, 0.06);
    background: var(--app-surface);
}

.card-header {
    min-height: 44px;
    padding: 0.72rem 0.9rem;
    background: #ffffff;
    border-bottom: 1px solid var(--app-line);
    color: var(--app-ink);
    font-size: 0.94rem;
    font-weight: 800;
}

.card-header:first-child {
    border-radius: 8px 8px 0 0;
}

.card-body {
    padding: 0.92rem;
}

.card-footer {
    padding: 0.72rem 0.9rem;
    background: #f8faf7;
    border-top: 1px solid var(--app-line);
}

.card-hover:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(22, 52, 38, 0.10);
}

.table {
    color: var(--app-ink);
    font-size: 0.84rem;
}

.table th,
.table td {
    padding: 0.48rem 0.58rem;
    vertical-align: middle;
    border-top-color: #eef3ef;
}

.table thead th {
    color: var(--app-muted);
    background: #f5f8f5;
    border-top: 0;
    border-bottom: 1px solid var(--app-line);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
}

.table-hover tbody tr:nth-of-type(even) {
    background-color: #f8faf7;
}

.table-hover tbody tr:hover {
    background-color: #eef7f0;
}

.btn {
    border-radius: 6px;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0;
    box-shadow: none !important;
}

.btn-sm {
    padding: 0.28rem 0.5rem;
    font-size: 0.78rem;
}

.btn i {
    margin-right: 5px;
}

.btn .fa-fw,
.btn i:only-child {
    margin-right: 0;
}

.btn-primary,
.btn-success {
    background-color: var(--app-green);
    border-color: var(--app-green);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-success:hover,
.btn-success:focus {
    background-color: var(--app-forest);
    border-color: var(--app-forest);
    color: #fff;
}

.btn-info {
    background-color: #2f7d78;
    border-color: #2f7d78;
    color: #fff;
}

.btn-warning {
    background-color: var(--app-gold);
    border-color: var(--app-gold);
    color: #fff;
}

.btn-danger {
    background-color: var(--app-danger);
    border-color: var(--app-danger);
    color: #fff;
}

.btn-secondary,
.btn-outline-secondary {
    background-color: #eef4ef;
    border-color: #d5e2d9;
    color: var(--app-ink);
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
    background-color: #dfece3;
    border-color: #c8d8ce;
    color: var(--app-ink);
}

.btn-outline-primary,
.btn-outline-success {
    border-color: rgba(31, 122, 69, 0.42);
    color: var(--app-green);
}

.btn-outline-primary:hover,
.btn-outline-success:hover {
    background-color: var(--app-green);
    border-color: var(--app-green);
    color: #fff;
}

.form-control,
.custom-select,
.input-group-text {
    min-height: 36px;
    border-color: var(--app-line);
    border-radius: 6px;
    color: var(--app-ink);
    font-size: 0.86rem;
}

.form-control:focus,
.custom-select:focus {
    border-color: rgba(31, 122, 69, 0.55);
    box-shadow: 0 0 0 0.16rem rgba(31, 122, 69, 0.12);
}

label,
.col-form-label {
    color: var(--app-ink);
    font-size: 0.83rem;
    font-weight: 700;
}

.form-group {
    margin-bottom: 0.78rem;
}

.input-group-text {
    background-color: #f5f8f5;
    color: var(--app-muted);
    font-weight: 700;
}

.nav-tabs {
    gap: 5px;
    border-bottom: 1px solid var(--app-line);
}

.nav-tabs .nav-item {
    margin-bottom: -1px;
}

.nav-tabs .nav-link {
    padding: 0.55rem 0.82rem;
    border: 1px solid var(--app-line);
    border-bottom-color: transparent;
    border-radius: 7px 7px 0 0;
    background: #f8faf7;
    color: var(--app-muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.nav-tabs .nav-link:hover {
    background: #ffffff;
    color: var(--app-green);
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    background: #ffffff;
    border-color: var(--app-line) var(--app-line) #ffffff;
    color: var(--app-forest);
    box-shadow: inset 0 3px 0 var(--app-gold);
}

.tab-content {
    border-color: var(--app-line);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 14px rgba(22, 52, 38, 0.04);
}

.badge {
    border-radius: 999px;
    padding: 0.34em 0.58em;
    font-weight: 800;
}

.badge-primary,
.badge-success {
    background-color: var(--app-green);
}

.badge-warning {
    background-color: var(--app-gold-soft);
    color: #81530a;
}

.badge-info {
    background-color: #e3f3f1;
    color: #1d6863;
}

.alert {
    padding: 0.65rem 0.82rem;
    border-radius: 8px;
    border-width: 1px;
    font-size: 0.86rem;
}

.alert-success {
    background-color: #edf8ef;
    border-color: #cfe8d5;
    color: #155f36;
}

.alert-info {
    background-color: #eef8f7;
    border-color: #cfe9e6;
    color: #1d6863;
}

.alert-warning {
    background-color: var(--app-gold-soft);
    border-color: #ecd39f;
    color: #81530a;
}

.alert-danger {
    background-color: #fff0f0;
    border-color: #eccaca;
    color: #8a3331;
}

.dataTables_wrapper {
    color: var(--app-ink);
    font-size: 0.84rem;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--app-line);
    border-radius: 6px;
}

.page-item .page-link {
    min-width: 34px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 2px;
    padding: 0.32rem 0.58rem;
    border-radius: 6px;
    color: var(--app-green);
    border-color: var(--app-line);
    font-size: 0.82rem;
    font-weight: 700;
}

.pagination {
    gap: 3px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.pagination-minimal {
    justify-content: center;
}

.pagination-minimal .page-link {
    min-width: 32px;
    min-height: 32px;
}

.pagination-minimal .page-item.disabled .page-link {
    color: var(--app-muted);
    background: #f8faf7;
}

.dataTables_wrapper .dataTables_paginate .pagination {
    justify-content: flex-end;
}

.dataTables_wrapper .dataTables_paginate .paginate_button .page-link {
    min-width: 30px;
    min-height: 30px;
    padding: 0.24rem 0.48rem;
}

.page-item.active .page-link {
    background-color: var(--app-green);
    border-color: var(--app-green);
}

.select2-container--bootstrap4 .select2-selection {
    min-height: 36px;
    border-color: var(--app-line);
    border-radius: 6px;
    font-size: 0.86rem;
}

.select2-container--bootstrap4.select2-container--focus .select2-selection,
.select2-container--bootstrap4.select2-container--open .select2-selection {
    border-color: rgba(31, 122, 69, 0.55);
    box-shadow: 0 0 0 0.16rem rgba(31, 122, 69, 0.12);
}

.select2-container--bootstrap4 .select2-results__option--highlighted[aria-selected] {
    background-color: var(--app-green);
}

.dropdown-menu {
    border: 1px solid var(--app-line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(22, 52, 38, 0.14);
    font-size: 0.86rem;
}

.dropdown-item {
    color: var(--app-ink);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: #eef7f0;
    color: var(--app-forest);
}

.modal-content {
    border: 1px solid var(--app-line);
    border-radius: 8px;
    box-shadow: 0 18px 38px rgba(22, 52, 38, 0.18);
}

.modal-header {
    min-height: 48px;
    padding: 0.75rem 1rem;
    background: #f8faf7;
    border-bottom: 1px solid var(--app-line);
}

.modal-title {
    color: var(--app-ink);
    font-size: 1rem;
    font-weight: 800;
}

.modal-body {
    color: var(--app-ink);
    font-size: 0.9rem;
}

.modal-footer {
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--app-line);
}

.main-footer {
    background: #ffffff;
    border-top: 1px solid var(--app-line);
    color: var(--app-muted);
    font-size: 0.78rem;
    box-shadow: 0 -2px 10px rgba(22, 52, 38, 0.04);
}

.pos-total-display {
    background-color: #f8faf7;
    border-color: var(--app-green);
}

.pos-total-display .total-label {
    color: var(--app-ink);
}

.pos-total-display .total-amount {
    color: var(--app-forest);
}

.card-stats {
    border-radius: 8px;
}

.card-stats--primary,
.card-stats--success,
.card-stats--info {
    background: linear-gradient(135deg, #0f3d26 0%, #1f7a45 100%);
}

.card-stats--dark {
    background: linear-gradient(135deg, #0b2d1e 0%, #163426 100%);
}

.card-stats--warning {
    background: linear-gradient(135deg, #b8872f 0%, #d1a84f 100%);
}

@media (max-width: 767.98px) {
    .content-body {
        padding: 0.8rem 0.75rem 24px;
    }

    body.theme-wood .navbar,
    body.theme-islami .navbar {
        padding: 8px 10px;
    }

    .card-body {
        padding: 0.78rem;
    }

    .table {
        font-size: 0.8rem;
    }
}

/* ===================================================
    PERMISSION MATRIX BUTTONS
====================================================== */
.btn-permission {
    width: 110px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
}

.btn-permission .icon {
    margin-right: 6px;
}

.btn-permission-active {
    background-color: #2ecc71;
    border-color: #27ae60;
    color: white;
}
.btn-permission-active:hover {
    background-color: #27ae60;
    color: white;
}

.btn-permission-inactive {
    background-color: #e0e0e0;
    border-color: #bdbdbd;
    color: #616161;
}
.btn-permission-inactive:hover {
    background-color: #bdbdbd;
    color: #424242;
}

/* Ensure header/navbar and its dropdowns appear above the fixed sidebar */
.navbar {
    position: relative; /* allow z-index to take effect */
    z-index: 1100;
}

/* Make dropdowns always appear above the sidebar */
.navbar .dropdown-menu,
.dropdown-menu {
    z-index: 1200;
}

/* Defensive: ensure content area remains above page background but under navbar */
#content {
    z-index: 100;
}

/* When in santri-mode, hide all non-santri sidebar items and keep santri-only visible */
body.santri-mode #sidebar ul.components > li {
    display: none;
}

/* Show only the santri-only items (E-Digital and Logout) */
body.santri-mode #sidebar ul.components > li.santri-only {
    display: block;
}

/* Ensure logout (mt-auto) remains pinned to the bottom in santri mode */
body.santri-mode #sidebar ul.components > li.mt-auto {
    margin-top: auto;
}

/* Force modals and backdrops above other UI layers so buttons remain clickable */
.modal-backdrop {
    z-index: 11050 !important; /* ensure backdrop sits above app layers */
}
.modal {
    z-index: 11060 !important; /* modal above backdrop */
    pointer-events: auto !important;
}
.modal .modal-content {
    pointer-events: auto !important;
}
.modal .btn {
    pointer-events: auto !important;
}

/* ===================================================
   GLOBAL BUTTON CONTRAST GUARD
   Keeps Bootstrap/custom buttons readable on white cards and tables.
====================================================== */
.btn,
a.btn,
button.btn,
label.btn {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border-width: 1px;
    white-space: normal;
    line-height: 1.25;
}

.btn.btn-block {
    display: flex;
    width: 100%;
}

.btn i,
.btn .fas,
.btn .far,
.btn .fab,
.btn .fa,
.btn span {
    color: inherit;
}

.btn i {
    margin-right: 0;
}

.btn-primary,
.btn-success {
    background-color: var(--app-green);
    border-color: var(--app-green);
    color: #fff;
}

.btn-info {
    background-color: #0f8ea8;
    border-color: #0f8ea8;
    color: #fff;
}

.btn-warning {
    background-color: #b8872f;
    border-color: #b8872f;
    color: #fff;
}

.btn-danger {
    background-color: #c93a3a;
    border-color: #c93a3a;
    color: #fff;
}

.btn-secondary,
.btn-light {
    background-color: #eef4ef;
    border-color: #cfdcd5;
    color: #163426;
}

.btn-outline-primary,
.btn-outline-success {
    background-color: #edf7ef;
    border-color: rgba(31, 122, 69, 0.55);
    color: #124f2f;
}

.btn-outline-info {
    background-color: #e8f8fc;
    border-color: #0f8ea8;
    color: #07576a;
}

.btn-outline-warning {
    background-color: #fff7df;
    border-color: #b8872f;
    color: #684915;
}

.btn-outline-danger {
    background-color: #fff0f0;
    border-color: #c93a3a;
    color: #8a2424;
}

.btn-outline-secondary,
.btn-outline-dark,
.btn-outline-light {
    background-color: #f5f8f5;
    border-color: #cfdcd5;
    color: #163426;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-success:hover,
.btn-success:focus,
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary.active,
.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-success.active {
    background-color: var(--app-forest);
    border-color: var(--app-forest);
    color: #fff;
}

.btn-info:hover,
.btn-info:focus,
.btn-outline-info:hover,
.btn-outline-info:focus,
.btn-outline-info.active {
    background-color: #0b7285;
    border-color: #0b7285;
    color: #fff;
}

.btn-warning:hover,
.btn-warning:focus,
.btn-outline-warning:hover,
.btn-outline-warning:focus,
.btn-outline-warning.active {
    background-color: #94681f;
    border-color: #94681f;
    color: #fff;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-outline-danger:hover,
.btn-outline-danger:focus,
.btn-outline-danger.active {
    background-color: #9f2c2c;
    border-color: #9f2c2c;
    color: #fff;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-light:hover,
.btn-light:focus,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary.active,
.btn-outline-dark:hover,
.btn-outline-dark:focus,
.btn-outline-dark.active,
.btn-outline-light:hover,
.btn-outline-light:focus,
.btn-outline-light.active {
    background-color: #dfece3;
    border-color: #b7cbbf;
    color: #0f3d26;
}

.btn.disabled,
.btn:disabled,
fieldset:disabled .btn {
    opacity: 0.65;
    color: inherit;
}
