/* =========================================================
   Manajemen Yayasan Robbani — gaya tampilan
   Warna utama diambil dari Profil Yayasan (--tema)
   ========================================================= */
:root {
  --tema: #0F8B8D;
  --tema-gelap: color-mix(in srgb, var(--tema) 80%, #000);
  --tema-muda: color-mix(in srgb, var(--tema) 10%, #fff);
  --sidebar-w: 260px;
  --bg: #F4F7F7;
  --ink: #1E2A2A;
  --muted: #6B7B7B;
  --garis: #E3EAEA;
}
* { font-family: 'Poppins', system-ui, sans-serif; }
body { background: var(--bg); color: var(--ink); font-size: .92rem; }
a { color: var(--tema-gelap); }

/* Sidebar */
.sidebar { width: var(--sidebar-w); background: var(--tema-gelap) !important; color: #fff; display: flex; flex-direction: column; }
/* Bootstrap membuat .offcanvas-lg transparan di layar lebar; warna sidebar dipaksa di atas */
@media (min-width: 992px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1030; visibility: visible !important; transform: none !important; }
}
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-logo { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; background: #fff; flex-shrink: 0; }
.brand-logo-text { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--tema-gelap); font-size: 1.2rem; }
.brand-name { font-weight: 600; font-size: .92rem; line-height: 1.2; }
.brand-sub { font-size: .72rem; opacity: .75; }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .75rem .6rem; }
.side-link, .side-group { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .55rem .75rem; border-radius: 8px; color: rgba(255,255,255,.85); text-decoration: none; font-size: .88rem; }
.side-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.side-link.active { background: #fff; color: var(--tema-gelap); font-weight: 600; }
.side-group { background: none; border: 0; color: #fff; font-weight: 700; margin-top: .5rem; text-align: left; }
.side-group:hover { background: rgba(255,255,255,.08); }
.side-group .chevron { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.side-group.collapsed .chevron { transform: rotate(-90deg); }
.side-sub { padding-left: .6rem; margin: .15rem 0 .35rem; border-left: 1px solid rgba(255,255,255,.18); margin-left: 1.2rem; }
.side-sub .side-link { font-weight: 400; padding: .45rem .7rem; }
.side-sub .side-link.active { font-weight: 600; }
.sidebar-foot { font-size: .7rem; opacity: .6; padding: .75rem 1rem; border-top: 1px solid rgba(255,255,255,.12); }

/* Main */
.main { min-height: 100vh; }
@media (min-width: 992px) { .main { margin-left: var(--sidebar-w); } }
.main-full { margin-left: 0 !important; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; background: #fff; border-bottom: 1px solid var(--garis); padding: .65rem 1.5rem; }
.topbar-title { font-size: 1.1rem; font-weight: 600; margin: 0; color: var(--ink); }
h1, h2, h3, h4, h5, h6 { color: var(--ink); }
.btn-user { display: flex; align-items: center; gap: .55rem; border: 0; background: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--tema); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.content { padding: 1.5rem; max-width: 1400px; }
@media (max-width: 576px) { .content { padding: 1rem; } .topbar { padding: .6rem 1rem; } }

/* Kartu */
.card-app { background: #fff; border: 1px solid var(--garis); border-radius: 12px; margin-bottom: 1.25rem; }
.card-app-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .9rem 1.25rem; border-bottom: 1px solid var(--garis); }
.card-app-header h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.card-app-body { padding: 1.25rem; }
.stat { background: #fff; border: 1px solid var(--garis); border-radius: 12px; padding: 1rem 1.1rem; height: 100%; display: flex; gap: .9rem; align-items: center; text-decoration: none; color: inherit; }
.stat:hover { border-color: var(--tema); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; background: var(--tema-muda); color: var(--tema-gelap); flex-shrink: 0; }
.stat-icon.warn { background: #FFF4DE; color: #B26B00; }
.stat-icon.danger { background: #FDE8E8; color: #B42318; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

/* Tabel */
.table-app { width: 100%; border-collapse: collapse; }
.table-app th { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: .6rem .75rem; border-bottom: 1px solid var(--garis); background: #FAFCFC; white-space: nowrap; }
.table-app td { padding: .7rem .75rem; border-bottom: 1px solid var(--garis); vertical-align: middle; }
.table-app tr:last-child td { border-bottom: 0; }
.table-app tbody tr:hover { background: #FAFCFC; }
.empty-state { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; opacity: .5; }

/* Tombol & form */
.btn-tema { background: var(--tema); border-color: var(--tema); color: #fff; }
.btn-tema:hover, .btn-tema:focus { background: var(--tema-gelap); border-color: var(--tema-gelap); color: #fff; }
.form-label { font-weight: 500; font-size: .84rem; margin-bottom: .3rem; }
.form-control:focus, .form-select:focus { border-color: var(--tema); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--tema) 20%, transparent); }
.section-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--tema-gelap); margin: 1.25rem 0 .75rem; }
.section-label:first-child { margin-top: 0; }
.info-row { display: flex; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--garis); }
.info-row:last-child { border-bottom: 0; }
.info-row .k { width: 190px; color: var(--muted); flex-shrink: 0; }
@media (max-width: 576px) { .info-row { flex-direction: column; gap: .1rem; } .info-row .k { width: auto; } }

/* Kepengurusan */
.organ-title { font-weight: 700; color: var(--tema-gelap); margin-bottom: .6rem; display: flex; align-items: center; gap: .4rem; }
.person { border: 1px solid var(--garis); border-radius: 10px; padding: .75rem .9rem; display: flex; gap: .75rem; align-items: center; background: #fff; height: 100%; }
.person .avatar { width: 40px; height: 40px; flex-shrink: 0; }
.person-jabatan { font-size: .75rem; color: var(--muted); }

/* Hak akses */
.matrix th, .matrix td { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix .form-check-input { margin: 0; float: none; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(135deg, var(--tema-muda), #fff); }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--garis); border-radius: 16px; padding: 2rem; box-shadow: 0 10px 30px rgba(0,0,0,.05); }
.login-logo { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 1rem; display: flex; align-items: center; justify-content: center; background: var(--tema); color: #fff; font-size: 1.6rem; font-weight: 700; overflow: hidden; }
.login-logo img { width: 100%; height: 100%; object-fit: cover; }

/* Cetak */
@media print {
  .sidebar, .topbar, .no-print, .alert { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0; max-width: none; }
  .card-app { border: 0; }
  body { background: #fff; font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
}
tfoot td { border-top: 2px solid var(--garis); }
.nav-tabs .nav-link.active { color: var(--tema-gelap); }
.nav-tabs .nav-link { color: var(--muted); }

/* =========================================================
   Tema & Tampilan (Pengaturan → Tema & Tampilan)
   ========================================================= */
/* Sidebar warna tema penuh */
body.sb-tema .sidebar { background: var(--tema) !important; }
body.sb-tema .side-link.active { color: var(--tema-gelap); }
/* Sidebar terang */
body.sb-terang .sidebar { background: #fff !important; color: var(--ink); border-right: 1px solid var(--garis); }
body.sb-terang .sidebar-brand, body.sb-terang .sidebar-foot { border-color: var(--garis); }
body.sb-terang .brand-logo { border: 1px solid var(--garis); }
body.sb-terang .brand-logo-text { background: var(--tema); color: #fff; }
body.sb-terang .brand-sub { color: var(--muted); opacity: 1; }
body.sb-terang .side-link { color: var(--ink); }
body.sb-terang .side-link:hover { background: var(--tema-muda); color: var(--tema-gelap); }
body.sb-terang .side-link.active { background: var(--tema); color: #fff; }
body.sb-terang .side-group { color: var(--tema-gelap); }
body.sb-terang .side-group:hover { background: var(--tema-muda); }
body.sb-terang .side-sub { border-left-color: var(--garis); }
body.sb-terang .sidebar .btn-close-white { filter: none; }
/* Ukuran tulisan */
body.fs-kecil { font-size: .84rem; }
body.fs-kecil .side-link, body.fs-kecil .side-group { font-size: .82rem; }
body.fs-besar { font-size: 1rem; }
body.fs-besar .side-link, body.fs-besar .side-group { font-size: .95rem; }
body.fs-besar .form-label { font-size: .92rem; }
/* Tabel rapat */
body.tbl-rapat .table-app td { padding: .38rem .6rem; }
body.tbl-rapat .table-app th { padding: .45rem .6rem; }
/* Sudut tegas */
body.sudut-tegas { --bs-border-radius: .2rem; --bs-border-radius-sm: .15rem; --bs-border-radius-lg: .25rem; }
body.sudut-tegas .card-app, body.sudut-tegas .stat, body.sudut-tegas .login-card, body.sudut-tegas .person,
body.sudut-tegas .side-link, body.sudut-tegas .side-group, body.sudut-tegas .stat-icon, body.sudut-tegas .brand-logo, body.sudut-tegas .login-logo { border-radius: 4px; }
/* Latar halaman login */
.login-berlatar { background-size: cover; background-position: center; position: relative; }
.login-berlatar::before { content: ''; position: absolute; inset: 0; background: color-mix(in srgb, var(--tema) 35%, rgba(0,0,0,.35)); }
.login-berlatar .login-card { position: relative; box-shadow: 0 16px 40px rgba(0,0,0,.25); }

/* Halaman pengaturan tampilan */
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--garis); cursor: pointer; padding: 0; }
.swatch.aktif { box-shadow: 0 0 0 2px var(--ink); }
.pratinjau-app { display: flex; border: 1px solid var(--garis); border-radius: 12px; overflow: hidden; height: 300px; background: var(--bg); font-size: .8rem; }
.pratinjau-app .p-side { width: 170px; padding: .6rem .45rem; display: flex; flex-direction: column; gap: .15rem; flex-shrink: 0; }
.pratinjau-app .p-brand { display: flex; align-items: center; gap: .4rem; padding: .2rem .35rem .55rem; font-weight: 600; font-size: .75rem; }
.pratinjau-app .p-logo { width: 24px; height: 24px; border-radius: 6px; background: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; }
.pratinjau-app .p-logo img { width: 100%; height: 100%; object-fit: cover; }
.pratinjau-app .p-grup { font-weight: 700; padding: .3rem .45rem; margin-top: .25rem; }
.pratinjau-app .p-link { padding: .3rem .45rem .3rem 1rem; border-radius: 6px; }
.pratinjau-app .p-main { flex: 1; padding: .75rem; overflow: hidden; }
.pratinjau-app .p-card { background: #fff; border: 1px solid var(--garis); border-radius: 10px; }
.pratinjau-app .p-card-h { padding: .45rem .7rem; border-bottom: 1px solid var(--garis); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.pratinjau-app table { width: 100%; }
.pratinjau-app td { border-bottom: 1px solid var(--garis); padding: .45rem .7rem; }
.pratinjau-app.p-rapat td { padding: .22rem .7rem; }
.pratinjau-app.p-tegas, .pratinjau-app.p-tegas .p-card, .pratinjau-app.p-tegas .p-link, .pratinjau-app.p-tegas .btn { border-radius: 3px; }
