:root {
  --navy-950: #06101f;
  --navy-900: #0a192f;
  --navy-800: #0f2544;
  --navy-700: #17345e;
  --navy-600: #1e4278;
  --gold-600: #a67f19;
  --gold-500: #c59b27;
  --gold-400: #d9b243;
  --gold-100: #fef9e7;
  --surface-bg: #f8fafc;
  --surface-muted: #f1f5f9;
  --border-hairline: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --success-700: #15803d;
  --danger-700: #b91c1c;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  font-family: 'DM Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--surface-bg);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .navbar-brand, .stat-value {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Utilitas Warna & Tipografi */
.bg-navy { background-color: var(--navy-800) !important; }
.bg-navy-dark { background-color: var(--navy-900) !important; }
.text-navy { color: var(--navy-800) !important; }
.text-gold { color: var(--gold-500) !important; }
.text-gold-bright { color: var(--gold-400) !important; }
.border-hairline { border-color: var(--border-hairline) !important; }

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tombol Konsisten */
.btn-navy {
  background-color: var(--navy-800);
  border-color: var(--navy-800);
  color: #ffffff;
  font-weight: 600;
}
.btn-navy:hover, .btn-navy:focus-visible {
  background-color: var(--navy-700);
  border-color: var(--navy-700);
  color: #ffffff;
}

.btn-gold {
  background-color: var(--gold-400);
  border-color: var(--gold-400);
  color: var(--navy-900);
  font-weight: 700;
}
.btn-gold:hover, .btn-gold:focus-visible {
  background-color: var(--gold-500);
  border-color: var(--gold-500);
  color: var(--navy-950);
}

.btn:focus-visible, .form-control:focus, .form-select:focus {
  box-shadow: 0 0 0 0.2rem rgba(15, 37, 68, 0.16);
  border-color: var(--navy-700);
}

/* Navbar & Hero Portal Publik */
.navbar-public {
  background-color: rgba(15, 37, 68, 0.98);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-public .nav-link {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  transition: color 0.15s ease;
}

.navbar-public .nav-link:hover,
.navbar-public .nav-link:focus {
  color: var(--gold-400);
}

.hero-banner {
  background-color: var(--navy-900);
  background-image:
    radial-gradient(circle at 85% 20%, rgba(217, 178, 67, 0.12) 0%, transparent 45%),
    linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-stat-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.75rem;
  padding: 1.1rem;
  height: 100%;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.hero-stat-card:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(217, 178, 67, 0.45);
}

/* Layout Dashboard Sidebar */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 272px;
  background-color: var(--navy-900);
  color: #cbd5e1;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.app-sidebar .sidebar-brand {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar .nav-section {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: #94a3b8;
  padding: 1rem 1.25rem 0.35rem;
  text-transform: uppercase;
}

.app-sidebar .nav-link {
  color: #cbd5e1;
  padding: 0.56rem 1.25rem;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-radius: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.app-sidebar .nav-link.active {
  background-color: rgba(217, 178, 67, 0.16);
  color: #fde68a;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--gold-400);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 16, 31, 0.55);
  z-index: 1040;
}

.sidebar-backdrop.show {
  display: block;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-hairline);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

/* Kartu & Tabel Dashboard */
.card {
  border-color: var(--border-hairline);
  border-radius: 0.75rem;
}

.card-header {
  border-bottom-color: var(--border-hairline);
  padding: 0.85rem 1.15rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: 0.75rem;
  padding: 1.15rem 1.25rem;
  transition: box-shadow 0.18s ease;
}

.stat-card:hover {
  box-shadow: 0 6px 18px rgba(15, 37, 68, 0.05);
}

.stat-value {
  font-variant-numeric: tabular-nums;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--navy-800);
  line-height: 1.25;
}

.table > thead th {
  font-weight: 600;
  color: #475569;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom-color: var(--border-hairline);
}

/* Kartu Katalog Buku */
.book-card {
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.book-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(15, 37, 68, 0.08);
}

.book-cover-box {
  height: 220px;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border-hairline);
}

.book-cover-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-madrasah {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 0.5rem;
  background: #ffffff;
  padding: 2px;
  flex-shrink: 0;
}

/* Status Teks Bersih */
.status-label-ok { color: var(--success-700); font-weight: 600; }
.status-label-warn { color: var(--gold-600); font-weight: 600; }
.status-label-danger { color: var(--danger-700); font-weight: 600; }

/* Empty State */
.empty-state {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  color: #94a3b8;
  margin-bottom: 0.65rem;
}

/* Kop Surat Resmi Laporan */
.kop-surat {
  border-bottom: 3px double #0f172a;
  padding-bottom: 14px;
  margin-bottom: 22px;
}

/* Pagination */
.pagination .page-item.active .page-link {
  background-color: var(--navy-800);
  border-color: var(--navy-800);
  color: #ffffff;
}

.pagination .page-link {
  color: var(--navy-800);
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1045;
    transform: translateX(-100%);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }
  .no-print, .app-sidebar, .app-topbar, .sidebar-backdrop {
    display: none !important;
  }
  .app-main {
    display: block;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .card, .stat-card {
    border: none !important;
    box-shadow: none !important;
  }
  .table {
    font-size: 11px;
  }
}
