:root {
  --primary: #1e3a8a;
  --secondary: #3b82f6;
  --accent: #10b981;
  --bg-main: #f1f5f9;
  --text-main: #334155;
  --sidebar-width: 260px;
}
body { font-family: 'Inter', sans-serif; background: var(--bg-main); color: var(--text-main); margin: 0; overflow-x: hidden; }
.fade-in { animation: fadeIn .3s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(135deg, #0f172a 0%, var(--primary) 100%); }
.login-card { background: rgba(255,255,255,.97); border-radius: 1.25rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); padding: 2.25rem; width: 100%; max-width: 420px; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); min-width: var(--sidebar-width); background: #0f172a; color: #fff; display: flex; flex-direction: column; z-index: 1040; height: 100vh; position: sticky; top: 0; transition: left .25s; }
.sidebar-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,.06); text-align: center; }
.sidebar-menu { flex-grow: 1; overflow-y: auto; padding: .75rem 0 1.5rem; scrollbar-width: thin; scrollbar-color: #334155 #0f172a; }
.sidebar-menu::-webkit-scrollbar { width: 8px; }
.sidebar-menu::-webkit-scrollbar-track { background: #0f172a; }
.sidebar-menu::-webkit-scrollbar-thumb { background: #334155; border-radius: 8px; border: 2px solid #0f172a; }
.sidebar-menu::-webkit-scrollbar-thumb:hover { background: #475569; }
.menu-header { font-size: .7rem; text-transform: uppercase; color: #64748b; padding: .9rem 1.5rem .25rem; font-weight: 600; letter-spacing: .5px; }
.nav-item-custom { padding: .6rem 1.5rem; color: #94a3b8; text-decoration: none; display: flex; align-items: center; gap: 12px; cursor: pointer; border-left: 4px solid transparent; font-size: .93rem; }
.nav-item-custom:hover, .nav-item-custom.active { background: rgba(255,255,255,.05); color: #f8fafc; border-left-color: var(--secondary); }
.nav-item-custom .badge { margin-left: auto; }

.main-content { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.topbar { min-height: 64px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.05); display: flex; align-items: center; justify-content: space-between; padding: 0 1.25rem; position: sticky; top: 0; z-index: 1030; }
.avatar-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; font-weight: 700; font-size: 1.1rem; }
.app-page { padding: 1.5rem; flex-grow: 1; }

.card-stat { border: none; border-radius: 1rem; color: #fff; transition: transform .2s; cursor: default; }
.card-stat:hover { transform: translateY(-3px); }
.card-ui { border: none; border-radius: 1rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,.05); margin-bottom: 1.5rem; }
.card-ui > .card-header { background: #fff; border-bottom: 1px solid #eef2f7; border-radius: 1rem 1rem 0 0; }
.img-preview { max-height: 40px; max-width: 100px; object-fit: contain; border-radius: 4px; background: #e2e8f0; }
.recap-badge { font-size: .7rem; margin-left: 3px; padding: 2px 6px; }
.table thead th { font-size: .82rem; white-space: nowrap; }
.table td { font-size: .9rem; }
.table-sticky thead th { position: sticky; top: 0; z-index: 2; }
.scroll-box { max-height: 60vh; overflow: auto; }
.nowrap { white-space: nowrap; }
.btn-xs { padding: .15rem .45rem; font-size: .78rem; }
.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.page-title { font-weight: 700; margin-bottom: .25rem; }
.page-sub { color: #64748b; font-size: .875rem; margin-bottom: 1.25rem; }
.nav-tabs .nav-link { font-weight: 600; font-size: .9rem; }
.picker { position: relative; }
.picker-list { position: absolute; z-index: 1060; left: 0; right: 0; top: 100%; max-height: 260px; overflow-y: auto; background: #fff; border: 1px solid #dee2e6; border-radius: .5rem; box-shadow: 0 10px 20px rgba(0,0,0,.08); }
.picker-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .45rem .75rem; font-size: .9rem; }
.picker-list button:hover, .picker-list button:focus { background: #eff6ff; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.empty { padding: 2rem 1rem; text-align: center; color: #94a3b8; }
.radio-cell input { width: 1.15em; height: 1.15em; cursor: pointer; }
.tagihan-row.lunas { opacity: .55; }
.kpi-small { font-size: .78rem; color: #64748b; }
.portal-hero { background: linear-gradient(135deg, var(--primary), #2563eb); color: #fff; border-radius: 1rem; padding: 1.25rem 1.5rem; }

#fullPageLoader { position: fixed; inset: 0; background: rgba(255,255,255,.95); z-index: 9999; display: flex; align-items: center; justify-content: center; flex-direction: column; }

@media (max-width: 768px) {
  .sidebar { position: fixed; left: -100%; }
  .sidebar.show { left: 0; }
  .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1035; }
  .overlay.show { display: block; }
  .app-page { padding: 1rem; }
  .topbar { padding: 0 .75rem; }
}
@media print { .no-print { display: none !important; } }

/* kredit pengembang */
.dev-credit { color: #64748b; }
.dev-credit a { color: inherit; text-decoration: none !important; display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; transition: color .2s; }
.dev-credit a:hover { color: var(--primary); }
.dev-credit img { border-radius: 4px; }

/* konten dari editor teks berformat (info PPDB) */
.rich { line-height: 1.55; overflow-wrap: anywhere; }
.rich p, .rich ol, .rich ul, .rich pre, .rich blockquote, .rich h1, .rich h2, .rich h3 { margin: 0 0 .35em; }
.rich h1 { font-size: 1.6em; } .rich h2 { font-size: 1.35em; } .rich h3 { font-size: 1.15em; }
.rich ol, .rich ul { padding-left: 1.5em; }
.rich li[data-list="bullet"] { list-style-type: disc; }
.rich li[data-list="ordered"] { list-style-type: decimal; }
.rich .ql-ui { display: none; }
.rich blockquote { border-left: 4px solid #cbd5e1; padding-left: 12px; color: #475569; }
.rich .ql-align-center { text-align: center; } .rich .ql-align-right { text-align: right; } .rich .ql-align-justify { text-align: justify; }
.rich .ql-size-small { font-size: .75em; } .rich .ql-size-large { font-size: 1.5em; } .rich .ql-size-huge { font-size: 2.25em; }
.rich .ql-indent-1 { padding-left: 3em; } .rich .ql-indent-2 { padding-left: 6em; } .rich .ql-indent-3 { padding-left: 9em; }
.rich li.ql-indent-1 { margin-left: 1.5em; padding-left: 0; } .rich li.ql-indent-2 { margin-left: 3em; padding-left: 0; }
.rich a { color: var(--secondary); }
.rich-editor .ql-toolbar { border-radius: .5rem .5rem 0 0; background: #f8fafc; }
.rich-editor .ql-container { border-radius: 0 0 .5rem .5rem; min-height: 220px; font-family: inherit; font-size: .95rem; }

/* tahapan (wizard) Tarif & Tagihan */
.wizard-nav .nav-link { display: inline-flex; align-items: center; gap: 8px; color: #64748b; }
.wizard-nav .nav-link.active { color: var(--primary); }
.wz-no { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: #e2e8f0; color: #475569; font-size: .78rem; font-weight: 700; }
.wizard-nav .nav-link.active .wz-no { background: var(--primary); color: #fff; }
.wz-no.done { background: var(--accent); color: #fff; }

/* kalender akademik */
.kal td { padding: 4px; }
.kal-libur { background: #fef2f2; }
.kal-hari-ini { box-shadow: inset 0 0 0 2px var(--secondary); }

/* tombol X pada kolom pencarian */
.cari-wrap { position: relative; }
.cari-wrap > input { padding-right: 2.1rem; }
.cari-wrap > input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.cari-x { position: absolute; top: 50%; right: .35rem; transform: translateY(-50%); border: 0; background: transparent; color: #94a3b8; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0; z-index: 6; }
.cari-x:hover { color: #475569; background: #e2e8f0; }
.input-group > .cari-wrap { flex: 1 1 auto; width: 1%; min-width: 0; }
.input-group > .cari-wrap:not(:first-child) { margin-left: calc(var(--bs-border-width) * -1); }
.input-group > .cari-wrap:not(:first-child) > .form-control { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > .cari-wrap:not(:last-child) > .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* baris "isi semua" */
.isi-semua > th, .isi-semua > td { background: #fffbeb !important; font-weight: 500; }
.isi-semua .label-isi { font-size: .75rem; color: #92400e; white-space: nowrap; }

/* daftar santri yang bisa langsung diklik */
.santri-list { max-height: 300px; overflow-y: auto; }
.santri-list .list-group-item { font-size: .9rem; }
