:root {
  --navy: #16324f;
  --blue: #1f6feb;
  --mint: #eaf7f4;
  --ink: #192a3a;
}

* { box-sizing: border-box; }

.app-shell { min-height: 100vh; background: #f5f7fb; }
.sidebar { width: 270px; background: linear-gradient(180deg, #102a43, #163d5c); min-height: 100vh; height: 100vh; height: 100dvh; position: fixed; inset: 0 auto 0 0; z-index: 1040; transition: width .2s, transform .2s; display: flex; flex-direction: column; overflow: hidden; }
.brand { height: 70px; display: flex; align-items: center; padding: 0 18px; color: #fff; font-size: 1.1rem; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.12); gap: 10px; }
.brand i { font-size: 1.45rem; color: #57d6c1; }
.sidebar .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; flex-wrap: nowrap !important; align-content: stretch; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.28) transparent; }
.sidebar .nav::-webkit-scrollbar { width: 6px; }
.sidebar .nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 999px; }
.sidebar .nav-link { color: #c8d8e7; border-radius: 9px; padding: 10px 12px; margin-bottom: 3px; display: flex; gap: 14px; align-items: center; flex: 0 0 auto; width: 100%; }
.sidebar .nav-link:hover, .sidebar .nav-link.active { color: #fff; background: rgba(87,214,193,.18); }
.sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); color: white; flex: 0 0 auto; background: rgba(10,31,49,.16); }
.topbar-logout { white-space: nowrap; }
.content { margin-left: 270px; min-height: 100vh; transition: margin-left .2s; }
.topbar { background: #fff; border-bottom: 1px solid #e6ebf1; min-height: 70px; }
.card { border: 0; box-shadow: 0 2px 10px rgba(16,42,67,.06); border-radius: 14px; }
.metric-card { border-left: 4px solid var(--blue); }
.metric-card .metric-value { font-size: 1.75rem; font-weight: 700; color: var(--ink); }
.table > thead th { background: #eef3f8; color: #355066; white-space: nowrap; }
.table-responsive { border-radius: 12px; }
.form-label { font-weight: 600; color: #3b4f61; font-size: .9rem; }
.section-title { color: var(--navy); font-size: 1rem; font-weight: 700; border-bottom: 1px solid #e7edf3; padding-bottom: .6rem; margin: 1.3rem 0 .9rem; }
.btn-primary { background: #1f6feb; border-color: #1f6feb; }
.badge-status { font-size: .75rem; }

/* Chart.js memakai maintainAspectRatio:false; tinggi eksplisit mencegah canvas terus membesar. */
.chart-card { height: 360px; min-height: 0; overflow: hidden; }
.chart-card .card-body { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.chart-card canvas { display: block !important; width: 100% !important; height: 280px !important; max-height: 280px !important; flex: 0 0 280px !important; }

.login-page { min-height: 100vh; background: linear-gradient(135deg,#102a43,#1f6feb); display: grid; place-items: center; }
.login-card { max-width: 440px; width: calc(100% - 2rem); border-radius: 18px; }
.login-icon { width: 58px; height: 58px; display: grid; place-items: center; background: var(--mint); color: #087f68; border-radius: 16px; font-size: 1.6rem; }

.sidebar.collapsed { width: 74px; }
.sidebar.collapsed .brand span, .sidebar.collapsed .nav-link span, .sidebar.collapsed .sidebar-footer small, .sidebar.collapsed .sidebar-footer .user-name, .sidebar.collapsed .sidebar-footer a { display: none; }
.sidebar.collapsed .brand { padding: 0 16px; }
.sidebar.collapsed .nav-link { justify-content: center; }
.sidebar.collapsed .nav-link i { width: auto; }
.sidebar.collapsed + .content { margin-left: 74px; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .content, .sidebar.collapsed + .content { margin-left: 0; }
  .sidebar.collapsed { width: 270px; }
  .sidebar.collapsed .brand span, .sidebar.collapsed .nav-link span, .sidebar.collapsed .sidebar-footer small, .sidebar.collapsed .sidebar-footer .user-name, .sidebar.collapsed .sidebar-footer a { display: initial; }
  .sidebar.collapsed .nav-link { justify-content: flex-start; }
  .sidebar.collapsed .nav-link i { width: 20px; }
}

@media (max-width: 575.98px) {
  .topbar { padding-left: .75rem !important; padding-right: .75rem !important; }
  .topbar-logout span { display: none; }
  .topbar-logout { width: 38px; height: 32px; display: inline-flex; align-items: center; justify-content: center; }
  .chart-card { height: 330px; }
  .chart-card canvas { height: 250px !important; max-height: 250px !important; flex-basis: 250px !important; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .content { margin: 0; }
  .card { box-shadow: none; }
  .container-fluid { padding: 0 !important; }
}
