/* NSG Kho Phần Mềm — © SONAI */
.nsg-kpm{
  --k-frame:#B2EBF2; --k-frame-bd:#8FD6E0; --k-card-bd:#A7DCE5; --k-title:#1F2A33; --k-line:#E0A82E;
  --k-label:#2C6E78; --k-btn:#2B1D0E; --k-btn-tx:#F5C04A; --k-btn-h:#3D2A14; --k-cream:#FFF8EC; --k-cream-bd:#EBD9B4;
  --k-text:#334155; --k-muted:#64748B; --k-ph1:#2C6E78; --k-ph2:#1F4E57; --k-accent:#E0A82E;
  box-sizing:border-box; container-type:inline-size; padding:22px 20px 26px;
  background:var(--k-frame); border:1px solid var(--k-frame-bd); border-radius:16px;
  font-family:"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif !important; color:var(--k-text);
  font-size:15px; line-height:1.5;
}
/* thắng quy tắc bó hẹp nội dung của theme block / Astra */
.nsg-kpm.nsg-kpm:not(.nsg-kpm-modal){max-width:1280px !important; width:100% !important; margin:0 auto 24px !important}
.nsg-kpm.nsg-kpm-theme-navy{
  --k-frame:#EEF2F9; --k-frame-bd:#D6DEEC; --k-card-bd:#DCE3EF; --k-title:#14213D; --k-line:#FFC300;
  --k-label:#14213D; --k-btn:#FFC300; --k-btn-tx:#14213D; --k-btn-h:#E6AF00; --k-cream:#FFF8E1; --k-cream-bd:#F2DE9C;
  --k-ph1:#1E2F55; --k-ph2:#14213D; --k-accent:#FFC300;
}
.nsg-kpm *,.nsg-kpm *::before,.nsg-kpm *::after{box-sizing:border-box}
.nsg-kpm h2,.nsg-kpm h3,.nsg-kpm p,.nsg-kpm input,.nsg-kpm select,.nsg-kpm button,.nsg-kpm a.nsg-kpm-btn{
  font-family:"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif !important; letter-spacing:normal !important;
}
.nsg-kpm p{margin:0}

/* tiêu đề */
.nsg-kpm-head{text-align:center; margin:0 0 16px}
.nsg-kpm .nsg-kpm-title{display:inline-block; margin:0 0 6px !important; padding:0 0 6px !important;
  font-size:28px !important; line-height:1.25 !important; font-weight:800 !important; color:var(--k-title) !important;
  border-bottom:4px solid var(--k-line); text-transform:none !important}
.nsg-kpm .nsg-kpm-subtitle{font-size:15px !important; color:var(--k-text); margin:4px auto 2px; max-width:720px}
.nsg-kpm .nsg-kpm-total{font-size:13px !important; color:var(--k-label); font-weight:700; text-transform:uppercase; letter-spacing:.06em !important}

/* tìm kiếm + lọc */
.nsg-kpm-tools{display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin:0 0 16px}
.nsg-kpm-search{position:relative; flex:1 1 260px}
.nsg-kpm-search-ico{position:absolute; left:12px; top:50%; transform:translateY(-50%); font-size:15px; pointer-events:none}
.nsg-kpm .nsg-kpm-q{width:100% !important; height:44px !important; padding:0 14px 0 38px !important; margin:0 !important;
  font-size:15px !important; line-height:44px !important; color:var(--k-title) !important; background:#fff !important;
  border:1px solid #8FD3DE !important; border-radius:10px !important; box-shadow:none !important; outline:none}
.nsg-kpm-theme-navy .nsg-kpm-q,.nsg-kpm-theme-navy .nsg-kpm-sort{border-color:#C9D3E6 !important}
.nsg-kpm .nsg-kpm-q:focus,.nsg-kpm .nsg-kpm-sort:focus{border-color:var(--k-accent) !important; box-shadow:0 0 0 3px rgba(224,168,46,.25) !important}
.nsg-kpm .nsg-kpm-sort{flex:0 0 auto; height:44px !important; padding:0 12px !important; margin:0 !important; font-size:14px !important;
  color:var(--k-title) !important; background:#fff !important; border:1px solid #8FD3DE !important; border-radius:10px !important}
.nsg-kpm-tabs{display:flex; flex-wrap:wrap; gap:8px; width:100%}
.nsg-kpm button.nsg-kpm-tab,.nsg-kpm button.nsg-kpm-tab:hover,.nsg-kpm button.nsg-kpm-tab:focus{
  min-height:38px; padding:6px 16px !important; margin:0 !important; font-size:14px !important; font-weight:600 !important;
  text-transform:none !important; color:var(--k-label) !important; background:#fff !important;
  border:1px solid var(--k-card-bd) !important; border-radius:999px !important; cursor:pointer; box-shadow:none !important; line-height:1.3 !important}
.nsg-kpm button.nsg-kpm-tab:hover{border-color:var(--k-accent) !important}
.nsg-kpm button.nsg-kpm-tab.is-on,.nsg-kpm button.nsg-kpm-tab.is-on:hover,.nsg-kpm button.nsg-kpm-tab.is-on:focus{
  color:var(--k-btn-tx) !important; background:var(--k-btn) !important; border-color:var(--k-btn) !important}

/* lưới */
.nsg-kpm-grid{display:grid; gap:18px; grid-template-columns:repeat(3,minmax(0,1fr))}
.nsg-kpm-cols-1{grid-template-columns:minmax(0,1fr)}
.nsg-kpm-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.nsg-kpm-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}
/* số cột theo bề rộng THẬT của khung (không theo màn hình) */
@container (max-width:1100px){ .nsg-kpm-cols-4{grid-template-columns:repeat(3,minmax(0,1fr))} }
@container (max-width:880px){ .nsg-kpm-cols-3,.nsg-kpm-cols-4{grid-template-columns:repeat(2,minmax(0,1fr))} }
@container (max-width:560px){ .nsg-kpm-grid{grid-template-columns:minmax(0,1fr) !important} }
@media (max-width:640px){ .nsg-kpm-grid{grid-template-columns:minmax(0,1fr) !important} }

/* thẻ */
.nsg-kpm-card{display:flex; flex-direction:column; background:#fff; border:1px solid var(--k-card-bd); border-radius:14px;
  overflow:hidden; transition:transform .18s ease, box-shadow .18s ease; min-width:0}
.nsg-kpm-card:hover{transform:translateY(-3px); box-shadow:0 12px 28px rgba(31,42,51,.14)}
.nsg-kpm-card[hidden]{display:none !important}
.nsg-kpm-thumb{position:relative; aspect-ratio:16/9; background:var(--k-cream); overflow:hidden}
.nsg-kpm-thumb img{width:100% !important; height:100% !important; object-fit:cover; display:block; margin:0 !important; max-width:none !important; border-radius:0 !important}
.nsg-kpm-ph{width:100%; height:100%; display:flex; align-items:center; justify-content:center;
  background:radial-gradient(circle at 25% 20%, rgba(255,255,255,.16) 0 18%, transparent 19%),
             linear-gradient(135deg,var(--k-ph1),var(--k-ph2))}
.nsg-kpm-ph-ico{display:flex; align-items:center; justify-content:center; width:84px; height:84px; border-radius:22px;
  background:rgba(255,255,255,.12); border:2px solid var(--k-accent); color:#fff; font-size:28px; font-weight:800; letter-spacing:.02em}
.nsg-kpm-badges{position:absolute; top:10px; left:10px; display:flex; gap:6px; flex-wrap:wrap}
.nsg-kpm-badge{font-size:12px; font-weight:700; padding:3px 10px; border-radius:999px; line-height:1.4; box-shadow:0 2px 6px rgba(0,0,0,.15)}
.nsg-kpm-badge-free{background:#059669; color:#fff}
.nsg-kpm-badge-new{background:#DC2626; color:#fff}
.nsg-kpm-badge-hot{background:var(--k-accent); color:#2B1D0E}
.nsg-kpm-body{display:flex; flex-direction:column; flex:1; padding:16px 16px 16px}
.nsg-kpm .nsg-kpm-name{margin:0 0 4px !important; padding:0 !important; font-size:19px !important; line-height:1.3 !important;
  font-weight:800 !important; color:var(--k-title) !important; text-transform:none !important; border:0 !important}
.nsg-kpm .nsg-kpm-sub{font-size:14px !important; line-height:1.45 !important; color:var(--k-label) !important; font-weight:600; margin:0 0 8px !important}
.nsg-kpm .nsg-kpm-excerpt{font-size:14px !important; line-height:1.55 !important; color:var(--k-muted) !important; margin:0 0 12px !important;
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden}
.nsg-kpm-chips{display:flex; flex-wrap:wrap; gap:6px; margin:0 0 14px}
.nsg-kpm-chip{font-size:12.5px; font-weight:600; color:#5B4A2A; background:var(--k-cream); border:1px solid var(--k-cream-bd);
  padding:3px 9px; border-radius:8px; line-height:1.4; white-space:nowrap}
.nsg-kpm-actions{display:flex; flex-wrap:wrap; gap:8px; margin-top:auto}
.nsg-kpm-actions .nsg-kpm-btn-main{flex:1 1 150px !important}
.nsg-kpm-actions .nsg-kpm-btn-sub{flex:1 1 110px !important}
.nsg-kpm a.nsg-kpm-btn,.nsg-kpm button.nsg-kpm-btn{white-space:nowrap}

/* nút */
.nsg-kpm a.nsg-kpm-btn,.nsg-kpm button.nsg-kpm-btn,.nsg-kpm-modal a.nsg-kpm-btn{
  display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:10px 16px !important; margin:0 !important;
  font-size:15px !important; font-weight:700 !important; line-height:1.2 !important; text-decoration:none !important;
  text-transform:none !important; border-radius:10px !important; cursor:pointer; box-shadow:none !important; transition:background .15s, transform .1s}
.nsg-kpm a.nsg-kpm-btn-main,.nsg-kpm a.nsg-kpm-btn-main:hover,.nsg-kpm a.nsg-kpm-btn-main:focus,.nsg-kpm a.nsg-kpm-btn-main:visited{
  color:var(--k-btn-tx) !important; background:var(--k-btn) !important; border:1px solid var(--k-btn) !important}
.nsg-kpm a.nsg-kpm-btn-main:hover{background:var(--k-btn-h) !important}
.nsg-kpm a.nsg-kpm-btn:active,.nsg-kpm button.nsg-kpm-btn:active{transform:scale(.97)}
.nsg-kpm button.nsg-kpm-btn-sub,.nsg-kpm button.nsg-kpm-btn-sub:hover,.nsg-kpm button.nsg-kpm-btn-sub:focus{
  color:var(--k-label) !important; background:#fff !important; border:1px solid var(--k-card-bd) !important}
.nsg-kpm button.nsg-kpm-btn-sub:hover{border-color:var(--k-accent) !important}
.nsg-kpm a.nsg-kpm-btn-big{width:100%; min-height:52px; font-size:17px !important; margin:4px 0 0 !important}
.nsg-kpm .nsg-kpm-note{font-size:13px !important; color:var(--k-muted) !important; margin:10px 0 0 !important; line-height:1.5 !important}
.nsg-kpm .nsg-kpm-empty{text-align:center; padding:30px 10px; font-size:15px !important; color:var(--k-muted)}
.nsg-kpm .nsg-kpm-empty[hidden]{display:none}
.nsg-kpm-admin-note{background:#FEF2F2; border:1px solid #FCA5A5; color:#991B1B; padding:10px 14px; border-radius:10px; font-size:14px; margin:0 0 12px}

/* chi tiết (cửa sổ + trang 1 phần mềm) */
.nsg-kpm-detail-top{display:grid; grid-template-columns:minmax(0,1.1fr) minmax(0,1fr); gap:20px; align-items:start}
.nsg-kpm-detail-top .nsg-kpm-thumb{border-radius:12px; border:1px solid var(--k-card-bd)}
.nsg-kpm-detail-info .nsg-kpm-name{font-size:24px !important}
.nsg-kpm-desc{margin-top:20px; padding:18px 20px; background:#fff; border:1px solid var(--k-card-bd); border-radius:12px;
  font-size:15px; line-height:1.65; color:var(--k-text)}
.nsg-kpm-desc h1,.nsg-kpm-desc h2,.nsg-kpm-desc h3,.nsg-kpm-desc h4{font-size:18px !important; line-height:1.35 !important; color:var(--k-title) !important;
  margin:18px 0 8px !important; padding:0 0 4px !important; border-bottom:2px solid var(--k-line); display:inline-block; font-weight:800 !important}
.nsg-kpm-desc h1:first-child,.nsg-kpm-desc h2:first-child,.nsg-kpm-desc h3:first-child{margin-top:0 !important}
.nsg-kpm-desc p{margin:0 0 10px !important; font-size:15px !important}
.nsg-kpm-desc ul,.nsg-kpm-desc ol{margin:0 0 12px 22px !important; padding:0 !important}
.nsg-kpm-desc li{margin:0 0 5px; font-size:15px}
.nsg-kpm-desc a{color:var(--k-label); font-weight:600}
.nsg-kpm-single{background:var(--k-frame)}
@media (max-width:760px){ .nsg-kpm-detail-top{grid-template-columns:minmax(0,1fr)} }

/* cửa sổ */
.nsg-kpm-modal{position:fixed; inset:0; z-index:999999; display:flex; align-items:flex-start; justify-content:center;
  padding:calc(24px + env(safe-area-inset-top)) 14px 24px; background:rgba(15,23,42,.6); overflow-y:auto;
  max-width:none !important; margin:0 !important; border:0 !important; border-radius:0 !important; animation:nsgKpmFade .15s ease}
.nsg-kpm-modal .nsg-kpm-box{position:relative; width:100%; max-width:920px; background:var(--k-frame); border:1px solid var(--k-frame-bd);
  border-radius:16px; padding:22px; box-shadow:0 20px 60px rgba(0,0,0,.35)}
.nsg-kpm-modal button.nsg-kpm-close,.nsg-kpm-modal button.nsg-kpm-close:hover,.nsg-kpm-modal button.nsg-kpm-close:focus{
  position:absolute; top:10px; right:10px; width:44px; height:44px; padding:0 !important; margin:0 !important; border-radius:50% !important;
  background:#fff !important; color:var(--k-title) !important; border:1px solid var(--k-card-bd) !important; font-size:22px !important;
  line-height:1 !important; cursor:pointer; z-index:2; box-shadow:none !important; text-transform:none !important}
.nsg-kpm-modal .nsg-kpm-detail-info{padding-right:40px}
@keyframes nsgKpmFade{from{opacity:0}to{opacity:1}}
body.nsg-kpm-lock{overflow:hidden}

@media (max-width:640px){
  .nsg-kpm{padding:16px 12px 18px; border-radius:14px}
  .nsg-kpm .nsg-kpm-title{font-size:22px !important}
  .nsg-kpm-sort{flex:1 1 100% !important; width:100%}
  .nsg-kpm-tabs{flex-wrap:nowrap; overflow-x:auto; padding-bottom:4px; -webkit-overflow-scrolling:touch}
  .nsg-kpm button.nsg-kpm-tab{flex:0 0 auto; white-space:nowrap}
  .nsg-kpm-modal{padding:10px 8px}
  .nsg-kpm-modal .nsg-kpm-box{padding:16px 14px}
  .nsg-kpm-modal .nsg-kpm-detail-info{padding-right:0}
  .nsg-kpm-desc{padding:14px}
}

/* ---- chế độ toàn màn hình : ẩn header/footer ---- */
body.nsg-fullscreen #masthead, body.nsg-fullscreen .site-header, body.nsg-fullscreen .ast-above-header-wrap,
body.nsg-fullscreen .ast-below-header-wrap, body.nsg-fullscreen .ast-mobile-header-wrap, body.nsg-fullscreen #colophon,
body.nsg-fullscreen .site-footer, body.nsg-fullscreen .ast-small-footer, body.nsg-fullscreen .entry-header,
body.nsg-fullscreen .ast-breadcrumbs-wrapper, body.nsg-fullscreen #secondary, body.nsg-fullscreen .widget-area,
body.nsg-fullscreen header.wp-block-template-part, body.nsg-fullscreen footer.wp-block-template-part,
body.nsg-fullscreen .wp-block-post-title, body.nsg-fullscreen #ast-scroll-top { display:none !important; }
body.nsg-fullscreen, body.nsg-fullscreen #page, body.nsg-fullscreen #content, body.nsg-fullscreen .site-content,
body.nsg-fullscreen .ast-separate-container, body.nsg-fullscreen .wp-site-blocks, body.nsg-fullscreen .entry-content { background:#fff !important; }
body.nsg-fullscreen .site-content, body.nsg-fullscreen .ast-container, body.nsg-fullscreen #primary,
body.nsg-fullscreen .entry-content, body.nsg-fullscreen .wp-site-blocks > main, body.nsg-fullscreen .wp-site-blocks {
  margin:0 !important; padding:0 !important; max-width:100% !important; width:100% !important; }
body.nsg-fullscreen .alignfull { margin-left:0 !important; margin-right:0 !important; }
body.nsg-fullscreen .has-global-padding { padding-left:0 !important; padding-right:0 !important; }
body.nsg-fullscreen { overflow-x:hidden; }
body.nsg-fullscreen .nsg-kpm { max-width:1280px !important; width:calc(100% - 24px) !important; margin:calc(12px + env(safe-area-inset-top)) auto 24px !important; }
.nsg-kpm-card .nsg-kpm-thumb,.nsg-kpm-card .nsg-kpm-name{cursor:pointer}

/* ---- 1.1 : Xem thêm, trạng thái tải, số lượng trên nút lọc ---- */
.nsg-kpm .nsg-kpm-n{display:inline-block; min-width:22px; margin-left:4px; padding:0 6px; border-radius:999px; font-size:12px; line-height:20px;
  background:var(--k-cream); color:#5B4A2A; text-align:center}
.nsg-kpm button.nsg-kpm-tab.is-on .nsg-kpm-n{background:rgba(255,255,255,.18); color:inherit}
.nsg-kpm .nsg-kpm-status{margin:0 0 10px !important; font-size:14px !important; font-weight:600; color:var(--k-label) !important}
.nsg-kpm .nsg-kpm-status:empty{display:none}
.nsg-kpm.is-loading .nsg-kpm-grid{opacity:.45; pointer-events:none; transition:opacity .15s}
.nsg-kpm-more-wrap{text-align:center; margin-top:20px}
.nsg-kpm-more-wrap[hidden]{display:none !important}
.nsg-kpm button.nsg-kpm-more,.nsg-kpm button.nsg-kpm-more:hover,.nsg-kpm button.nsg-kpm-more:focus{
  min-width:260px; min-height:48px; color:var(--k-btn-tx) !important; background:var(--k-btn) !important;
  border:1px solid var(--k-btn) !important; border-radius:999px !important; font-size:16px !important}
.nsg-kpm button.nsg-kpm-more:hover{background:var(--k-btn-h) !important}
.nsg-kpm button.nsg-kpm-more:disabled{opacity:.7; cursor:wait}
.nsg-kpm .nsg-kpm-shown{margin:8px 0 0 !important; font-size:13px !important; color:var(--k-muted) !important}
.nsg-kpm-card.nsg-kpm-flash{animation:nsgKpmFlash 1.6s ease}
@keyframes nsgKpmFlash{0%{box-shadow:0 0 0 4px var(--k-accent)}100%{box-shadow:0 0 0 0 transparent}}
@media (max-width:640px){ .nsg-kpm button.nsg-kpm-more{width:100%; min-width:0} }
