/* ═══ พรีวิวทุกคำสั่ง (/commands.php) — คลาสขึ้นต้น cx- ═══ */
.cx-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.cx-stat { padding: 14px 16px; border-radius: 16px; text-align: center; }
.cx-stat b { display: block; font-family: var(--mono); font-size: 1.8rem; line-height: 1.2; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cx-stat span { font-size: .78rem; color: var(--muted); }

.cx-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr) 290px; gap: 18px; align-items: start; }

/* รายการคำสั่ง */
.cx-list { padding: 14px; border-radius: var(--radius); position: sticky; top: 90px; max-height: calc(100vh - 110px); display: flex; flex-direction: column; gap: 10px; }
.cx-search { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border-hi); background: rgba(4, 11, 9, .6); color: var(--muted); }
.cx-search input { border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: .86rem; width: 100%; }
.cx-aud { display: flex; gap: 4px; }
.cx-aud button { flex: 1; padding: 6px 0; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .78rem; transition: .2s; }
.cx-aud button.on { background: linear-gradient(135deg, rgba(33, 160, 64, .5), rgba(12, 74, 58, .5)); color: #fff; border-color: var(--cyan); }
.cx-items { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(33, 160, 64, .4) transparent; padding-right: 2px; display: grid; gap: 5px; align-content: start; }
.cx-items h4 { margin: 8px 2px 2px; font-size: .8rem; color: var(--cyan); display: flex; justify-content: space-between; }
.cx-items h4 small { color: var(--dim); font-family: var(--mono); }
.cx-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 12px; border: 1px solid transparent; background: rgba(4, 11, 9, .35); text-align: left; transition: transform .25s var(--ease), border-color .25s, background .25s; animation: cx-in .4s var(--spring) both; animation-delay: calc(var(--i, 0) * 25ms); }
@keyframes cx-in { from { opacity: 0; transform: translateX(-8px); } }
.cx-item:hover { border-color: var(--border-hi); transform: translateX(3px); }
.cx-item.on { border-color: var(--cyan); background: rgba(33, 160, 64, .18); box-shadow: 0 0 16px rgba(102, 221, 79, .15); }
.cx-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 1.05rem; background: linear-gradient(145deg, #0f2e1b, #071410); border: 1px solid rgba(102, 221, 79, .35); }
.cx-item.on .cx-ic { animation: ico-hop 2.4s ease-in-out infinite; }
.cx-t { min-width: 0; }
.cx-t b { display: block; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-t small { display: flex; gap: 3px; align-items: center; color: var(--dim); font-size: .68rem; }
.cx-t small i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.cx-t small em { font-style: normal; color: var(--amber); }
.m-text { background: #e6ebea; } .m-flex { background: #66dd4f; } .m-template { background: #fbbf24; } .m-motion { background: #f472b6; }
.cx-item code { font-family: ui-monospace, Consolas, monospace; font-size: .74rem; padding: 2px 7px; border-radius: 6px; background: rgba(182, 240, 156, .12); color: #c8f5b8; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-empty { color: var(--muted); text-align: center; font-size: .85rem; }

/* โทรศัพท์ */
.cx-stage { display: grid; gap: 10px; justify-items: center; min-width: 0; }
.cx-modes { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; border-radius: 14px; justify-content: center; }
.cx-modes button { padding: 7px 13px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--muted); font-size: .84rem; position: relative; transition: .2s; }
.cx-modes button:hover { color: var(--text); }
.cx-modes button.on { background: linear-gradient(135deg, var(--primary), #0c4a3a); color: #fff; box-shadow: 0 0 14px rgba(33, 160, 64, .5); }
.cx-modes button.off { opacity: .5; text-decoration: line-through; text-decoration-color: rgba(251, 113, 133, .7); }
.cx-modes button.off.on { opacity: 1; }
.cx-games { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 560px; font-size: .74rem; color: var(--muted); align-items: center; }
.cx-games button { padding: 4px 9px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .72rem; transition: .2s; }
.cx-games button.on { border-color: var(--cyan); color: #fff; background: rgba(33, 160, 64, .3); }
.cx-phone { max-width: 430px; width: 100%; }
.cx-phone .chat { height: min(78vh, 760px); }
.cx-feed { gap: 10px; }
.cx-msg { display: flex; gap: 7px; align-items: flex-start; animation: cx-pop .45s var(--spring) both; max-width: 100%; }
@keyframes cx-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.cx-msg.out { flex-direction: column; align-items: flex-end; }
.cx-msg.sys { justify-content: center; }
.cx-who { font-size: .62rem; color: rgba(255, 255, 255, .9); margin-right: 4px; }
.cx-me { background: #06c755 !important; color: #fff !important; }
.cx-av { width: 34px; height: 34px; border-radius: 50%; flex: none; background: #071410; box-shadow: 0 0 0 2px #06c755; object-fit: cover; }
.cx-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; max-width: calc(100% - 41px); }
.cx-name { font-size: .7rem; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.cx-tag { align-self: flex-start; font-size: .58rem; padding: 0 6px; border-radius: 4px; background: rgba(33, 160, 64, .75); color: #fff; }
.cx-col .fv-flexmsg { max-width: 100%; overflow-x: auto; }
.cx-dots { display: flex; gap: 4px; padding: 12px 14px; border-radius: 18px; background: #fff; }
.cx-dots i { width: 7px; height: 7px; border-radius: 50%; background: #9aa8a3; animation: cx-dot 1s infinite ease-in-out; }
.cx-dots i:nth-child(2) { animation-delay: .15s; } .cx-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes cx-dot { 40% { transform: translateY(-4px); background: #21a040; } }
.cx-sys { font-size: .74rem; padding: 6px 12px; border-radius: 12px; background: rgba(0, 0, 0, .25); color: #fff; text-align: center; max-width: 320px; }

/* ข้อมูลคำสั่ง */
.cx-info { padding: 18px; border-radius: var(--radius); position: sticky; top: 90px; }
.cx-info h3 { margin: 4px 0 6px; font-size: 1.1rem; }
.cx-info h4 { margin: 14px 0 6px; font-size: .8rem; color: var(--cyan); }
.cx-trig { color: var(--muted); font-size: .86rem; }
.cx-trig code, .cx-meta code { font-family: ui-monospace, Consolas, monospace; padding: 1px 7px; border-radius: 6px; background: rgba(182, 240, 156, .12); color: #c8f5b8; }
.cx-ladder { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.cx-ladder span { font-size: .76rem; padding: 6px 8px; border-radius: 9px; border: 1px solid var(--border); }
.cx-ladder .ok { color: #c8f5b8; } .cx-ladder .no { color: var(--dim); }
.cx-ladder .now { border-color: var(--cyan); background: rgba(33, 160, 64, .2); box-shadow: 0 0 12px rgba(102, 221, 79, .2); }
.cx-note { margin-top: 10px; font-size: .8rem; line-height: 1.6; padding: 10px 12px; border-radius: 12px; background: rgba(251, 191, 36, .08); border: 1px solid rgba(251, 191, 36, .3); color: #ffe08a; }
.cx-meta { font-size: .8rem; color: var(--muted); margin: 0; }

/* เทียบทุกรูปแบบ */
.cx-cmp { position: fixed; inset: 0; z-index: 90; background: rgba(2, 7, 5, .78); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; }
.cx-cmp[hidden] { display: none; }
.cx-cmp-in { width: min(1200px, 100%); max-height: 92vh; overflow: auto; padding: 18px; border-radius: 20px; }
.cx-cmp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cx-cmp-head h3 { margin: 0; }
.cx-cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.cx-cmp-col h4 { margin: 0 0 8px; color: var(--cyan); font-size: .86rem; }
.cx-cmp-chat { background: #8cabd9; border-radius: 16px; padding: 12px; display: grid; gap: 8px; justify-items: start; min-height: 120px; }
.cx-cmp-msg { max-width: 100%; overflow-x: auto; }
.cx-foot { text-align: center; color: var(--dim); font-size: .78rem; margin-top: 22px; }

@media (max-width: 1180px) { .cx-layout { grid-template-columns: 270px minmax(0, 1fr); } .cx-info { grid-column: 1 / -1; position: static; } }
@media (max-width: 800px) {
  .cx-layout { grid-template-columns: 1fr; }
  .cx-list { position: static; max-height: 360px; }
  .cx-stats { grid-template-columns: repeat(2, 1fr); }
  .cx-phone .chat { height: 600px; }
}
@media (prefers-reduced-motion: reduce) { .cx-item, .cx-msg, .cx-dots i, .cx-item.on .cx-ic { animation: none; } }
