/* =========================================================
   DARK MODE — หน้า /admin/system/* (ตั้งค่าระบบ)
   โหลดต่อท้าย dark.css · ใช้ token --fb-* เท่านั้น · ไม่แตะ hero น้ำเงิน/ปุ่มขาวบน hero (ตั้งใจ)
   ต้นเหตุส่วนใหญ่: CSS หน้าใช้ var(--brand) (#03338a) เป็นสีไอคอน/ตัวหนังสือ ซึ่งโหมดมืดยังเป็นน้ำเงินเข้มสำหรับพื้นปุ่ม
   ========================================================= */

/* ── 1) ไอคอนหัวตาราง (รวม .text-info/.text-primary/.text-brand ที่ใส่ใน <th>) ── */
html[data-theme="dark"]:root body th i.bi.bi,
html[data-theme="dark"]:root body th .bi.bi[class*="text-"] { color: var(--fb-text2) !important; }

/* ── 2) ไอคอนสีแบรนด์ในกล่องอ่อน (tile ตั้งค่า · การ์ดช่องทาง · badge-soft · โน้ต · ไอคอน soft) ── */
html[data-theme="dark"]:root body .yd-setting-tile__icon:not(.ads1-tiles .yd-setting-tile__icon),
html[data-theme="dark"]:root body .yd-channel-card__icon:not(.ads2-line-ic),
html[data-theme="dark"]:root body .ads1-ic.ads1-ic--soft {
  background: var(--fb-accent-soft) !important;
  border-color: var(--fb-line) !important;
}
/* เมนู Marketplace วางบนพื้นหน้าโดยตรง → ชิปไอคอนใช้พื้นเทาช่องกรอก */
html[data-theme="dark"]:root body .mk-admin-nav .mk-admin-nav__item:not(.is-active) .mk-admin-nav__icon { background: var(--fb-card2) !important; }
html[data-theme="dark"]:root body .yd-setting-tile__icon:not(.ads1-tiles .yd-setting-tile__icon) .bi.bi,
html[data-theme="dark"]:root body .yd-channel-card__icon:not(.ads2-line-ic) .bi.bi,
html[data-theme="dark"]:root body .ads1-ic.ads1-ic--soft i.bi.bi,
html[data-theme="dark"]:root body .mk-admin-nav .mk-admin-nav__item:not(.is-active) .mk-admin-nav__icon i.bi.bi,
html[data-theme="dark"]:root body .yd-note-info > .bi.bi,
html[data-theme="dark"]:root body .ads1-note:not(.ads1-note--warn) > i.bi.bi,
html[data-theme="dark"]:root body .mk-market-note i.bi.bi,
html[data-theme="dark"]:root body .alert-info i.bi.bi,
html[data-theme="dark"]:root body main > .text-muted > i.bi.bi { color: var(--fb-accent) !important; }

/* badge-soft (ตัวนับผู้รับ · ประเภท ticket): ตัวหนังสือสว่าง ไอคอนฟ้า · ป้าย LINE (.ads2-line) คงเขียว LINE (ตัวตนช่องทาง) */
html[data-theme="dark"]:root body .badge-soft:not(.ads2-line),
html[data-theme="dark"]:root body .badge-soft:not(.ads2-line) * { color: var(--fb-text) !important; }
html[data-theme="dark"]:root body .badge-soft:not(.ads2-line) .bi.bi { color: var(--fb-accent) !important; }
html[data-theme="dark"]:root body .badge-soft { background: var(--fb-accent-soft) !important; border-color: var(--fb-line) !important; }
html[data-theme="dark"]:root body .badge-soft.ads2-line,
html[data-theme="dark"]:root body .badge-soft.ads2-line * { color: #06c755 !important; }

/* ลิงก์/ตัวเน้นสีแบรนด์ และ pill แบรนด์ */
html[data-theme="dark"]:root body .text-brand-yd { color: var(--fb-accent) !important; }
html[data-theme="dark"]:root body .ads1-pill.ads1-pill--brand { color: var(--fb-text) !important; background: var(--fb-accent-soft) !important; }

/* การ์ดช่องทางที่ปิด (LINE ยังไม่พร้อม) / การ์ด Push ระหว่างตรวจ: จางน้อยลงบนพื้นมืด */
html[data-theme="dark"]:root body .yd-channel-card:has(input:disabled) { opacity: 0.92 !important; }
html[data-theme="dark"]:root body .yd-push.is-busy { opacity: 0.9 !important; }

/* ── 3) กล่องโน้ต/alert ฟ้า: พื้นฟ้าอ่อนแบบมืด ตัวหนังสือสว่าง ── */
html[data-theme="dark"]:root body .ads1-note:not(.ads1-note--warn),
html[data-theme="dark"]:root body .mk-market-note,
html[data-theme="dark"]:root body .alert-yd.alert-info {
  /* วางบนพื้นหน้า (มีแสงฟุ้ง) → ซ้อนฟ้าอ่อนบนพื้นการ์ดทึบ ไม่ให้สีพื้นเพี้ยนตามแสง */
  background: linear-gradient(var(--fb-accent-soft), var(--fb-accent-soft)), var(--fb-card) !important;
  border-color: var(--fb-line) !important;
  color: var(--fb-text) !important;
}
html[data-theme="dark"]:root body .mk-market-note .small-muted,
html[data-theme="dark"]:root body .alert-yd.alert-info .small-muted { color: var(--fb-text2) !important; }

/* โค้ดในการ์ด/alert (ค่า php.ini · นามสกุลไฟล์) */
html[data-theme="dark"]:root body .ads2-limit code,
html[data-theme="dark"]:root body .alert-yd code { background: var(--fb-card2) !important; }

/* ── 4) ตัวนับในเมนูย่อย / เมนู Marketplace ── */
html[data-theme="dark"]:root body .yd-subnav__count:not(.adf-count--warn) { color: var(--fb-text) !important; background: var(--fb-accent-soft) !important; }
html[data-theme="dark"]:root body .yd-subnav__item.is-active .yd-subnav__count:not(.adf-count--warn) { color: #fff !important; background: rgba(255, 255, 255, 0.22) !important; }
html[data-theme="dark"]:root body .mk-admin-nav .mk-admin-nav__item:not(.is-active) .mk-admin-nav__count { color: var(--fb-text) !important; background: var(--fb-card2) !important; }
html[data-theme="dark"]:root body .mk-admin-nav .mk-admin-nav__item.is-active .mk-admin-nav__meta { color: #fff !important; }
html[data-theme="dark"]:root body .mk-admin-nav .mk-admin-nav__item.is-active .mk-admin-nav__icon i.bi.bi { color: #fff !important; }

/* ── 5) ป้ายสถานะเฉพาะหน้า ads1 (Enabled/Disabled · request/IP) ── */
html[data-theme="dark"]:root .ads1-page .yd-badge.yd-badge--success { --ydb-fg: #8bbaff; --ydb-g1: #1d5fd1; --ydb-g2: #3b82f6; --ydb-g3: #4599ff; }
html[data-theme="dark"]:root .ads1-page .yd-badge.yd-badge--info { --ydb-fg: #7dd3fc; }
html[data-theme="dark"]:root .ads1-page .yd-badge.yd-badge--muted { --ydb-fg: var(--fb-text2); }

/* ── 6) ปุ่มอันตราย: แดงเข้มขึ้นให้ตัวขาวอ่านชัด ── */
html[data-theme="dark"]:root body .btn.btn-danger-yd { background: color-mix(in srgb, var(--fb-danger) 70%, #000) !important; border-color: transparent !important; color: #fff !important; }

/* Code Check: ชิปกฎที่ผ่าน (ok) → ตัวหนังสือสว่าง ไอคอนฟ้า บนพื้นฟ้าอ่อน */
html[data-theme="dark"]:root body .yd-cc-rule-chip.yd-cc-rule-chip--ok { color: var(--fb-text) !important; background: var(--fb-accent-soft) !important; border-color: var(--fb-line) !important; }
html[data-theme="dark"]:root body .yd-cc-rule-chip.yd-cc-rule-chip--ok i.bi.bi { color: var(--fb-accent) !important; }

/* ── 7) ช่องพรีวิวไอคอน (ธนาคาร/หมวด) จัดการที่ 30-admin-other.css แล้ว (ไอคอนฟ้าบนช่องเทา) ── */

/* ── 8) ชิป LINE บน hero: ไอคอนเขียว LINE จมพื้นฟ้า → ขาว ── */
html[data-theme="dark"]:root body .yd-hero__chip .bi-line { color: #fff !important; }

/* ── 9) สวิตช์/checkbox ที่ปิดอยู่ (device-access): ไม่จางเกิน ── */
html[data-theme="dark"]:root body .form-check-input:disabled ~ .form-check-label { opacity: 0.75 !important; }
html[data-theme="dark"]:root body .form-check-label > i.bi.bi { color: var(--fb-accent) !important; }

/* ── 10) Web Push (APP & PUSH): คำอธิบาย + สถานะเครื่อง ── */
html[data-theme="dark"]:root body .yd-push__sub { color: var(--fb-text2) !important; }
html[data-theme="dark"]:root body .yd-push__state:not(.is-ok):not(.is-warn):not(.is-danger),
html[data-theme="dark"]:root body .yd-push__state:not(.is-ok):not(.is-warn):not(.is-danger) span { color: var(--fb-text2) !important; }
html[data-theme="dark"]:root body .yd-push__state:not(.is-ok):not(.is-warn):not(.is-danger) i.bi { color: var(--fb-accent) !important; }
