/* =========================================================
   โหมดมืด — หน้าแอดมินอื่น ๆ (ยกเว้น /admin/system · /admin/finance · /admin/revenue)
   affiliate · services · users · analytics · shop · promo-links · support · releases · audit
   marketing · qc · oac · traffic · vip · jobs · settings · artists · distribution · dashboard
   - ทุกกฎขึ้นต้น html[data-theme="dark"] · ใช้ token --fb-* จาก dark.css เท่านั้น
   - หัวเพจน้ำเงิน (hero) คงสีเดิม · ปุ่มขาวทึบบน hero = ดีไซน์ตั้งใจ ไม่แตะ
   - ภาพ Canvas ที่ส่งออกโซเชียล (Marketing / Charts / Post Studio) ไม่แตะตัวภาพ แตะแค่กรอบรอบ ๆ
   ========================================================= */

/* ── /admin/users?view= : การ์ดขาวในหัวเพจน้ำเงิน → การ์ดมืด (สถิติ 6 ช่อง · แถบ LINE) ── */
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-stat {
  background: radial-gradient(160px 90px at 0% 0%, rgba(var(--c-rgb), .14), transparent 70%), var(--fb-card) !important;
  border-color: var(--fb-line) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .3) !important;
}
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-stat__k { color: var(--fb-text) !important; }
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-stat__v { color: var(--fb-text) !important; }
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-stat__h,
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-stat small { color: var(--fb-text3) !important; }
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-stat__wm { opacity: .12 !important; }
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-line {
  background: var(--fb-card) !important;
  border-color: var(--fb-line) !important;
  color: var(--fb-text) !important;
}
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-line__k { color: var(--fb-text2) !important; }
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-line .fw-bold { color: var(--fb-text) !important; }
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-line .small-muted:not(.yd-ud-line__k) { color: var(--fb-text3) !important; }
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-line__av { border-color: var(--fb-card2) !important; }

/* ── Affiliate: รหัส/ชิปน้ำเงินเข้ม (rgba brand .96) → ฟ้าอ่าน ── */
html[data-theme="dark"] .aff-code,
html[data-theme="dark"] .aff-chip,
html[data-theme="dark"] .aff-soft-badge {
  color: var(--fb-accent) !important;
  background: var(--fb-accent-soft) !important;
  border-color: rgba(69, 153, 255, .3) !important;
}
html[data-theme="dark"] .aff-code .bi,
html[data-theme="dark"] .aff-chip .bi,
html[data-theme="dark"] .aff-soft-badge .bi { color: var(--fb-accent) !important; }
/* ชิปใน hero (พื้นน้ำเงิน) = กระจก ตัวขาว */
html[data-theme="dark"] [class*="hero"] .aff-chip,
html[data-theme="dark"] [class*="hero"] .aff-chip .bi,
html[data-theme="dark"] [class*="hero"] .aff-chip span { color: #fff !important; background: rgba(255, 255, 255, .14) !important; border-color: rgba(255, 255, 255, .28) !important; }
html[data-theme="dark"] [class*="hero"] .aff-chip span { background: transparent !important; }

/* ── Audit: ป้าย action ใช้สีจาก inline style → แปลงตามโทน (เขียว → น้ำเงิน) ── */
html[data-theme="dark"] .badge[style*="220,53,69"] { background: var(--fb-danger-soft) !important; border-color: rgba(255, 107, 107, .35) !important; color: var(--fb-danger) !important; }
html[data-theme="dark"] .badge[style*="25,135,84"],
html[data-theme="dark"] .badge[style*="13,110,253"],
html[data-theme="dark"] .badge[style*="13,202,240"] { background: var(--fb-accent-soft) !important; border-color: rgba(69, 153, 255, .35) !important; color: var(--fb-accent) !important; }
html[data-theme="dark"] .badge[style*="255,193,7"] { background: var(--fb-warn-soft) !important; border-color: rgba(247, 185, 40, .35) !important; color: var(--fb-warn) !important; }
html[data-theme="dark"] .badge[style*="108,117,125"] { background: var(--fb-card2) !important; border-color: var(--fb-line) !important; color: var(--fb-text2) !important; }
html[data-theme="dark"] .badge[style*="rgba("] .bi { color: inherit !important; }

/* ── ปกเพลงว่าง (ไอคอนโน้ตน้ำเงินเข้ม) ── */
html[data-theme="dark"] .adc-cover { background: var(--fb-card2) !important; border-color: var(--fb-line) !important; }
html[data-theme="dark"] .adc-cover > .bi { color: var(--fb-text2) !important; }

/* ── Promo Links ── */
html[data-theme="dark"] .pll-type.is-follow,
html[data-theme="dark"] .pll .pll-type.is-follow i.bi { color: var(--fb-accent) !important; background: var(--fb-accent-soft) !important; border-color: rgba(69, 153, 255, .3) !important; }
html[data-theme="dark"] .pll .pll-type.is-follow i.bi { background: transparent !important; }

/* ── ชิปศิลปินหลัก (พื้น brand) ── */
html[data-theme="dark"] .yd-artist-chip--primary,
html[data-theme="dark"] .yd-artist-chip--primary i { color: #fff !important; background: var(--fb-accent-strong) !important; border-color: var(--fb-accent-strong) !important; }
html[data-theme="dark"] .yd-artist-chip--primary i { background: transparent !important; }

/* ── Marketing / Analytics Studio (ตัวภาพ canvas ไม่แตะ · แตะแค่กรอบ) ── */
html[data-theme="dark"] .mkt-hint { color: var(--fb-accent) !important; background: var(--fb-accent-soft) !important; }
html[data-theme="dark"] .mkt-hint .bi { color: var(--fb-accent) !important; }
html[data-theme="dark"] .mkt-stage {
  background:
    linear-gradient(45deg, #2c2d2e 25%, transparent 25%, transparent 75%, #2c2d2e 75%) 0 0 / 20px 20px,
    linear-gradient(45deg, #2c2d2e 25%, transparent 25%, transparent 75%, #2c2d2e 75%) 10px 10px / 20px 20px,
    var(--fb-card2) !important;
  border-color: var(--fb-line) !important;
}
html[data-theme="dark"] .ps-stage { background: repeating-conic-gradient(#2c2d2e 0% 25%, var(--fb-card2) 0% 50%) 0 0 / 22px 22px !important; }
html[data-theme="dark"] .ps-nav { background: var(--fb-card2) !important; border-color: var(--fb-line) !important; color: var(--fb-accent) !important; }
html[data-theme="dark"] .ps-tile--solid,
html[data-theme="dark"] .ps-tile--solid i { color: #fff !important; }
/* ตัวสลับ .mkt-seg / ช่องวันที่ .mkt-weeknav__date บน hero = ขาวทึบตัวเข้มเหมือนโหมดสว่าง
   (กำหนดที่ 40-app-core.css ใช้ร่วมกับหน้าศิลปิน — ห้ามตั้งพื้นมืดที่นี่ จะชนกันจนอ่านไม่ออก) */

/* ── OAC: แถบสัดส่วน "พร้อมยื่น" ฟ้าพาสเทล → ฟ้า accent ── */
html[data-theme="dark"] .oac-meter__seg.is-ready { background: var(--fb-accent) !important; }

/* ── ข้อความรอง/ไอคอนที่วางบนพื้นหน้า (body มีแสงฟุ้งน้ำเงิน) → สว่างขึ้นอีกขั้น ── */
html[data-theme="dark"] .yd-pager__meta,
html[data-theme="dark"] .yd-pager__meta span,
html[data-theme="dark"] .yd-ud-crumb span,
html[data-theme="dark"] .pll-group__sub,
html[data-theme="dark"] .pll-head .plv-card__sub { color: var(--fb-text) !important; }
html[data-theme="dark"] .yd-ud-crumb a,
html[data-theme="dark"] .pll-group__title > i.bi,
html[data-theme="dark"] .pll-head .plv-card__ic i.bi,
html[data-theme="dark"] .pll-head .plv-count { color: var(--fb-accent) !important; }
html[data-theme="dark"] .pll-head .plv-card__ic,
html[data-theme="dark"] .pll-head .plv-count { background: var(--fb-card) !important; border-color: var(--fb-line) !important; }

/* ── Users: รูปแทนผู้ใช้ไม่มีรูป · การ์ดสถิติ hint · กล่องข้อมูลไม่ครบ ── */
html[data-theme="dark"] .adp-uavatar { background: var(--fb-card2) !important; border-color: var(--fb-line) !important; }
html[data-theme="dark"] .admin-users-page .adp-uavatar i.bi { color: var(--fb-text2) !important; }
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-stat__h { color: var(--fb-text2) !important; }
html[data-theme="dark"]:root .yd-ud-hero .yd-ud-line > div > div:not(.yd-ud-line__k) { color: var(--fb-text) !important; }
html[data-theme="dark"] .yd-ud-missing,
html[data-theme="dark"] .yd-ud-missing > div { color: var(--fb-warn) !important; }

/* ── Shop: จุดสีร้าน (ไอคอนขาว) ใช้สีแบรนด์ร้านจริง ไม่ใช่สีตัวหนังสือโหมดมืด ── */
html[data-theme="dark"] .shop-dot--shopee { background: #ee4d2d !important; }
html[data-theme="dark"] .shop-dot--tiktok { background: #000 !important; box-shadow: inset 0 0 0 1px var(--fb-line) !important; }
html[data-theme="dark"] .shop-dot--lazada { background: #3b44c7 !important; }
html[data-theme="dark"] .shop-bulkbar__count { color: var(--fb-accent) !important; }
html[data-theme="dark"] .shop-help,
html[data-theme="dark"] .ana-callout { background: var(--fb-card) !important; border-color: rgba(69, 153, 255, .35) !important; color: var(--fb-text) !important; }
html[data-theme="dark"] .shop-help > i,
html[data-theme="dark"] .ana-callout > i,
html[data-theme="dark"] .ana-callout a { color: var(--fb-accent) !important; }

/* ── ช่องพรีวิวไอคอน (Settings / Categories) input-group-text.bg-white ── */
html[data-theme="dark"] .js-icon-wrap .input-group-text,
html[data-theme="dark"] .input-group-text.bg-white { background: var(--fb-card2) !important; border-color: var(--fb-line) !important; color: var(--fb-text) !important; }
html[data-theme="dark"] .js-icon-wrap .input-group-text .bi { color: var(--fb-accent) !important; }

/* ── ป้ายกลาง (pill / สถานะ secondary) ที่ไม่มีโทน → เทาอ่านได้ ── */
html[data-theme="dark"] .yd-pill:not(.yes):not(.warn):not(.no):not([class*="yd-pill-"]),
html[data-theme="dark"] .aff-status-badge--secondary,
html[data-theme="dark"] .aff-status-badge--light { --ydb-fg: var(--fb-text2) !important; }

/* ── VIP settings · OAC · Beat approvals ── */
html[data-theme="dark"] .vset-num__pre { color: var(--fb-accent) !important; }
html[data-theme="dark"] .oac-chan .oac-chan__ext { color: var(--fb-accent) !important; opacity: 1 !important; }
html[data-theme="dark"] .bw-cover { background: var(--fb-card2) !important; border-color: var(--fb-line) !important; }
html[data-theme="dark"] .bw-cover > .bi { color: var(--fb-text2) !important; }
html[data-theme="dark"] .bw-tag--muted { color: var(--fb-text2) !important; background: var(--fb-card2) !important; border-color: var(--fb-line) !important; }

/* ── รอบ 2: กฎที่ต้องชนะ selector เฉพาะหน้าใน dark_auto (เพิ่ม :root body) ── */
/* ชิป/ป้ายฟ้าอ่อน: พื้น soft ทำให้ฟ้าเหลือ ~4.3:1 → พื้นโปร่ง ขอบฟ้า ตัวฟ้า (≥5:1 บนการ์ด) */
html[data-theme="dark"]:root body .aff-code,
html[data-theme="dark"]:root body .aff-soft-badge,
html[data-theme="dark"]:root body .aff-soft-badge.aff-soft-badge--meta,
html[data-theme="dark"]:root body .aff-table-head .aff-chip,
html[data-theme="dark"]:root body .pll-type.is-follow,
html[data-theme="dark"]:root body .mkt-hint,
html[data-theme="dark"]:root body .badge[style*="rgba("] {
  background: transparent !important;
}
html[data-theme="dark"]:root body .aff-code,
html[data-theme="dark"]:root body .aff-soft-badge.aff-soft-badge--meta,
html[data-theme="dark"]:root body .aff-soft-badge.aff-soft-badge--meta i.bi,
html[data-theme="dark"]:root body .aff-table-head .aff-chip,
html[data-theme="dark"]:root body .aff-table-head .aff-chip span,
html[data-theme="dark"]:root body .badge[style*="13,110,253"],
html[data-theme="dark"]:root body .badge[style*="25,135,84"],
html[data-theme="dark"]:root body .badge[style*="13,202,240"] { color: var(--fb-accent) !important; }
html[data-theme="dark"]:root body .mkt-hint { border: 1px solid rgba(69, 153, 255, .35) !important; }

/* ข้อความ/ไอคอนบนพื้นหน้า (แสงฟุ้ง) */
html[data-theme="dark"]:root body .yd-ud-crumb a { color: var(--fb-text) !important; text-decoration: underline; text-underline-offset: 3px; }
html[data-theme="dark"]:root body .pll .pll-group__title i.bi { color: var(--fb-text) !important; }

/* ตัวเลข/คำนำหน้าในช่อง */
html[data-theme="dark"]:root body .ads-page .shop-bulkbar__count,
html[data-theme="dark"]:root body .vset-num > .vset-num__pre { color: var(--fb-text) !important; }
html[data-theme="dark"]:root body .vset-cell--vvip .vset-num > .vset-num__pre { color: var(--fb-warn) !important; }

/* กล่องเตือนข้อมูลไม่ครบ (users) = การ์ดมืดขอบเหลือง */
html[data-theme="dark"]:root body .yd-ud-missing { background: var(--fb-card) !important; border-color: rgba(247, 185, 40, .45) !important; }

/* Analytics catalog: แถวแพลตฟอร์มที่ยังไม่มีไฟล์ */
html[data-theme="dark"]:root body .ana-plat-row.is-missing { opacity: .85 !important; }
html[data-theme="dark"]:root body .ana-plat-row__main small { color: var(--fb-text2) !important; }

/* ลิงก์ย้อนกลับใน hero ของ Shop (dark_auto ตั้งเป็นเทา) → ขาวโปร่งเหมือนโหมดสว่าง */
html[data-theme="dark"]:root body .sp-hero .sp-back { color: rgba(255, 255, 255, .85) !important; }
html[data-theme="dark"]:root body .sp-hero .sp-back:hover { color: #fff !important; }


/* ── Analytics: จุดไอคอนแพลตฟอร์ม (พื้นพาสเทลจาก --pc) → พื้นการ์ดเข้ม ไอคอนสีแพลตฟอร์ม ── */
html[data-theme="dark"]:root body .ana-plat-dot {
  background: color-mix(in srgb, var(--pc, #4599ff) 18%, var(--fb-card)) !important;
  border-color: color-mix(in srgb, var(--pc, #4599ff) 40%, var(--fb-card)) !important;
}
html[data-theme="dark"]:root body .ana-plat-dot .bi { color: color-mix(in srgb, var(--pc, #4599ff) 55%, #fff) !important; }

/* ===== /admin/users?view= — ข้อมูลศิลปินทั้งหมด (V68.7.8.327) =====
   การ์ด/แถบที่อยู่ใต้ .yd-ud-hero ถูกตัวสร้าง dark_auto ข้าม (ข้ามหัวเพจน้ำเงินโดยตั้งใจ) → ตั้งเองที่นี่ */
html[data-theme="dark"] .yd-ud-hero .yd-ud-data,
html[data-theme="dark"] .yd-ud-hero .yd-ud-todo {
  background: var(--fb-card) !important; color: var(--fb-text) !important;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .45) !important;
}
html[data-theme="dark"] .yd-ud-hero .yd-ud-data__title,
html[data-theme="dark"] .yd-ud-hero .yd-ud-todo__t { color: var(--fb-text) !important; }
html[data-theme="dark"] .yd-ud-hero .yd-ud-data__sub,
html[data-theme="dark"] .yd-ud-hero .yd-ud-todo__ok { color: var(--fb-text2) !important; }
html[data-theme="dark"] .yd-ud-hero .yd-ud-tabs { background: var(--fb-bg) !important; }
html[data-theme="dark"] .yd-ud-hero .yd-ud-tab { color: var(--fb-text2) !important; }
html[data-theme="dark"] .yd-ud-hero .yd-ud-tab:hover { background: var(--fb-card2) !important; color: var(--fb-text) !important; }
html[data-theme="dark"] .yd-ud-hero .yd-ud-tab em { background: var(--fb-card2) !important; color: var(--fb-text2) !important; }
html[data-theme="dark"] .yd-ud-hero .yd-ud-tab[aria-selected="true"],
html[data-theme="dark"] .yd-ud-hero .yd-ud-tab[aria-selected="true"]:hover { background: linear-gradient(135deg, #2374e1, #1b4fb3) !important; color: #fff !important; }
html[data-theme="dark"] .yd-ud-hero .yd-ud-tab[aria-selected="true"] em { background: rgba(255, 255, 255, .22) !important; color: #fff !important; }
