/* ChatKH Live — Dark / Light mode (ឯកសារនេះបង្កើតដោយ Script: កែ Token/Rule ទាំងពីរប្លុកឲ្យដូចគ្នា)
 * <html data-theme="light|dark|auto"> — Cookie ckl_theme; auto = តាមការកំណត់ប្រព័ន្ធ (macOS / Windows / ទូរស័ព្ទ)
 */
html[data-theme="light"] { color-scheme: light; --muted:#626175; }
html[data-theme="auto"] { color-scheme:light dark; }
@media(prefers-color-scheme:light) { html[data-theme="auto"] { --muted:#626175; } }
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0e17; --alt: #14131f; --card: #1a1926; --line: #2b2a3b; --text: #e9e8f3; --muted: #a3a2b8; --ink: #f4f3fb;
  --blue: #9494ea; --blue-600: #b0b0ff; --blue-50: #22214a; --blue-100: #2c2b5c;
  --orange-d: #ffa868; --orange-50: #382313;
  --red: #f25c66; --red-50: #3a171c; --green: #4fd185; --green-50: #12301f; --amber: #f7c04a; --amber-50: #352710;
  --violet: #b9a2ff; --violet-50: #2a2148; --gray-50: #232231; --tip-bg: #33324a;
  --text2: #cfcee2; --line2: #3b3a50; --hover: #201f2e; --top-bg: rgba(15,14,23,.96); --glass: rgba(26,25,38,.96);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 26px rgba(0,0,0,.28); --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.6);
}
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background-color: var(--card); color: var(--text); border-color: var(--line2); }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: var(--muted); }
html[data-theme="dark"] input[type=file]::file-selector-button { background: var(--gray-50); color: var(--text); border: 1px solid var(--line2); }
html[data-theme="dark"] img.brand-logo { filter: brightness(1.15); }
html[data-theme="dark"] .cmt.is-out { background: #2a171b; border-color: #5a2a31; }
html[data-theme="dark"] .cmt.is-dup { background: #2a2214; }
html[data-theme="dark"] .receive-wait { background: #2c2313; border-color: #5a4520; }
html[data-theme="dark"] .app-top { background: rgba(26,25,38,.92); }
html[data-theme="dark"] .imp-bar { background: #2c2b40; }
html[data-theme="dark"] .btn-danger-soft { border-color: #5a2a31; }
html[data-theme="dark"] .live-row.is-live { border-color: #5a2a31; background: linear-gradient(90deg, var(--red-50), var(--card) 45%); }
html[data-theme="dark"] .fb-connect { border-color: var(--blue-100); }
html[data-theme="dark"] .pub-top { background: rgba(15,14,23,.78); border-bottom-color: var(--line); }
html[data-theme="dark"] .btn-glass { background: rgba(255,255,255,.06); color: var(--text); border-color: var(--line2); }
html[data-theme="dark"] .blob { opacity: .16; }
html[data-theme="dark"] .auth::before { background: radial-gradient(circle at 20% 20%, rgba(125,125,219,.18), transparent 40%), radial-gradient(circle at 85% 80%, rgba(245,133,47,.12), transparent 40%); }
html[data-theme="dark"] .auth-tabs, html[data-theme="dark"] .pw-eye:hover, html[data-theme="dark"] .captcha-refresh:hover, html[data-theme="dark"] .phone-cc { background: var(--gray-50); border-color: var(--line2); }
html[data-theme="dark"] .float-card, html[data-theme="dark"] .lv-product { background: rgba(26,25,38,.96); color: var(--text); }
html[data-theme="dark"] .app-screen { background: var(--alt); }
html[data-theme="dark"] .split-visual::before { background: radial-gradient(circle, rgba(245,133,47,.18), transparent 70%); }
html[data-theme="dark"] .ma-thumb.a { background: linear-gradient(135deg, #2c2b5c, #4b4a8f); }
html[data-theme="dark"] .ui-modal-card, html[data-theme="dark"] .ui-toast { background: var(--card); color: var(--text); }
html[data-theme="dark"] .table tbody tr:hover td { background: var(--hover); }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #0f0e17; --alt: #14131f; --card: #1a1926; --line: #2b2a3b; --text: #e9e8f3; --muted: #a3a2b8; --ink: #f4f3fb;
    --blue: #9494ea; --blue-600: #b0b0ff; --blue-50: #22214a; --blue-100: #2c2b5c;
    --orange-d: #ffa868; --orange-50: #382313;
    --red: #f25c66; --red-50: #3a171c; --green: #4fd185; --green-50: #12301f; --amber: #f7c04a; --amber-50: #352710;
    --violet: #b9a2ff; --violet-50: #2a2148; --gray-50: #232231; --tip-bg: #33324a;
    --text2: #cfcee2; --line2: #3b3a50; --hover: #201f2e; --top-bg: rgba(15,14,23,.96); --glass: rgba(26,25,38,.96);
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 26px rgba(0,0,0,.28); --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.6);
  }
  html[data-theme="auto"] input, html[data-theme="auto"] select, html[data-theme="auto"] textarea { background-color: var(--card); color: var(--text); border-color: var(--line2); }
  html[data-theme="auto"] input::placeholder, html[data-theme="auto"] textarea::placeholder { color: var(--muted); }
  html[data-theme="auto"] input[type=file]::file-selector-button { background: var(--gray-50); color: var(--text); border: 1px solid var(--line2); }
  html[data-theme="auto"] img.brand-logo { filter: brightness(1.15); }
  html[data-theme="auto"] .cmt.is-out { background: #2a171b; border-color: #5a2a31; }
  html[data-theme="auto"] .cmt.is-dup { background: #2a2214; }
  html[data-theme="auto"] .receive-wait { background: #2c2313; border-color: #5a4520; }
  html[data-theme="auto"] .app-top { background: rgba(26,25,38,.92); }
  html[data-theme="auto"] .imp-bar { background: #2c2b40; }
  html[data-theme="auto"] .btn-danger-soft { border-color: #5a2a31; }
  html[data-theme="auto"] .live-row.is-live { border-color: #5a2a31; background: linear-gradient(90deg, var(--red-50), var(--card) 45%); }
  html[data-theme="auto"] .fb-connect { border-color: var(--blue-100); }
  html[data-theme="auto"] .pub-top { background: rgba(15,14,23,.78); border-bottom-color: var(--line); }
  html[data-theme="auto"] .btn-glass { background: rgba(255,255,255,.06); color: var(--text); border-color: var(--line2); }
  html[data-theme="auto"] .blob { opacity: .16; }
  html[data-theme="auto"] .auth::before { background: radial-gradient(circle at 20% 20%, rgba(125,125,219,.18), transparent 40%), radial-gradient(circle at 85% 80%, rgba(245,133,47,.12), transparent 40%); }
  html[data-theme="auto"] .auth-tabs, html[data-theme="auto"] .pw-eye:hover, html[data-theme="auto"] .captcha-refresh:hover, html[data-theme="auto"] .phone-cc { background: var(--gray-50); border-color: var(--line2); }
  html[data-theme="auto"] .float-card, html[data-theme="auto"] .lv-product { background: rgba(26,25,38,.96); color: var(--text); }
  html[data-theme="auto"] .app-screen { background: var(--alt); }
  html[data-theme="auto"] .split-visual::before { background: radial-gradient(circle, rgba(245,133,47,.18), transparent 70%); }
  html[data-theme="auto"] .ma-thumb.a { background: linear-gradient(135deg, #2c2b5c, #4b4a8f); }
  html[data-theme="auto"] .ui-modal-card, html[data-theme="auto"] .ui-toast { background: var(--card); color: var(--text); }
  html[data-theme="auto"] .table tbody tr:hover td { background: var(--hover); }
}
/* KHQR: រក្សាផ្ទៃស (តាម Guideline ABA/KHQR) */
html[data-theme] .kq-card, html[data-theme] .kq-qr { color-scheme: light; }

/* ---- ប៊ូតុងប្តូរ Theme ---- */
.theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: none; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; padding: 0; transition: background .15s, color .15s; }
.theme-btn:hover { background: var(--blue-50); color: var(--blue); }
.theme-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: none; }
/* បង្ហាញ Icon តាមពណ៌ដែលកំពុងឃើញ (auto = តាមប្រព័ន្ធ) — ចុចម្តង = ប្តូរភ្លឺ ⇄ ងងឹត */
html[data-theme="light"] .theme-btn .ti-light, html[data-theme="dark"] .theme-btn .ti-dark, html[data-theme="auto"] .theme-btn .ti-light { display: block; }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .theme-btn .ti-light { display: none; } html[data-theme="auto"] .theme-btn .ti-dark { display: block; } }

/* ប្តូរភាសា / ទំព័រ — Cross-fade ជំនួសការភ្លឹបស (Browser ដែលគាំទ្រ) */
@view-transition { navigation: none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
html.lang-swap body { transition: opacity .15s; opacity: .55; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } html.lang-swap body { transition: none; } }

/* Shared interaction states across public, admin and customer screens. */
body { cursor: default; caret-color: transparent; }
:where(a[href], button, summary, select, [role="button"], input[type="button"], input[type="submit"], input[type="reset"], input[type="checkbox"], input[type="radio"], input[type="file"]) { cursor: pointer; }
:where(button, .btn, [role="button"], summary) { -webkit-user-select: none; user-select: none; }
:where(input, textarea, [contenteditable="true"], [contenteditable=""], [contenteditable="plaintext-only"]) { caret-color: auto; }
:where(textarea, input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="tel"], input[type="url"], input[type="number"], [contenteditable="true"], [contenteditable=""], [contenteditable="plaintext-only"]) { cursor: text; }
:where(button, input, select, textarea, a[href], summary, [role="button"]):focus-visible { outline: 3px solid var(--blue, #6262ac); outline-offset: 3px; }
:where(button, input, select, textarea):disabled, [aria-disabled="true"] { cursor: not-allowed; }
.ui-modal-card { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.ui-modal-card p, .ui-toast-tx { overflow-wrap: anywhere; }
.ui-toast-ic { color: #fff; }
.ui-toast-x { color: inherit; opacity: .8; }
@media (max-width: 767px) { .ui-modal-card { max-height: calc(100dvh - 16px); } }
/* Keep white button labels on a sufficiently dark accent in both themes. */
:root { --accent-solid:#51519a; --accent-solid-hover:#434383; }
.btn.btn-primary,.tabs a.active,.pager a.active,.cycle-toggle button.active,.lang-switch a.on,.sub-tabs a.active,.gl-filter .chip.active,.pg-badge,.pg-main:has(input:checked),.uf-step span,.stepper li.now span,.msg.mine .bubble { background:var(--accent-solid); color:#fff; border-color:var(--accent-solid); }
.btn.btn-primary:hover { background:var(--accent-solid-hover); border-color:var(--accent-solid-hover); color:#fff; }

/* v2.19.48: បញ្ឈប់ Cursor/Hover ភ្លឹប (តឹងៗ) — Element មិនរំកិលទៅឆ្ងាយពីទ្រនិច (Pointer) ពេល Hover ទេ
   (ការរំកិល translate ធ្វើឲ្យគែមប៊ូតុងចេញពីក្រោម Pointer ហើយ Hover បើក/បិទជាប់ៗ)។ រក្សាតែពណ៌/ស្រមោល។ */
.quick a:hover, .channel-card:hover, .crm-kpi:hover, .link-card:hover, .cmp-send:hover, .mp-opt:hover,
.lp-card:hover, .btn:hover, .step-card:hover, .feat-card:hover, .plan:hover, .btn-account:hover,
.foot-grid > div:not(.foot-brand) a:hover, body.shop-body .shop-item:hover { transform: none !important; }
.acc-ava:hover .acc-ava-cam { transform: none !important; }
/* ប៊ូតុង/តំណ: ទ្រនិចជា Pointer ទូទាំង (រួមទាំង Element ក្នុងប៊ូតុង) មិនប្តូរទៅ I-beam ពេលកាត់លើអក្សរ */
:where(button, summary, [role="button"], a[href], label[for], .btn) * { cursor: inherit; }
:where(button, summary, [role="button"], a[href], .btn, label[for]) { -webkit-touch-callout: none; }
