/* APK Final Interaction + Contrast Guard 2027
   Loaded last. Purpose: make buttons clickable, keep popup widgets visible,
   and prevent white-on-white / black-on-black across legacy pages. */
:root{
  --apk-radius-pill:999px;
  --apk-radius-card:24px;
  --apk-ease:cubic-bezier(.2,.8,.2,1);
}
html[data-apk-theme="light"]{
  --apk-page:#f4f8ff;
  --apk-panel:#ffffff;
  --apk-panel-2:#f8fbff;
  --apk-text:#14213d;
  --apk-muted:#5b6b89;
  --apk-line:#dce8fb;
  --apk-primary:#2457d6;
  --apk-primary-2:#7c3aed;
  --apk-secondary-bg:#edf4ff;
  --apk-secondary-text:#1e3a8a;
  --apk-danger:#dc2626;
  --apk-success:#059669;
  --apk-warning:#b45309;
  --apk-shadow:0 16px 42px rgba(30,64,175,.13);
}
html[data-apk-theme="dark"]{
  --apk-page:#0b1120;
  --apk-panel:#111827;
  --apk-panel-2:#172033;
  --apk-text:#f7fbff;
  --apk-muted:#c2cbe0;
  --apk-line:#2f3b55;
  --apk-primary:#60a5fa;
  --apk-primary-2:#a78bfa;
  --apk-secondary-bg:#243146;
  --apk-secondary-text:#f8fafc;
  --apk-danger:#fb7185;
  --apk-success:#34d399;
  --apk-warning:#fbbf24;
  --apk-shadow:0 18px 48px rgba(0,0,0,.38);
}
html,body,#app,#main,.apk-page-content{
  background:var(--apk-page)!important;
  color:var(--apk-text)!important;
  -webkit-text-fill-color:initial!important;
}
#main[style], body[style], .card[style], .card-body[style], .form-group[style], section[style], div[style]{
  color:var(--apk-text);
}
/* Kill legacy global glowing button layer that blocks clicks. */
button::before,button::after,
.button::before,.button::after,
.btn::before,.btn::after,
input[type="button"]::before,input[type="button"]::after,
input[type="submit"]::before,input[type="submit"]::after{
  content:none!important;display:none!important;pointer-events:none!important;
}
button,.btn,.button,input[type="button"],input[type="submit"],input[type="reset"],
a.btn,a.button,.apk-top-action,.apk-secondary-action,.apk-entry-open,.apk-flow-open,.apk-inline-action,.apk-action-btn,
.dataTables_wrapper .dataTables_paginate .paginate_button,.pagination .page-link{
  position:relative!important;
  inset:auto!important;
  left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
  z-index:20!important;
  pointer-events:auto!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:8px!important;
  min-width:auto!important;
  min-height:38px!important;
  height:auto!important;
  width:auto!important;
  padding:10px 16px!important;
  border-radius:var(--apk-radius-pill)!important;
  border:1px solid transparent!important;
  font-weight:800!important;
  line-height:1.1!important;
  text-decoration:none!important;
  cursor:pointer!important;
  white-space:nowrap!important;
  box-shadow:0 10px 22px rgba(37,99,235,.13)!important;
  transform:none!important;
  opacity:1!important;
  visibility:visible!important;
  transition:transform .16s var(--apk-ease), box-shadow .16s var(--apk-ease), filter .16s var(--apk-ease)!important;
}
button:hover,.btn:hover,.button:hover,input[type="button"]:hover,input[type="submit"]:hover,a.btn:hover,a.button:hover,
.apk-top-action:hover,.apk-entry-open:hover,.apk-flow-open:hover,.apk-inline-action:hover,.apk-action-btn:hover{
  transform:translateY(-1px)!important;
  filter:saturate(1.05)!important;
  text-decoration:none!important;
}
button:focus,.btn:focus,.button:focus,input[type="button"]:focus,input[type="submit"]:focus,a.btn:focus,a.button:focus,
select:focus,input:focus,textarea:focus,.select2-container--focus .select2-selection{
  outline:3px solid rgba(96,165,250,.35)!important;
  outline-offset:2px!important;
}
/* Primary/secondary/danger/success model */
button:not(.btn-light):not(.btn-secondary):not(.btn-danger):not(.btn-outline-danger):not(.btn-outline-secondary):not(.apk-entry-close):not(.close):not(.closebtn),
.btn-primary,.button.btn-primary,input[type="submit"],.apk-entry-open,.apk-primary-action,.apk-action-btn,
.detail button,.checks button,.print button{
  background:linear-gradient(135deg,#2563eb,#7c3aed)!important;
  color:#fff!important;-webkit-text-fill-color:#fff!important;
}
.apk-flow-open,.apk-top-action,.apk-secondary-action,.apk-inline-action--muted,
.btn-light,.btn-secondary,.btn-outline-secondary,.btn-outline-primary,
button[data-dismiss],button[data-bs-dismiss],.apk-btn-secondary{
  background:var(--apk-secondary-bg)!important;
  color:var(--apk-secondary-text)!important;
  -webkit-text-fill-color:var(--apk-secondary-text)!important;
  border-color:var(--apk-line)!important;
  box-shadow:none!important;
}
.btn-danger,.button.btn-danger,.btn-outline-danger,.delete button,button[name="del"],.apk-btn-danger{
  background:linear-gradient(135deg,#ef4444,#be123c)!important;
  color:#fff!important;-webkit-text-fill-color:#fff!important;
  border-color:transparent!important;
}
.btn-success,.approve button,button[name="approve"],.apk-btn-success{
  background:linear-gradient(135deg,#059669,#10b981)!important;
  color:#fff!important;-webkit-text-fill-color:#fff!important;
  border-color:transparent!important;
}
/* Close/cancel/tutup/batal buttons must never be white-on-white. */
.apk-entry-close,.close,.btn-close,.closebtn,.apk-btn-close,
button[aria-label*="Tutup"],button[aria-label*="Close"]{
  background:var(--apk-secondary-bg)!important;
  color:var(--apk-secondary-text)!important;
  -webkit-text-fill-color:var(--apk-secondary-text)!important;
  border:1px solid var(--apk-line)!important;
  box-shadow:none!important;
  width:42px!important;height:42px!important;min-width:42px!important;padding:0!important;
  border-radius:16px!important;
  font-size:24px!important;
  line-height:1!important;
}
.closebtn{float:none!important;margin-left:10px!important;vertical-align:middle!important;}
.apk-btn-cancel,button.apk-btn-cancel,input.apk-btn-cancel{
  background:var(--apk-secondary-bg)!important;
  color:var(--apk-secondary-text)!important;
  -webkit-text-fill-color:var(--apk-secondary-text)!important;
  border-color:var(--apk-line)!important;
}
/* Make top actions/toolbar always clickable above tables/cards. */
.apk-topbar,.apk-top-actions,.apk-list-toolbar,.apk-list-toolbar__actions,.apk-filter-panel{
  position:relative!important;
  z-index:120!important;
  pointer-events:auto!important;
}
.apk-list-toolbar__actions{display:flex!important;gap:12px!important;flex-wrap:wrap!important;align-items:center!important;justify-content:flex-end!important;}
.apk-entry-open,.apk-flow-open{min-height:44px!important;padding:12px 18px!important;}
.apk-flow-open[href],a.apk-flow-open{display:inline-flex!important;}
/* Panels, forms, notes, modals */
.card,.card-body,.apk-panel,.apk-list-panel,.apk-filter-panel,.apk-form-panel,.apk-entry-dialog,.modal-content,.dropdown-menu,
.apk-section-note,.alert,.swal2-popup{
  background:var(--apk-panel)!important;
  color:var(--apk-text)!important;
  -webkit-text-fill-color:initial!important;
  border-color:var(--apk-line)!important;
}
.apk-section-note,.alert-info,.alert-warning{background:var(--apk-panel-2)!important;color:var(--apk-text)!important;}
.alert-danger,.alert[style*="background-color: #f44336"]{background:#dc2626!important;color:#fff!important;-webkit-text-fill-color:#fff!important;}
label,.form-group label,.apk-filter-label,.apk-entry-kicker,h1,h2,h3,h4,h5,h6,p,small,.text-muted{
  color:var(--apk-text)!important;
}
.text-muted,small,.small,.apk-topbar p,.apk-list-toolbar p,.apk-entry-head p{color:var(--apk-muted)!important;}
input,textarea,select,.form-control,.custom-select{
  background:var(--apk-panel)!important;
  color:var(--apk-text)!important;
  -webkit-text-fill-color:var(--apk-text)!important;
  border:1px solid var(--apk-line)!important;
  border-radius:16px!important;
  min-height:44px!important;
  box-shadow:none!important;
}
textarea.form-control{min-height:96px!important;}
input::placeholder,textarea::placeholder{color:var(--apk-muted)!important;-webkit-text-fill-color:var(--apk-muted)!important;opacity:1!important;}
input[readonly],textarea[readonly],select[readonly],.form-control[readonly]{background:var(--apk-panel-2)!important;color:var(--apk-text)!important;}
/* Select2: visible text, dropdown below active field, high z-index. */
.select2-container{z-index:220000!important;max-width:100%!important;}
.select2-container .select2-selection{
  background:var(--apk-panel)!important;
  color:var(--apk-text)!important;
  border:1px solid var(--apk-line)!important;
  border-radius:16px!important;
  min-height:44px!important;
  display:flex!important;align-items:center!important;
}
.select2-container .select2-selection__rendered,
.select2-container .select2-selection__placeholder,
.select2-container .select2-selection__choice,
.select2-search__field{
  color:var(--apk-text)!important;
  -webkit-text-fill-color:var(--apk-text)!important;
}
.select2-container .select2-selection__placeholder{color:var(--apk-muted)!important;-webkit-text-fill-color:var(--apk-muted)!important;}
.select2-dropdown,.select2-container--open .select2-dropdown{
  z-index:2147483500!important;
  background:var(--apk-panel)!important;
  color:var(--apk-text)!important;
  border:1px solid var(--apk-line)!important;
  border-radius:18px!important;
  box-shadow:0 24px 80px rgba(0,0,0,.28)!important;
  overflow:hidden!important;
}
.select2-search--dropdown{background:var(--apk-panel)!important;padding:10px!important;}
.select2-search--dropdown .select2-search__field{background:var(--apk-panel-2)!important;color:var(--apk-text)!important;border-color:var(--apk-line)!important;border-radius:12px!important;}
.select2-results__option{background:var(--apk-panel)!important;color:var(--apk-text)!important;-webkit-text-fill-color:var(--apk-text)!important;padding:10px 12px!important;}
.select2-results__option--highlighted,.select2-results__option[aria-selected="true"]{background:linear-gradient(135deg,#2563eb,#7c3aed)!important;color:#fff!important;-webkit-text-fill-color:#fff!important;}
body.apk-select2-fixed-open .select2-container--open .select2-dropdown{position:fixed!important;}
/* Date picker contrast */
.Zebra_DatePicker,.Zebra_DatePicker *{background:var(--apk-panel)!important;color:var(--apk-text)!important;-webkit-text-fill-color:var(--apk-text)!important;border-color:var(--apk-line)!important;}
.Zebra_DatePicker td.dp_selected,.Zebra_DatePicker td.dp_current{background:linear-gradient(135deg,#2563eb,#7c3aed)!important;color:#fff!important;-webkit-text-fill-color:#fff!important;}
/* Tables and pagination */
.table,table,table.dataTable,.dataTables_wrapper{background:var(--apk-panel)!important;color:var(--apk-text)!important;}
table thead th,.table thead th,table.dataTable thead th{background:linear-gradient(135deg,#eef5ff,#f8f5ff)!important;color:#14213d!important;-webkit-text-fill-color:#14213d!important;border-color:var(--apk-line)!important;}
html[data-apk-theme="dark"] table thead th,html[data-apk-theme="dark"] .table thead th,html[data-apk-theme="dark"] table.dataTable thead th{background:#1f2a44!important;color:#f8fafc!important;-webkit-text-fill-color:#f8fafc!important;}
table tbody tr,table.dataTable tbody tr,.table tbody tr{background:var(--apk-panel)!important;color:var(--apk-text)!important;}
table tbody tr:nth-child(even),table.dataTable tbody tr.even,.table-striped tbody tr:nth-of-type(even){background:var(--apk-panel-2)!important;}
table tbody td,table tbody th,table.dataTable tbody td,.table td,.table th{color:var(--apk-text)!important;-webkit-text-fill-color:var(--apk-text)!important;border-color:var(--apk-line)!important;}
.dataTables_info,.dataTables_length label,.dataTables_filter label{color:var(--apk-muted)!important;}
.dataTables_paginate{display:flex!important;gap:6px!important;align-items:center!important;justify-content:flex-end!important;flex-wrap:wrap!important;margin-top:14px!important;}
.dataTables_wrapper .dataTables_paginate .paginate_button,.pagination .page-link{
  background:var(--apk-panel)!important;color:var(--apk-text)!important;-webkit-text-fill-color:var(--apk-text)!important;border:1px solid var(--apk-line)!important;box-shadow:none!important;min-width:40px!important;min-height:40px!important;padding:10px 14px!important;margin:2px!important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,.pagination .active .page-link{
  background:linear-gradient(135deg,#2563eb,#7c3aed)!important;color:#fff!important;-webkit-text-fill-color:#fff!important;border-color:transparent!important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled{opacity:.52!important;pointer-events:none!important;}
/* Modal stack and mobile */
.apk-entry-modal{position:fixed!important;inset:0!important;z-index:2147482000!important;display:none!important;align-items:center!important;justify-content:center!important;padding:24px!important;pointer-events:none!important;}
.apk-entry-modal.is-open{display:flex!important;opacity:1!important;visibility:visible!important;pointer-events:auto!important;}
.apk-entry-backdrop{position:absolute!important;inset:0!important;background:rgba(15,23,42,.52)!important;z-index:0!important;pointer-events:auto!important;}
.apk-entry-dialog{position:relative!important;z-index:2!important;width:min(1040px,calc(100vw - 32px))!important;max-height:calc(100vh - 42px)!important;overflow:auto!important;border-radius:28px!important;box-shadow:0 30px 90px rgba(0,0,0,.34)!important;pointer-events:auto!important;}
@media(max-width:768px){
  .apk-entry-modal{padding:0!important;align-items:stretch!important;justify-content:stretch!important;}
  .apk-entry-dialog{width:100vw!important;max-height:100vh!important;height:100vh!important;border-radius:0!important;}
  .apk-list-toolbar__actions{width:100%!important;justify-content:stretch!important;}
  .apk-entry-open,.apk-flow-open{flex:1 1 100%!important;width:100%!important;}
  .dataTables_paginate{justify-content:flex-start!important;overflow-x:auto!important;flex-wrap:nowrap!important;padding-bottom:6px!important;}
}
