/* ═══════════════════════════════════════════════════════
   SIRUP Kalimantan Selatan — Stylesheet
   Desktop: fullscreen, Mobile: scroll normal (no tabs)
═══════════════════════════════════════════════════════ */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

html,body{
  font-family:'Segoe UI',system-ui,-apple-system,sans-serif;
  background:#f0f2f5;
  color:#1f2937;
  overflow-x:hidden;
}

/* ── Header ── */
.header{
  background:linear-gradient(135deg,#1a3c6e 0%,#2563eb 100%);
  color:white;
  padding:0 24px;
  height:54px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  box-shadow:0 2px 10px rgba(0,0,0,0.25);
  position:sticky;
  top:0;
  z-index:200;
}
.header-left{min-width:0;flex:1;}
.header h1{font-size:1.05rem;font-weight:700;letter-spacing:0.3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.header .subtitle{font-size:0.7rem;opacity:0.75;margin-top:1px;}
.header-right{display:flex;align-items:center;gap:8px;flex-shrink:0;}

.status-badge{
  display:flex;align-items:center;gap:6px;
  background:rgba(255,255,255,0.15);
  padding:5px 12px;border-radius:20px;
  font-size:0.78rem;white-space:nowrap;
}
.status-dot{width:8px;height:8px;border-radius:50%;background:#6b7280;flex-shrink:0;transition:background .3s;}
.status-dot.connecting{background:#f59e0b;animation:pulse 1s infinite;}
.status-dot.live      {background:#10b981;animation:pulse 1.5s infinite;}
.status-dot.error     {background:#ef4444;}
.status-dot.idle      {background:#94a3b8;}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.35}}

.btn-install{
  background:rgba(255,255,255,0.18);
  border:1px solid rgba(255,255,255,0.35);
  color:white;padding:5px 12px;border-radius:8px;
  font-size:0.75rem;font-weight:600;cursor:pointer;
  display:inline-flex;align-items:center;gap:5px;
  transition:background .2s;white-space:nowrap;
}
.btn-install:hover{background:rgba(255,255,255,0.28);}

/* ── Dropdown ── */
.dropdown { position: relative; display: inline-flex; align-items: center; }
.dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #ffffff;
  min-width: 190px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  border-radius: 10px;
  z-index: 9999;
  padding: 6px 0;
  border: 1px solid rgba(0,0,0,0.08);
  overflow: hidden;
}
.dropdown.open .dropdown-content {
  display: block;
  animation: dropdownFade 0.18s ease-out;
}
@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dropdown-content a {
  color: #1a3c6e;
  padding: 10px 16px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.dropdown-content a:hover {
  background: #eff6ff;
  color: #2563eb;
}
#mode-badge {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2) inset;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* ── Container ── */
.container{width:100%;padding:16px 20px 24px;}

/* ── Filter panel ── */
.filter-panel{
  background:white;border-radius:10px;
  padding:16px 18px;margin-bottom:14px;
  box-shadow:0 1px 4px rgba(0,0,0,0.07);
}
.filter-panel h3{font-size:0.85rem;color:#1a3c6e;margin-bottom:10px;font-weight:600;}
.cache-info-bar{margin-top:8px;font-size:0.72rem;color:#6b7280;}

.filter-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(150px,1fr));
  gap:8px;
}
.filter-grid input,
.filter-grid select{
  width:100%;min-width:0;
  padding:7px 9px;
  border:1px solid #d1d5db;border-radius:6px;
  font-size:0.8rem;outline:none;background:#fafafa;
  transition:border-color .2s,background .2s;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.filter-grid input:focus,
.filter-grid select:focus{border-color:#2563eb;background:white;}

.filter-actions{display:flex;gap:7px;margin-top:10px;flex-wrap:wrap;align-items:center;}

/* ── Buttons ── */
.btn{
  padding:7px 16px;border:none;border-radius:6px;
  font-size:0.8rem;font-weight:600;cursor:pointer;
  transition:all .18s;display:inline-flex;align-items:center;gap:5px;white-space:nowrap;
}
.btn-primary  {background:#2563eb;color:white;}
.btn-primary:hover{background:#1d4ed8;}
.btn-primary:disabled{background:#93c5fd;cursor:not-allowed;}
.btn-secondary{background:#e5e7eb;color:#374151;}
.btn-secondary:hover{background:#d1d5db;}
.btn-success  {background:#10b981;color:white;}
.btn-success:hover{background:#059669;}
.btn-danger   {background:#ef4444;color:white;}
.btn-danger:hover{background:#dc2626;}

/* ── Progress ── */
.progress-wrap{
  background:white;border-radius:8px;
  padding:10px 16px;margin-bottom:12px;
  box-shadow:0 1px 4px rgba(0,0,0,0.07);display:none;
}
.progress-wrap.visible{display:block;}
.progress-label{font-size:0.78rem;color:#374151;margin-bottom:5px;}
.progress-bar-bg{background:#e5e7eb;border-radius:4px;height:7px;overflow:hidden;}
.progress-bar-fill{
  height:100%;background:linear-gradient(90deg,#2563eb,#10b981);
  border-radius:4px;transition:width .4s ease;width:0%;
}

/* ── Stats ── */
.stats-bar{
  display:grid;
  grid-template-columns:repeat(5,1fr);
  gap:12px;margin-bottom:16px;
}
.stat-card{
  background:white;border-radius:10px;padding:14px 16px;
  box-shadow:0 1px 6px rgba(0,0,0,0.08);
  display:flex;align-items:center;gap:12px;
  border-left:4px solid #e5e7eb;
  transition:transform .18s,box-shadow .18s;cursor:default;
}
.stat-card:hover{transform:translateY(-2px);box-shadow:0 4px 14px rgba(0,0,0,0.12);}
.stat-card-primary{border-left-color:#2563eb;}
.stat-card-success{border-left-color:#10b981;}
.stat-card-money  {border-left-color:#8b5cf6;}
.stat-card-info   {border-left-color:#06b6d4;}
.stat-card-warning{border-left-color:#f59e0b;}
.stat-icon{font-size:2rem;line-height:1;opacity:.85;flex-shrink:0;}
.stat-content{flex:1;min-width:0;}
.stat-card .label{font-size:0.68rem;color:#6b7280;text-transform:uppercase;letter-spacing:.5px;margin-bottom:3px;}
.stat-card .value{font-size:1.3rem;font-weight:700;color:#1a3c6e;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

/* ── Charts ── */
.charts-section{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(380px,1fr));
  gap:14px;margin-bottom:16px;
}
.chart-card{background:white;border-radius:10px;padding:16px 18px;box-shadow:0 1px 6px rgba(0,0,0,0.08);}
.chart-card-wide{grid-column:1/-1;}
.chart-header{margin-bottom:12px;padding-bottom:10px;border-bottom:2px solid #f3f4f6;}
.chart-header h3{font-size:0.9rem;color:#1a3c6e;font-weight:600;}
.chart-container{position:relative;height:200px;}
.chart-container-tall{height:320px;}
.chart-container-lokasi{height:520px;}
.chart-card-wide .chart-container{height:220px;}

/* ── Table ── */
.table-wrapper{background:white;border-radius:10px;box-shadow:0 1px 4px rgba(0,0,0,0.07);overflow:hidden;}
.table-toolbar{
  display:flex;align-items:center;justify-content:flex-end;
  padding:10px 14px;border-bottom:1px solid #e5e7eb;gap:8px;flex-wrap:wrap;
}
.right-actions{display:flex;gap:8px;align-items:center;}
.page-size-select{padding:6px 8px;border:1px solid #d1d5db;border-radius:6px;font-size:0.78rem;outline:none;background:#fafafa;}
.table-scroll{overflow-x:auto;max-height:60vh;overflow-y:auto;}
table{width:100%;border-collapse:collapse;font-size:0.78rem;}
thead th{
  background:#1a3c6e;color:white;padding:9px 11px;
  text-align:left;white-space:nowrap;
  position:sticky;top:0;z-index:10;cursor:pointer;user-select:none;
}
thead th:hover{background:#1e4a8a;}
thead th .sort-icon{margin-left:3px;opacity:.6;font-size:.68rem;}
thead th.sort-asc  .sort-icon::after{content:' A→Z';opacity:1;font-size:.65rem;font-weight:700;}
thead th.sort-desc .sort-icon::after{content:' Z→A';opacity:1;font-size:.65rem;font-weight:700;}
thead th .sort-icon::after{content:' ⇅';}
tbody tr{border-bottom:1px solid #f3f4f6;transition:background .12s;}
tbody tr:hover{background:#eff6ff;}
tbody tr.new-row{animation:highlight 2s ease;}
@keyframes highlight{0%{background:#fef9c3}100%{background:transparent}}
tbody td{padding:8px 11px;vertical-align:top;}
.td-no  {width:36px;text-align:center;color:#9ca3af;font-size:.72rem;}
.td-nama{min-width:240px;max-width:320px;}
.td-nama a{color:#2563eb;text-decoration:none;font-weight:500;}
.td-nama a:hover{text-decoration:underline;}
.td-pagu{white-space:nowrap;font-weight:600;color:#065f46;}
.td-id  {font-size:.7rem;color:#9ca3af;}

/* ── Badges ── */
.badge{display:inline-block;padding:2px 7px;border-radius:10px;font-size:.68rem;font-weight:600;white-space:nowrap;}
.badge-barang   {background:#dbeafe;color:#1d4ed8;}
.badge-jasa     {background:#fce7f3;color:#9d174d;}
.badge-konsultan{background:#ede9fe;color:#5b21b6;}
.badge-lainnya  {background:#f3f4f6;color:#374151;}
.badge-pdn      {background:#d1fae5;color:#065f46;}
.badge-uk       {background:#fef3c7;color:#92400e;}

/* ── Pagination ── */
.pagination-wrap{
  display:flex;align-items:center;justify-content:space-between;
  padding:10px 14px;border-top:1px solid #e5e7eb;flex-wrap:wrap;gap:8px;
}
.pagination-info{font-size:.78rem;color:#6b7280;}
.pagination-btns{display:flex;gap:3px;flex-wrap:wrap;}
.page-btn{
  padding:4px 9px;border:1px solid #d1d5db;background:white;
  border-radius:5px;font-size:.75rem;cursor:pointer;transition:all .12s;
}
.page-btn:hover:not(:disabled){background:#eff6ff;border-color:#2563eb;color:#2563eb;}
.page-btn.active{background:#2563eb;color:white;border-color:#2563eb;}
.page-btn:disabled{opacity:.38;cursor:not-allowed;}

/* ── Toast ── */
#toast-container{position:fixed;bottom:20px;right:20px;z-index:9999;display:flex;flex-direction:column;gap:7px;}
.toast{
  padding:9px 15px;border-radius:8px;font-size:.8rem;font-weight:500;color:white;
  box-shadow:0 4px 12px rgba(0,0,0,.15);animation:slideIn .28s ease;max-width:300px;
}
.toast-info   {background:#2563eb;}
.toast-success{background:#10b981;}
.toast-warning{background:#f59e0b;}
.toast-error  {background:#ef4444;}
@keyframes slideIn{from{transform:translateX(110%);opacity:0}to{transform:translateX(0);opacity:1}}

/* ── Empty state ── */
.empty-state{text-align:center;padding:50px 20px;color:#9ca3af;}
.empty-state .icon{font-size:2.8rem;margin-bottom:10px;}
.empty-state p{font-size:.88rem;}

/* ── Spinner ── */
.loading-spinner{
  display:inline-block;width:16px;height:16px;
  border:2px solid rgba(255,255,255,.4);border-top-color:white;
  border-radius:50%;animation:spin .65s linear infinite;
  vertical-align:middle;margin-right:5px;
}
@keyframes spin{to{transform:rotate(360deg)}}

/* ── Modal ── */
.modal-overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.5);
  backdrop-filter:blur(4px);z-index:9000;
  display:flex;align-items:center;justify-content:center;padding:16px;
  opacity:0;transition:opacity .22s ease;
}
.modal-overlay.visible{opacity:1;}
.modal-overlay.visible .modal-box{transform:translateY(0);opacity:1;}
.modal-box{
  background:white;border-radius:14px;width:100%;max-width:580px;max-height:88vh;
  display:flex;flex-direction:column;
  box-shadow:0 20px 50px rgba(0,0,0,.28);
  transform:translateY(20px);opacity:0;
  transition:transform .22s ease,opacity .22s ease;overflow:hidden;
}
.modal-box-wide{max-width:700px;}
.modal-header{display:flex;align-items:center;gap:12px;padding:18px 22px;color:white;flex-shrink:0;}
.modal-header-icon{font-size:1.8rem;line-height:1;}
.modal-header-text{flex:1;min-width:0;}
.modal-title  {font-size:1rem;font-weight:700;}
.modal-subtitle{font-size:.75rem;opacity:.8;margin-top:2px;}
.modal-close{
  background:rgba(255,255,255,.2);border:none;color:white;
  width:30px;height:30px;border-radius:50%;font-size:.95rem;cursor:pointer;
  display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .18s;
}
.modal-close:hover{background:rgba(255,255,255,.35);}
.modal-body  {padding:20px 22px;overflow-y:auto;flex:1;}
.modal-footer{padding:14px 22px;border-top:1px solid #e5e7eb;display:flex;gap:8px;justify-content:flex-end;flex-shrink:0;}

/* ── Row detail ── */
.detail-paket-name{font-size:.95rem;font-weight:600;color:#1a3c6e;margin-bottom:14px;line-height:1.5;}
.detail-paket-name a{color:#2563eb;text-decoration:none;}
.detail-paket-name a:hover{text-decoration:underline;}
.detail-pagu-hero{
  background:linear-gradient(135deg,#f0fdf4,#dcfce7);
  border:1px solid #bbf7d0;border-radius:10px;
  padding:14px 18px;margin-bottom:14px;text-align:center;
}
.detail-pagu-label{font-size:.68rem;color:#6b7280;text-transform:uppercase;letter-spacing:.5px;}
.detail-pagu-value{font-size:1.7rem;font-weight:800;color:#065f46;margin-top:3px;}
.detail-badges{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:16px;}
.detail-badges .badge{font-size:.75rem;padding:3px 10px;}
.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.detail-item{
  display:flex;align-items:flex-start;gap:9px;
  background:#f9fafb;border-radius:9px;padding:10px 12px;border:1px solid #f3f4f6;
}
.detail-item-label{font-size:.65rem;color:#9ca3af;text-transform:uppercase;letter-spacing:.4px;margin-bottom:2px;}
.detail-item-value{font-size:.8rem;color:#111827;font-weight:500;line-height:1.4;}

/* ── Chart detail popup ── */
.cd-list{display:flex;flex-direction:column;gap:12px;}
.cd-row{background:#f9fafb;border-radius:9px;padding:12px 14px;border:1px solid #f3f4f6;}
.cd-row-top{display:flex;align-items:center;gap:9px;margin-bottom:7px;}
.cd-dot{width:11px;height:11px;border-radius:50%;flex-shrink:0;}
.cd-label{flex:1;font-size:.82rem;font-weight:600;color:#111827;}
.cd-count{font-size:.77rem;color:#6b7280;white-space:nowrap;}
.cd-bar-wrap{background:#e5e7eb;border-radius:4px;height:5px;overflow:hidden;margin-bottom:5px;}
.cd-bar-fill{height:100%;border-radius:4px;transition:width .55s ease;}
.cd-row-meta{display:flex;justify-content:space-between;font-size:.72rem;}
.cd-pct {color:#6b7280;}
.cd-pagu{color:#065f46;font-weight:600;}

.clickable-row:hover{background:#eff6ff;cursor:pointer;}

/* ── Detail item icons ── */
.detail-item-ico{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:38px;height:34px;border-radius:7px;
  font-size:.6rem;font-weight:800;letter-spacing:.3px;flex-shrink:0;margin-top:1px;
}
.ico-blue   {background:#dbeafe;color:#1d4ed8;}
.ico-purple {background:#ede9fe;color:#5b21b6;}
.ico-red    {background:#fee2e2;color:#b91c1c;}
.ico-gray   {background:#f3f4f6;color:#374151;}
.ico-teal   {background:#ccfbf1;color:#0f766e;}
.ico-green  {background:#dcfce7;color:#15803d;}
.ico-emerald{background:#d1fae5;color:#065f46;}
.ico-amber  {background:#fef3c7;color:#92400e;}

/* ═══════════════════════════════════════════════════════
   MOBILE  ≤ 768px  —  scroll normal, tanpa bottom nav
═══════════════════════════════════════════════════════ */
@media (max-width:768px){

  body{overflow-x:hidden;}

  /* ── Header: 2 baris di mobile ── */
  .header{
    height:auto;
    min-height:auto;
    padding:8px 12px;
    flex-direction:column;
    align-items:stretch;
    gap:6px;
  }
  .header-left{
    display:flex;
    align-items:center;
    min-width:0;
    flex:none;
  }
  .header h1{
    font-size:.85rem;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .header .subtitle{display:none;}

  /* Header-right: tombol mengalir dalam baris, wrap jika perlu */
  .header-right{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:5px;
    overflow:visible;
    padding-bottom:0;
    flex-shrink:0;
    width:100%;
  }
  .header-right::-webkit-scrollbar{display:none;}

  /* Sembunyikan elemen yang tidak perlu di mobile */
  .status-badge{display:none;}
  #btn-install-pwa{display:none!important;}

  /* Tombol header lebih kecil dan proporsional */
  .btn-install{
    padding:4px 9px;
    font-size:0.7rem;
    border-radius:6px;
    gap:3px;
    flex-shrink:0;
  }

  /* ── Container ── */
  .container{padding:10px 10px 20px;}

  /* ── Filter ── */
  .filter-panel{border-radius:10px;padding:12px 10px;margin-bottom:10px;}
  .filter-panel h3{font-size:.82rem;margin-bottom:8px;}
  .filter-grid{grid-template-columns:1fr 1fr;gap:6px;}
  .filter-grid input,
  .filter-grid select{font-size:.76rem;padding:7px 7px;}
  .filter-actions{gap:5px;margin-top:8px;flex-wrap:wrap;}
  .btn{padding:7px 11px;font-size:.76rem;}

  /* ── Progress ── */
  .progress-wrap{padding:10px 12px;margin-bottom:10px;}

  /* ── Stats — 2 kolom ── */
  .stats-bar{grid-template-columns:1fr 1fr;gap:8px;margin-bottom:10px;}
  .stat-card{padding:10px 10px;gap:8px;border-radius:9px;border-left-width:3px;}
  .stat-icon{font-size:1.5rem;}
  .stat-card .value{font-size:1rem;}
  .stat-card .label{font-size:.6rem;}

  /* ── Charts — 1 kolom ── */
  .charts-section{grid-template-columns:1fr;gap:10px;margin-bottom:10px;}
  .chart-card{padding:12px 10px;border-radius:10px;overflow:visible;}
  .chart-header{margin-bottom:8px;padding-bottom:7px;}
  .chart-header h3{font-size:.8rem;}
  .chart-container{height:180px;}
  .chart-container-tall{height:260px;}
  .chart-container-lokasi{height:460px;}
  .chart-card-wide .chart-container{height:180px;}

  /* ── Table ── */
  .table-wrapper{border-radius:10px;}
  .table-scroll{overflow-x:auto;max-height:none;-webkit-overflow-scrolling:touch;}
  .table-toolbar{padding:8px 10px;gap:6px;}
  .left-actions,.right-actions{gap:6px;}
  table{font-size:.73rem;}
  thead th{padding:7px 8px;}
  tbody td{padding:6px 8px;}

  /* ── Pagination ── */
  .pagination-wrap{padding:8px 10px;flex-direction:column;align-items:flex-start;gap:6px;}
  .pagination-btns{flex-wrap:wrap;gap:3px;}
  .page-btn{padding:5px 8px;font-size:.72rem;}

  /* ── Toast ── */
  #toast-container{bottom:16px;right:10px;left:10px;}
  .toast{max-width:100%;font-size:.76rem;}

  /* ── Modal — slide up ── */
  .modal-overlay{padding:0;align-items:flex-end;}
  .modal-box{
    max-width:100%;width:100%;
    max-height:90dvh;
    border-radius:16px 16px 0 0;
    transform:translateY(30px);
  }
  .modal-body  {padding:14px 14px;}
  .modal-header{padding:12px 14px;}
  .modal-footer{padding:10px 14px;}
  .detail-grid {grid-template-columns:1fr;gap:8px;}
  .detail-pagu-value{font-size:1.4rem;}
}

@media (max-width:400px){
  .filter-grid{grid-template-columns:1fr;}
  .stats-bar  {grid-template-columns:1fr 1fr;}
  .header h1  {font-size:.78rem;}
  .btn-install{font-size:0.65rem;padding:4px 7px;}
}

/* ── Header nav buttons: sembunyikan di mobile (sudah ada di bottom nav) ── */
@media (max-width: 768px) {
  .header-nav-btn { display: none !important; }
  .header-logout-btn { display: none !important; }
  /* Hapus margin-left inline pada tombol header di mobile */
  .header-right .btn-install { margin-left: 0 !important; }
}

/* ═══════════════════════════════════════════════════════
   MOBILE BOTTOM NAV  (hanya tampil di ≤ 768px)
═══════════════════════════════════════════════════════ */
.mobile-nav { display: none; }

@media (max-width: 768px) {

  /* Beri ruang di bawah konten agar tidak tertutup nav */
  .container { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    z-index: 500;
    overflow: hidden;
  }

  .mnav-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #9ca3af;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    padding: 7px 2px 5px;
    position: relative;
    transition: color 0.18s;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    overflow: hidden;
  }

  .mnav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    transition: background 0.18s, transform 0.18s;
    flex-shrink: 0;
  }

  .mnav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    transition: stroke 0.18s;
  }

  .mnav-label {
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Active state */
  .mnav-item.active { color: #2563eb; }

  .mnav-item.active .mnav-icon {
    background: #eff6ff;
    transform: translateY(-2px);
  }

  /* Indicator dot at top */
  .mnav-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 25%; right: 25%;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #2563eb);
    border-radius: 0 0 3px 3px;
  }

  /* Tap ripple */
  .mnav-item:active .mnav-icon {
    background: #e0e7ff;
    transform: scale(0.9) translateY(-1px);
  }

  /* Toast naik di atas nav */
  #toast-container {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    right: 12px; left: 12px;
  }
}

/* ═══════════════════════════════════════════════════════
   ANALISIS RISIKO
═══════════════════════════════════════════════════════ */

/* Header card */
.risk-header-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #1e1b4b, #7c3aed);
  color: white;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(124,58,237,0.25);
}
.risk-header-icon { font-size: 2.4rem; flex-shrink: 0; }
.risk-title   { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.risk-subtitle{ font-size: 0.78rem; opacity: 0.85; line-height: 1.5; }

/* Summary bar */
.risk-summary-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.risk-sum-card {
  background: white;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  border-left: 4px solid #e5e7eb;
}
.risk-sum-all    { border-left-color: #6366f1; }
.risk-sum-tinggi { border-left-color: #dc2626; }
.risk-sum-sedang { border-left-color: #d97706; }
.risk-sum-rendah { border-left-color: #16a34a; }
.risk-sum-icon { font-size: 1.8rem; flex-shrink: 0; }
.risk-sum-label{ font-size: 0.68rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.risk-sum-val  { font-size: 1.5rem; font-weight: 700; color: #1a3c6e; }

/* Risk badges */
.risk-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.risk-badge.risk-tinggi { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.risk-badge.risk-sedang { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.risk-badge.risk-rendah { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* Indikator tags */
.risk-ind-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: help;
  margin: 1px;
}

/* Filter buttons */
.risk-filter-btn {
  padding: 5px 14px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  color: #374151;
}
.risk-filter-btn:hover { background: #f3f4f6; }
.risk-filter-btn.active { background: #1a3c6e; color: white; border-color: #1a3c6e; }

/* Detail modal */
.risk-detail-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.risk-detail-item {
  background: #fafafa;
  border-radius: 8px;
  padding: 12px 14px;
  border-left: 4px solid #e5e7eb;
}
.risk-detail-kode  { font-size: 0.82rem; font-weight: 700; margin-bottom: 4px; }
.risk-detail-desc  { font-size: 0.78rem; color: #374151; margin-bottom: 6px; line-height: 1.5; }
.risk-detail-temuan{ font-size: 0.78rem; color: #6b7280; font-style: italic; margin-bottom: 6px; }
.risk-detail-dasar {
  font-size: 0.75rem; color: #5b21b6; background: #f5f3ff;
  border-radius: 6px; padding: 6px 10px; margin-top: 6px;
  line-height: 1.55; margin-bottom: 6px;
}
.btn-lihat-paket {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 6px 14px;
  background: #7c3aed; color: white;
  border: none; border-radius: 7px;
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer; transition: background 0.18s;
}
.btn-lihat-paket:hover { background: #6d28d9; }

.risk-disclaimer {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.78rem;
  color: #92400e;
  line-height: 1.6;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .risk-header-card { padding: 12px 12px; gap: 10px; }
  .risk-title   { font-size: 0.88rem; }
  .risk-subtitle{ font-size: 0.7rem; }
  .risk-header-icon { font-size: 1.6rem; }

  .risk-summary-bar { grid-template-columns: 1fr 1fr; gap: 8px; }
  .risk-sum-card { padding: 10px 10px; gap: 8px; border-left-width: 3px; }
  .risk-sum-val  { font-size: 1.05rem; }
  .risk-sum-label{ font-size: 0.58rem; }
  .risk-sum-icon { font-size: 1.5rem; }

  .risk-filter-btn { padding: 4px 10px; font-size: 0.72rem; }
}
@media (max-width: 400px) {
  .risk-summary-bar { grid-template-columns: 1fr 1fr; }
  .risk-sum-val { font-size: 0.95rem; }
}
