/* Lightweight language + day/night controls for NAS Market.
   No third-party framework is required; the early head script applies the theme
   before page CSS is painted to avoid flashing. */
.nm-ui-switcher{
  position:fixed;
  top:10px;
  right:10px;
  z-index:50000;
  display:flex;
  align-items:center;
  gap:8px;
  font-family:Arial,"Microsoft YaHei",sans-serif;
  pointer-events:auto;
}
.nm-lang-wrap{position:relative;display:inline-flex}
.nm-ui-btn{
  width:38px;
  height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(17,24,39,.18);
  border-radius:6px;
  background:rgba(255,255,255,.92);
  color:#111827;
  box-shadow:0 8px 24px rgba(15,23,42,.08);
  cursor:pointer;
  outline:none;
  transition:background .18s ease,color .18s ease,border-color .18s ease,transform .18s ease,box-shadow .18s ease;
  -webkit-tap-highlight-color:transparent;
}
.nm-ui-btn:hover{background:#f3f4f6;transform:translateY(-1px);box-shadow:0 12px 26px rgba(15,23,42,.12)}
.nm-ui-btn:focus-visible{box-shadow:0 0 0 3px rgba(59,130,246,.32),0 8px 24px rgba(15,23,42,.08)}
.nm-icon{width:18px;height:18px;display:block;flex:0 0 auto}
.nm-theme-btn{position:relative;overflow:hidden}
.nm-theme-btn .nm-icon{position:absolute;transition:transform .22s ease,opacity .22s ease}
.nm-theme-btn .nm-icon-sun{opacity:1;transform:scale(1) rotate(0)}
.nm-theme-btn .nm-icon-moon{opacity:0;transform:scale(.2) rotate(90deg)}
html.nm-theme-dark .nm-theme-btn .nm-icon-sun{opacity:0;transform:scale(.2) rotate(-90deg)}
html.nm-theme-dark .nm-theme-btn .nm-icon-moon{opacity:1;transform:scale(1) rotate(0)}
.nm-lang-menu{
  position:absolute;
  top:44px;
  right:0;
  display:none;
  min-width:138px;
  padding:6px;
  border:1px solid rgba(17,24,39,.14);
  border-radius:10px;
  background:rgba(255,255,255,.98);
  color:#111827;
  box-shadow:0 18px 38px rgba(15,23,42,.18);
}
.nm-lang-wrap.nm-open .nm-lang-menu{display:block}
.nm-lang-menu button{
  width:100%;
  min-height:34px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:6px 9px;
  border:0;
  border-radius:7px;
  background:transparent;
  color:inherit;
  font-size:13px;
  line-height:1.2;
  text-align:left;
  cursor:pointer;
}
.nm-lang-menu button:hover{background:#f3f4f6}
.nm-lang-menu strong{display:none;color:#2563eb;font-size:13px}
html[data-nm-lang="zh-CN"] [data-nm-lang-check="zh-CN"],
html[data-nm-lang="en-US"] [data-nm-lang-check="en-US"]{display:inline}
html.nm-theme-dark{
  --bg:#0f172a;
  --card:#111827;
  --text:#e5e7eb;
  --ink:#e5e7eb;
  --muted:#9ca3af;
  --line:#374151;
  --dark:#2563eb;
  --btn:#2563eb;
  color-scheme:dark;
}
html.nm-theme-dark body{
  background:var(--bg)!important;
  color:var(--text)!important;
}
html.nm-theme-dark .nm-ui-btn{
  background:rgba(17,24,39,.92);
  color:#f9fafb;
  border-color:rgba(255,255,255,.18);
  box-shadow:0 10px 28px rgba(0,0,0,.30);
}
html.nm-theme-dark .nm-ui-btn:hover{background:#1f2937;box-shadow:0 12px 30px rgba(0,0,0,.38)}
html.nm-theme-dark .nm-lang-menu{background:#111827;color:#f9fafb;border-color:#374151;box-shadow:0 18px 40px rgba(0,0,0,.55)}
html.nm-theme-dark .nm-lang-menu button:hover{background:#1f2937}
html.nm-theme-dark .page,
html.nm-theme-dark .wrap,
html.nm-theme-dark .shell,
html.nm-theme-dark .box,
html.nm-theme-dark .card,
html.nm-theme-dark .seo-summary,
html.nm-theme-dark .seo-intro,
html.nm-theme-dark .seo-detail-text,
html.nm-theme-dark .top,
html.nm-theme-dark .preview,
html.nm-theme-dark .paybox,
html.nm-theme-dark .modal,
html.nm-theme-dark .loading-card,
html.nm-theme-dark .archive-card,
html.nm-theme-dark .textbox,
html.nm-theme-dark .group,
html.nm-theme-dark .switchcard,
html.nm-theme-dark .summary-box,
html.nm-theme-dark .hot-rank-panel,
html.nm-theme-dark .job-card,
html.nm-theme-dark .job-row,
html.nm-theme-dark .nas-panel{
  background:var(--card)!important;
  color:var(--text)!important;
  border-color:var(--line)!important;
}
html.nm-theme-dark .home-sticky-stack,
html.nm-theme-dark .admin-sticky-header{
  background:rgba(15,23,42,.94)!important;
  border-color:var(--line)!important;
}
html.nm-theme-dark h1,
html.nm-theme-dark h2,
html.nm-theme-dark h3,
html.nm-theme-dark h4,
html.nm-theme-dark .site-title,
html.nm-theme-dark .section-title,
html.nm-theme-dark .title,
html.nm-theme-dark .detail-summary h1,
html.nm-theme-dark .seo-detail-text h2,
html.nm-theme-dark th,
html.nm-theme-dark .header,
html.nm-theme-dark .setting-title,
html.nm-theme-dark .summary-label,
html.nm-theme-dark .job-title{
  color:#f9fafb!important;
}
html.nm-theme-dark p,
html.nm-theme-dark .muted,
html.nm-theme-dark .help,
html.nm-theme-dark .small,
html.nm-theme-dark .seo-introline,
html.nm-theme-dark .seo-intro p,
html.nm-theme-dark .intro,
html.nm-theme-dark .detail-summary,
html.nm-theme-dark .detail-summary p,
html.nm-theme-dark .desc1,
html.nm-theme-dark .desc2,
html.nm-theme-dark .meta,
html.nm-theme-dark .download-mini,
html.nm-theme-dark .section-count,
html.nm-theme-dark .page-summary,
html.nm-theme-dark .notice,
html.nm-theme-dark .tip,
html.nm-theme-dark .setting-desc,
html.nm-theme-dark .job-meta,
html.nm-theme-dark .seo-footer,
html.nm-theme-dark .footer,
html.nm-theme-dark .count,
html.nm-theme-dark .archive-list,
html.nm-theme-dark .archive-caption,
html.nm-theme-dark .archive-empty{
  color:var(--muted)!important;
}
html.nm-theme-dark a,
html.nm-theme-dark .back,
html.nm-theme-dark .links a,
html.nm-theme-dark .seo-footer a,
html.nm-theme-dark .footer a,
html.nm-theme-dark .seo-chip,
html.nm-theme-dark .seo-label{
  color:#e5e7eb!important;
}
html.nm-theme-dark .seo-chip,
html.nm-theme-dark .category-chip,
html.nm-theme-dark .tag-chip,
html.nm-theme-dark .page-link,
html.nm-theme-dark .tag-option,
html.nm-theme-dark .searchbar,
html.nm-theme-dark .tag-toggle,
html.nm-theme-dark input,
html.nm-theme-dark textarea,
html.nm-theme-dark select,
html.nm-theme-dark .cell input,
html.nm-theme-dark .cell textarea,
html.nm-theme-dark .nas-picker-field,
html.nm-theme-dark .archive-list{
  background:#0b1220!important;
  color:#e5e7eb!important;
  border-color:var(--line)!important;
}
html.nm-theme-dark input::placeholder,
html.nm-theme-dark textarea::placeholder{color:#94a3b8!important}
html.nm-theme-dark .search-combo,
html.nm-theme-dark .tag-menu,
html.nm-theme-dark .nas-list,
html.nm-theme-dark table,
html.nm-theme-dark .table-row{
  background:#0b1220!important;
  border-color:var(--line)!important;
  color:#e5e7eb!important;
}
html.nm-theme-dark tr,
html.nm-theme-dark th,
html.nm-theme-dark td,
html.nm-theme-dark .hot-item,
html.nm-theme-dark .divider,
html.nm-theme-dark hr{border-color:var(--line)!important;background-color:transparent!important}
html.nm-theme-dark .searchbtn,
html.nm-theme-dark .paybtn,
html.nm-theme-dark a.btn,
html.nm-theme-dark button.btn,
html.nm-theme-dark button,
html.nm-theme-dark .btn,
html.nm-theme-dark .pickbtn{
  background:#2563eb!important;
  color:#fff!important;
  border-color:#2563eb!important;
}
html.nm-theme-dark button.lightbtn,
html.nm-theme-dark .lightbtn,
html.nm-theme-dark .tag-toggle,
html.nm-theme-dark .tag-option,
html.nm-theme-dark .nas-picker-field button,
html.nm-theme-dark .modal-close{
  background:#1f2937!important;
  color:#e5e7eb!important;
  border-color:var(--line)!important;
}
html.nm-theme-dark button:disabled,
html.nm-theme-dark input:disabled{opacity:.55!important}
html.nm-theme-dark .toggle span,
html.nm-theme-dark .switch .slider{background:#4b5563!important}
html.nm-theme-dark .toggle input:checked + span,
html.nm-theme-dark .switch input:checked + .slider{background:#2563eb!important}
html.nm-theme-dark .err{color:#f87171!important}
html.nm-theme-dark .warn,
html.nm-theme-dark .pay-warning{background:#422006!important;border-color:#92400e!important;color:#fde68a!important}
html.nm-theme-dark .lock{background:#450a0a!important;border-color:#991b1b!important;color:#fecaca!important}
html.nm-theme-dark .spinner{border-color:#334155!important;border-top-color:#e5e7eb!important}
html.nm-theme-dark .inline-preview-frame,
html.nm-theme-dark .page,
html.nm-theme-dark img.page,
html.nm-theme-dark .archive-img,
html.nm-theme-dark .media,
html.nm-theme-dark .pdf-frame{background:#0b1220!important;border-color:var(--line)!important}

html.nm-theme-dark .nm-lang-menu button{
  background:transparent!important;
  color:#f9fafb!important;
  border-color:transparent!important;
}
html.nm-theme-dark .nm-lang-menu button:hover{background:#1f2937!important}

body.nm-product-detail-page .nm-ui-switcher{top:auto;right:16px;bottom:16px}
@media (max-width:560px){
  .nm-ui-switcher{top:6px;right:6px;gap:6px;transform:scale(.92);transform-origin:top right}
  .nm-ui-btn{width:36px;height:36px}
  .nm-lang-menu{top:42px;right:0}
  body.nm-product-detail-page .nm-ui-switcher{top:auto;right:8px;bottom:10px;transform:scale(.90);transform-origin:bottom right}
}
@media print{.nm-ui-switcher{display:none!important}}


/* Desktop pagination dark-mode refinements. */
html.nm-theme-dark .pagination .page-link{
  background:#1f2937!important;
  color:#e5e7eb!important;
  border-color:#374151!important;
}
html.nm-theme-dark .pagination .page-link:hover{
  background:#273449!important;
  color:#fff!important;
}
html.nm-theme-dark .pagination .page-link.current{
  background:#0ea5d8!important;
  color:#fff!important;
  border-color:#0ea5d8!important;
}
html.nm-theme-dark .pagination .page-link.disabled{
  background:#111827!important;
  color:#64748b!important;
  border-color:#374151!important;
}
html.nm-theme-dark .pagination .page-jump{
  color:#9ca3af!important;
}
html.nm-theme-dark .pagination .page-jump-select{
  background:#0b1220!important;
  color:#e5e7eb!important;
  border-color:#64748b!important;
}

/* Language/theme switcher docking refinement: when controls are moved to the
   product-detail bottom-right corner, keep the footprint smaller and open the
   language menu upward so options stay visible above the viewport edge. */
.nm-ui-switcher{gap:6px}
.nm-ui-btn{width:36px;height:36px;border-radius:7px}
.nm-icon{width:17px;height:17px}
.nm-lang-menu{top:42px;max-height:calc(100vh - 62px);overflow-y:auto;overscroll-behavior:contain}
.nm-ui-switcher.nm-ui-bottom-docked{top:auto!important;right:10px!important;bottom:10px!important;gap:5px;transform:none!important;transform-origin:bottom right}
.nm-ui-switcher.nm-ui-bottom-docked .nm-ui-btn{width:34px;height:34px;border-radius:7px}
.nm-ui-switcher.nm-ui-bottom-docked .nm-icon{width:16px;height:16px}
.nm-ui-switcher.nm-ui-bottom-docked .nm-lang-menu{top:auto!important;bottom:calc(100% + 6px);right:0;max-height:240px;max-height:calc(100vh - 76px);overflow-y:auto}
@media (max-width:560px){
  .nm-ui-switcher{top:6px;right:6px;gap:5px;transform:none;transform-origin:top right}
  .nm-ui-btn{width:34px;height:34px}
  .nm-icon{width:16px;height:16px}
  .nm-lang-menu{top:40px}
  .nm-ui-switcher.nm-ui-bottom-docked{right:8px!important;bottom:8px!important;gap:4px;transform:none!important}
  .nm-ui-switcher.nm-ui-bottom-docked .nm-ui-btn{width:32px;height:32px;border-radius:7px}
  .nm-ui-switcher.nm-ui-bottom-docked .nm-icon{width:15px;height:15px}
  .nm-ui-switcher.nm-ui-bottom-docked .nm-lang-menu{bottom:calc(100% + 6px);max-height:220px;max-height:calc(100vh - 72px)}
}

/* Admin product-list header contrast fix for night mode.
   The product list uses .sort-th-link buttons in <th>. The generic dark-mode
   anchor rule intentionally makes links light, but with the old pale header
   background it could look like blank white boxes. Keep sortable headers dark
   and high-contrast in night mode. */
html.nm-theme-dark .sort-th-link,
html.nm-theme-dark th .sort-th-link,
html.nm-theme-dark table th .sort-th-link{
  background:#1e3a8a!important;
  color:#f8fafc!important;
  border-color:#3b82f6!important;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.10),0 1px 2px rgba(0,0,0,.25)!important;
}
html.nm-theme-dark .sort-th-link:hover,
html.nm-theme-dark th .sort-th-link:hover{
  background:#1d4ed8!important;
  color:#ffffff!important;
  border-color:#60a5fa!important;
}
html.nm-theme-dark .sort-th-link.active,
html.nm-theme-dark th .sort-th-link.active{
  background:#2563eb!important;
  color:#ffffff!important;
  border-color:#93c5fd!important;
}
html.nm-theme-dark .sort-th-link:focus-visible{
  outline:2px solid #93c5fd!important;
  outline-offset:2px!important;
}
html.nm-theme-dark .table-wrap th{
  color:#f9fafb!important;
}


/* Admin/night-mode file and selected-path visibility hardening.
   Native file inputs can render the selected filename with browser default
   colors; explicitly style both the control and upload button, and show a
   readable JS-enhanced filename line after selection. */
input[type="file"],
.nm-file-input{
  color:#111827;
  background:#ffffff;
  border-color:#d1d5db;
  color-scheme:light;
}
input[type="file"]::file-selector-button,
.nm-file-input::file-selector-button{
  margin-right:10px;
  padding:6px 10px;
  border:1px solid #9ca3af;
  border-radius:6px;
  background:#f3f4f6;
  color:#111827;
  cursor:pointer;
}
input[type="file"]::-webkit-file-upload-button,
.nm-file-input::-webkit-file-upload-button{
  margin-right:10px;
  padding:6px 10px;
  border:1px solid #9ca3af;
  border-radius:6px;
  background:#f3f4f6;
  color:#111827;
  cursor:pointer;
}
.nm-selected-file-name{
  display:block;
  width:100%;
  margin-top:6px;
  padding:7px 9px;
  border:1px solid rgba(17,24,39,.10);
  border-radius:8px;
  background:#f9fafb;
  color:#111827;
  font-size:12px;
  line-height:1.45;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.nm-selected-file-name.nm-empty{display:none}
html.nm-theme-dark input[type="file"],
html.nm-theme-dark .nm-file-input,
html.nm-theme-dark .cell input[type="file"],
html.nm-theme-dark input[type="file"][style]{
  background:#0b1220!important;
  color:#e5e7eb!important;
  border-color:#374151!important;
  color-scheme:dark!important;
}
html.nm-theme-dark input[type="file"]::file-selector-button,
html.nm-theme-dark .nm-file-input::file-selector-button{
  background:#1f2937!important;
  color:#f9fafb!important;
  border-color:#4b5563!important;
}
html.nm-theme-dark input[type="file"]::-webkit-file-upload-button,
html.nm-theme-dark .nm-file-input::-webkit-file-upload-button{
  background:#1f2937!important;
  color:#f9fafb!important;
  border-color:#4b5563!important;
}
html.nm-theme-dark input[type="file"]:hover::file-selector-button,
html.nm-theme-dark .nm-file-input:hover::file-selector-button,
html.nm-theme-dark input[type="file"]:hover::-webkit-file-upload-button,
html.nm-theme-dark .nm-file-input:hover::-webkit-file-upload-button{
  background:#2563eb!important;
  color:#ffffff!important;
  border-color:#60a5fa!important;
}
html.nm-theme-dark .nm-selected-file-name{
  background:#111827!important;
  color:#e5e7eb!important;
  border-color:#374151!important;
}
html.nm-theme-dark .nas-picker-text,
html.nm-theme-dark .nas-path,
html.nm-theme-dark .file-muted,
html.nm-theme-dark .nas-item,
html.nm-theme-dark .nas-item span,
html.nm-theme-dark #reward_qr_path_display,
html.nm-theme-dark #rewardNasCurrentPath,
html.nm-theme-dark #rewardNasList,
html.nm-theme-dark #rewardNasList span{
  color:#e5e7eb!important;
}
html.nm-theme-dark .nas-item:hover,
html.nm-theme-dark .nas-item.selected{
  background:#1f2937!important;
}
html.nm-theme-dark .reward-path-picker,
html.nm-theme-dark #rewardNasList{
  background:#0b1220!important;
  color:#e5e7eb!important;
  border-color:#374151!important;
}
html.nm-theme-dark #rewardNasModal > div{
  background:#111827!important;
  color:#e5e7eb!important;
  border:1px solid #374151!important;
}
html.nm-theme-dark .reward-nas-dir,
html.nm-theme-dark .reward-nas-file{
  color:#e5e7eb!important;
  border-bottom-color:#374151!important;
}
html.nm-theme-dark .reward-nas-dir:hover,
html.nm-theme-dark .reward-nas-file:hover{
  background:#1f2937!important;
}
