/* =============================================================
   SIM DKM Masjid Al-Mishbah Hunian 68 - Stylesheet
   ============================================================= */
:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --accent: #f59e0b;
    --bg: #f1f5f9;
    --panel: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --masuk: #10b981;
    --keluar: #ef4444;
    --sidebar-w: 250px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
}

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content { flex: 1; padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #0f766e 0%, #134e4a 100%);
    color: #fff;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}
.sidebar-brand {
    display: flex; gap: 12px; align-items: center;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.15);
}
.brand-icon { font-size: 28px; }
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; opacity: .8; }
.sidebar-nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.nav-section {
    margin: 14px 14px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: .6;
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; gap: 16px;
    background: var(--panel);
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 20px; }
.topbar-sub { font-size: 12px; color: var(--muted); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-name { font-weight: 600; font-size: 14px; }
.btn-menu { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }

/* ---------- Cards ringkasan ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.card {
    background: var(--panel);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex; gap: 14px; align-items: center;
    box-shadow: 0 1px 3px rgba(15,23,42,.06);
    border-top: 4px solid var(--primary);
}
.card-masuk { border-top-color: var(--masuk); }
.card-keluar { border-top-color: var(--keluar); }
.card-saldo { border-top-color: var(--primary); }
.card-tpq { border-top-color: var(--accent); }
.card-icon { font-size: 30px; }
.card-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.card-value { font-size: 20px; font-weight: 700; margin-top: 2px; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Panel ---------- */
.panel {
    background: var(--panel);
    border-radius: 14px;
    padding: 20px 22px;
    margin-bottom: 22px;
    box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; gap: 10px; flex-wrap: wrap;
}
.panel-header h2 { font-size: 17px; }
.panel-sub { font-size: 13px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

/* ---------- Chart ---------- */
.chart-wrap { position: relative; height: 300px; }
.chart-lg { height: 340px; }

/* ---------- Table ---------- */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    text-align: left; padding: 10px 12px;
    background: #f8fafc; border-bottom: 2px solid var(--border);
    font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
    white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:hover { background: #f8fafc; }
.table-jadwal td:not(:first-child) { text-align: center; }
.row-today { background: #ecfdf5 !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-masuk { color: var(--masuk); font-weight: 600; }
.text-keluar { color: var(--keluar); font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---------- Badge ---------- */
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-superadmin { background: #ede9fe; color: #6d28d9; }
.badge-admin { background: #dbeafe; color: #1d4ed8; }
.badge-viewer { background: #f1f5f9; color: #475569; }
.badge-status { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f1f5f9; color: #475569; }
.badge-rencana { background: #fef3c7; color: #b45309; }
.badge-berlangsung { background: #dbeafe; color: #1d4ed8; }
.badge-selesai { background: #d1fae5; color: #047857; }
.badge-batal { background: #fee2e2; color: #b91c1c; }

/* ---------- Button ---------- */
.btn {
    display: inline-block; padding: 8px 16px; border-radius: 8px;
    border: 1px solid var(--border); background: #fff; color: var(--text);
    font-size: 14px; cursor: pointer; text-decoration: none;
    transition: all .15s;
}
.btn:hover { background: #f8fafc; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(.93); }
.btn-danger { background: var(--keluar); border-color: var(--keluar); color: #fff; }
.btn-danger:hover { filter: brightness(.9); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
form.inline { display: inline; }

/* ---------- Form ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.form-grid input, .form-grid select, .form-grid textarea,
.filter-bar input, .filter-bar select {
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit; background: #fff;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
    outline: 2px solid rgba(13,148,136,.3); border-color: var(--primary);
}
.span-2 { grid-column: span 2; }
.form-actions { grid-column: span 2; display: flex; gap: 10px; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }

/* ---------- Alert ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }

/* ---------- List ---------- */
.list { list-style: none; }
.list-item {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }

/* ---------- Jumat ---------- */
.jumat-box {
    margin-top: 16px; padding: 14px 16px;
    background: #ecfdf5; border-left: 4px solid var(--primary);
    border-radius: 8px; font-size: 14px; line-height: 1.7;
}
.jumat-hero {
    background: linear-gradient(135deg, #0d9488, #134e4a);
    color: #fff; border-radius: 16px; padding: 24px 26px; margin-bottom: 22px;
    box-shadow: 0 8px 20px rgba(13,148,136,.25);
}
.jumat-hero-label { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.jumat-hero-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.jumat-hero-grid span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: .75; }
.jumat-hero-grid strong { font-size: 15px; }

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0d9488 0%, #134e4a 100%);
    padding: 20px;
}
.login-card {
    background: #fff; border-radius: 18px; padding: 36px 34px;
    width: 100%; max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-icon { font-size: 46px; }
.login-brand h1 { font-size: 21px; margin-top: 6px; }
.login-brand p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.login-form input {
    padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px;
}
.login-form input:focus { outline: 2px solid rgba(13,148,136,.3); border-color: var(--primary); }
.login-hint {
    margin-top: 18px; padding: 12px; border-radius: 8px;
    background: #f8fafc; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.7;
}

/* ---------- Footer ---------- */
.footer {
    text-align: center; padding: 16px; color: var(--muted);
    font-size: 13px; border-top: 1px solid var(--border);
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .jumat-hero-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
    .sidebar {
        position: fixed; left: calc(-1 * var(--sidebar-w)); z-index: 100;
        transition: left .25s;
    }
    .sidebar.open { left: 0; }
    .btn-menu { display: block; }
    .cards, .cards-3 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2, .form-actions { grid-column: span 1; }
    .topbar { flex-wrap: wrap; }
}


/* =============================================================
   FIX Foto Khatib 150px + teks tidak menimpa gambar
   Tempel di PALING BAWAH assets/css/style.css
   ============================================================= */

.jumat-hero-content {
    display: grid !important;
    grid-template-columns: 170px minmax(0, 1fr) !important;
    gap: 22px !important;
    align-items: center !important;
}

.jumat-khatib-photo-wrap {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    text-align: center !important;
    position: relative !important;
    z-index: 1 !important;
}

.jumat-khatib-photo,
.jumat-khatib-photo.placeholder {
    width: 150px !important;
    height: 150px !important;
    min-width: 150px !important;
    min-height: 150px !important;
    max-width: 150px !important;
    max-height: 150px !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    border: 4px solid rgba(255,255,255,.4) !important;
    background: rgba(255,255,255,.15) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.jumat-khatib-photo.placeholder {
    font-size: 54px !important;
}

.jumat-hero-grid {
    min-width: 0 !important;
    position: relative !important;
    z-index: 2 !important;
}

.jumat-hero-grid > div {
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
}

.jumat-hero-grid span,
.jumat-hero-grid strong {
    display: block !important;
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
}

/* Foto kecil di tabel */
.table-photo {
    width: 52px !important;
    height: 52px !important;
    max-width: 52px !important;
    max-height: 52px !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    border: 2px solid var(--border) !important;
}

@media (max-width: 760px) {
    .jumat-hero {
        padding: 18px 14px !important;
    }

    .jumat-hero-content {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
        justify-items: center !important;
        text-align: center !important;
    }

    .jumat-khatib-photo-wrap {
        width: 150px !important;
        min-width: 150px !important;
        max-width: 150px !important;
        margin: 0 auto !important;
    }

    .jumat-khatib-photo,
    .jumat-khatib-photo.placeholder {
        width: 150px !important;
        height: 150px !important;
        min-width: 150px !important;
        min-height: 150px !important;
        max-width: 150px !important;
        max-height: 150px !important;
    }

    .jumat-hero-grid {
        width: 100% !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        text-align: left !important;
    }

    .jumat-hero-grid strong {
        font-size: 13px !important;
        line-height: 1.35 !important;
    }
}

@media (max-width: 420px) {
    .jumat-hero-grid {
        grid-template-columns: 1fr !important;
        text-align: center !important;
    }
}


/* =============================================================
   FINAL FIX QRIS Responsive + tombol download
   Tempel di PALING BAWAH assets/css/style.css
   ============================================================= */

.qris-panel {
    overflow: hidden !important;
}

.qris-box {
    display: grid !important;
    grid-template-columns: 170px minmax(0, 1fr) !important;
    gap: 18px !important;
    align-items: center !important;
}

.qris-image-wrap {
    width: 150px !important;
    max-width: 150px !important;
    padding: 8px !important;
    margin: 0 auto !important;
    background: #fff !important;
    border: 1px dashed var(--border) !important;
    border-radius: 12px !important;
    text-align: center !important;
}

.qris-image {
    width: 130px !important;
    height: 130px !important;
    max-width: 130px !important;
    max-height: 130px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
}

.qris-info {
    min-width: 0 !important;
}

.qris-info h3,
.qris-info p,
.qris-info li {
    overflow-wrap: anywhere !important;
    word-break: normal !important;
}

.qris-actions {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    margin-top: 10px !important;
}

.qris-actions .btn {
    white-space: nowrap !important;
}

@media (max-width: 760px) {
    .qris-panel {
        padding: 16px 14px !important;
    }

    .qris-box {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        text-align: center !important;
        justify-items: center !important;
    }

    .qris-image-wrap {
        width: 132px !important;
        max-width: 132px !important;
        padding: 7px !important;
    }

    .qris-image {
        width: 115px !important;
        height: 115px !important;
        max-width: 115px !important;
        max-height: 115px !important;
    }

    .qris-info ul {
        display: inline-block !important;
        text-align: left !important;
        margin-left: 0 !important;
    }

    .qris-actions {
        justify-content: center !important;
    }
}

@media (max-width: 420px) {
    .qris-image-wrap {
        width: 118px !important;
        max-width: 118px !important;
        padding: 6px !important;
    }

    .qris-image {
        width: 102px !important;
        height: 102px !important;
        max-width: 102px !important;
        max-height: 102px !important;
    }

    .qris-actions .btn {
        width: 100% !important;
        text-align: center !important;
    }
}


/* Input pembayaran iuran */
.input-sm { padding:4px 8px; border:1px solid var(--border); border-radius:6px; font-size:13px; max-width:130px; }
.input-file-sm { max-width:170px; font-size:12px; }
.form-bayar { display:inline-flex !important; gap:6px; align-items:center; flex-wrap:wrap; justify-content:center; }
@media (max-width:760px){ .form-bayar{ flex-direction:column; align-items:stretch; } .input-sm,.input-file-sm{ max-width:100%; width:100%; } }


/* Input pembayaran iuran santri */
.input-sm { padding:4px 8px; border:1px solid var(--border); border-radius:6px; font-size:13px; max-width:130px; }
.form-bayar { display:inline-flex !important; gap:6px; align-items:center; flex-wrap:wrap; justify-content:center; }
@media (max-width:760px){ .form-bayar{ flex-direction:column; align-items:stretch; } .input-sm{ max-width:100%; width:100%; } }



/* ---------- Form Transaksi Pembayaran Iuran Santri ---------- */
.panel-bayar-iuran {
    border-top: 4px solid var(--primary);
}
.form-transaksi-iuran label {
    font-size: 14px;
    color: var(--muted);
}
.form-transaksi-iuran input,
.form-transaksi-iuran select {
    min-height: 44px;
}
.form-transaksi-iuran input[type="file"] {
    padding: 10px 12px;
    background: #fff;
}
.form-bayar {
    display: inline-flex !important;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}
.input-sm {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    max-width: 130px;
}
@media (max-width: 760px) {
    .form-transaksi-iuran {
        grid-template-columns: 1fr !important;
    }
    .form-transaksi-iuran .span-2,
    .form-transaksi-iuran .form-actions {
        grid-column: span 1 !important;
    }
    .form-bayar {
        flex-direction: column;
        align-items: stretch;
    }
    .input-sm {
        max-width: 100%;
        width: 100%;
    }
}

