/* =====================================================================
   ระบบชุดตัวเลข - สไตล์หลัก
   ใช้ร่วมกับ Tailwind (assets/vendor/tailwind.js)
   สีทั้งหมดอ้างอิงจาก CSS variable ที่ Admin ปรับได้จากหน้าตั้งค่า
   ===================================================================== */

:root {
	--c-primary:        #1D4ED8;
	--c-primary-dark:   #1E3A8A;
	--c-primary-light:  #3B82F6;
	--c-accent:         #FACC15;
	--c-accent-dark:    #EAB308;
	--c-bg:             #F1F5F9;
	--c-surface:        #FFFFFF;
	--c-text:           #0F172A;
	--c-sidebar:        #1E3A8A;
	--c-on-primary:     #FFFFFF;
	--c-on-accent:      #0F172A;
	--font-app:         'Prompt', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { font-family: var(--font-app); }

html, body {
	background-color: var(--c-bg);
	color: var(--c-text);
	-webkit-font-smoothing: antialiased;
}

body { font-weight: 400; }

/* ---------------------------------------------------------------- ปุ่ม */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
	padding: .55rem 1.1rem; border-radius: .75rem;
	font-size: .9rem; font-weight: 500; line-height: 1.4;
	border: 1px solid transparent; cursor: pointer;
	transition: all .18s ease; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--c-primary); color: var(--c-on-primary); }
.btn-primary:hover { background: var(--c-primary-dark); }

.btn-accent { background: var(--c-accent); color: var(--c-on-accent); font-weight: 600; }
.btn-accent:hover { background: var(--c-accent-dark); }

.btn-outline { background: transparent; color: var(--c-primary); border-color: var(--c-primary); }
.btn-outline:hover { background: var(--c-primary); color: var(--c-on-primary); }

.btn-ghost { background: rgba(15,23,42,.05); color: var(--c-text); }
.btn-ghost:hover { background: rgba(15,23,42,.1); }

.btn-danger { background: #E11D48; color: #fff; }
.btn-danger:hover { background: #BE123C; }

.btn-sm { padding: .35rem .7rem; font-size: .8rem; border-radius: .55rem; }
.btn-lg { padding: .8rem 1.6rem; font-size: 1rem; border-radius: .9rem; }

/* --------------------------------------------------------------- การ์ด */
.card {
	background: var(--c-surface);
	border: 1px solid rgba(15,23,42,.08);
	border-radius: 1rem;
	box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px -18px rgba(15,23,42,.35);
}
.card-head {
	padding: 1rem 1.25rem;
	border-bottom: 1px solid rgba(15,23,42,.08);
	display: flex; align-items: center; justify-content: space-between; gap: 1rem;
	flex-wrap: wrap;
}
.card-title { font-weight: 600; font-size: 1rem; color: var(--c-text); }
.card-body { padding: 1.25rem; }

/* -------------------------------------------------------------- ฟอร์ม */
.label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .35rem; color: var(--c-text); }
.input, .select, .textarea {
	width: 100%; padding: .55rem .8rem;
	border: 1px solid #CBD5E1; border-radius: .7rem;
	background: #fff; color: var(--c-text); font-size: .9rem;
	transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
	outline: none; border-color: var(--c-primary);
	box-shadow: 0 0 0 3px rgba(29,78,216,.15);
}
.textarea { min-height: 130px; line-height: 1.7; }
.help { font-size: .78rem; color: #64748B; margin-top: .3rem; }
.form-error { font-size: .8rem; color: #E11D48; margin-top: .25rem; display: block; }

/* -------------------------------------------------------------- ตาราง */
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table thead th {
	background: var(--c-primary); color: var(--c-on-primary);
	font-weight: 500; text-align: left; padding: .7rem .9rem; white-space: nowrap;
}
.table thead th:first-child { border-top-left-radius: .6rem; }
.table thead th:last-child  { border-top-right-radius: .6rem; }
.table tbody td { padding: .65rem .9rem; border-bottom: 1px solid rgba(15,23,42,.07); }
.table tbody tr:hover { background: rgba(29,78,216,.04); }
.table-wrap { overflow-x: auto; }

/* --------------------------------------------------------- ลูกบอลตัวเลข */
.digit-ball {
	display: inline-flex; align-items: center; justify-content: center;
	width: 2.6rem; height: 2.6rem; border-radius: 9999px;
	background: var(--c-primary); color: var(--c-on-primary);
	font-size: 1.25rem; font-weight: 600; margin-right: .4rem;
	box-shadow: 0 4px 10px -4px rgba(15,23,42,.45);
}
.digit-ball.accent { background: var(--c-accent); color: var(--c-on-accent); }
.digit-ball.ghost  { background: rgba(15,23,42,.08); color: var(--c-text); box-shadow: none; }
.digit-ball.xl { width: 3.6rem; height: 3.6rem; font-size: 1.8rem; }
.digit-ball.sm { width: 1.9rem; height: 1.9rem; font-size: .95rem; margin-right: .25rem; }

/* --------------------------------------------------------------- ป้าย */
.badge {
	display: inline-flex; align-items: center; gap: .25rem;
	padding: .18rem .6rem; border-radius: 9999px;
	font-size: .75rem; font-weight: 500;
}
.badge-primary { background: rgba(29,78,216,.12); color: var(--c-primary-dark); }
.badge-accent  { background: rgba(250,204,21,.25); color: #854D0E; }
.badge-ok      { background: #DCFCE7; color: #166534; }
.badge-no      { background: #FFE4E6; color: #9F1239; }
.badge-wait    { background: #E2E8F0; color: #475569; }

/* ------------------------------------------------------- เมนูหลังบ้าน */
.sidebar { background: var(--c-sidebar); }
.side-link {
	display: flex; align-items: center; gap: .65rem;
	padding: .6rem .9rem; border-radius: .7rem;
	color: rgba(255,255,255,.78); font-size: .9rem; text-decoration: none;
	transition: all .15s ease;
}
.side-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.side-link.is-active { background: var(--c-accent); color: var(--c-on-accent); font-weight: 600; }
.side-link svg { width: 1.15rem; height: 1.15rem; flex: none; }

/* ------------------------------------------------------- เมนูหน้าบ้าน */
.nav-link {
	padding: .45rem .85rem; border-radius: .6rem;
	color: rgba(255,255,255,.85); font-size: .9rem; text-decoration: none;
	transition: all .15s ease;
}
.nav-link:hover { background: rgba(255,255,255,.15); color: #fff; }
.nav-link.is-active { background: var(--c-accent); color: var(--c-on-accent); font-weight: 600; }

/* ------------------------------------------------------------ แถบสถิติ */
.stat-card { background: var(--c-surface); border-radius: 1rem; padding: 1.15rem 1.25rem; border: 1px solid rgba(15,23,42,.08); }
.stat-value { font-size: 1.75rem; font-weight: 600; line-height: 1.2; color: var(--c-primary-dark); }
.stat-label { font-size: .8rem; color: #64748B; }

.bar-track { height: .5rem; background: rgba(15,23,42,.08); border-radius: 9999px; overflow: hidden; }
.bar-fill  { height: 100%; background: var(--c-primary); border-radius: 9999px; }
.bar-fill.accent { background: var(--c-accent); }

/* ------------------------------------------------------------- อื่น ๆ */
.hero-gradient {
	background: linear-gradient(135deg, var(--c-primary-dark) 0%, var(--c-primary) 55%, var(--c-primary-light) 100%);
}
.divider { height: 1px; background: rgba(15,23,42,.08); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .05em; }

/* ------------------------------------------- คอลัมน์สถิติรายสูตร */
.stat-column {
	border: 1px solid rgba(15,23,42,.12);
	border-radius: .8rem;
	overflow: hidden;
	background: var(--c-surface);
}
.stat-column-head {
	display: flex; align-items: center; justify-content: center; gap: .4rem;
	background: #1B1B1B; color: #fff;
	padding: .55rem .75rem;
	font-size: .95rem; font-weight: 600;
}
.stat-column-head .pin { flex: none; font-size: .8rem; }

.stat-lines { max-height: 460px; overflow-y: auto; padding: .35rem 0; }

.stat-line {
	display: flex; align-items: baseline; gap: .5rem;
	padding: .12rem .75rem;
	font-size: .9rem; line-height: 1.6;
	font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.stat-line:nth-child(even) { background: rgba(15,23,42,.025); }
.stat-line .ln {
	flex: none; width: 1.6rem; text-align: right;
	font-size: .7rem; color: #94A3B8;
}
.stat-line .pred {
	flex: none; width: 2ch; text-align: right;
	color: var(--c-primary-dark); font-weight: 600;
}
.stat-line .sep { flex: none; color: #94A3B8; margin: 0 .1rem; }
.stat-line .act { color: var(--c-text); }
/* หลักร้อยของ 3 ตัวบน ไม่นำมาตรวจผิด-ถูก จึงแสดงให้จางลง */
.act-mute { opacity: .32; }
.stat-line .txt { color: var(--c-text); }
.stat-line.is-next {
	background: rgba(250,204,21,.18);
	font-weight: 600;
}

.mark-hit  { color: #0F9D58; font-weight: 700; letter-spacing: -.04em; }
.mark-miss { color: #E11D48; font-weight: 700; }
.mark-wait { color: #94A3B8; font-weight: 700; }

@media print {
	.no-print { display: none !important; }
	body { background: #fff; }
}

/* ------------------------------------ หน้าเลือกหวยเพื่อดูสถิติการทำนาย */
.lot-card {
	background: var(--c-surface);
	border: 1px solid rgba(15,23,42,.08);
	border-radius: .9rem;
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px -18px rgba(15,23,42,.35);
}
.lot-card-head {
	display: flex; align-items: center; justify-content: space-between; gap: .5rem;
	background: #7F8C8D; color: #fff;
	padding: .6rem .9rem;
	font-size: .9rem; font-weight: 500;
}
.lot-card-count {
	font-size: .72rem; font-weight: 400;
	background: rgba(255,255,255,.22);
	padding: .05rem .5rem; border-radius: 9999px;
}
.lot-card-body { padding: .85rem; }

.lot-grid {
	display: grid; gap: .5rem;
	/* 5.5rem ทำให้การ์ดกลุ่มที่เรียง 4 ใบต่อแถวยังวางปุ่มได้ 2 คอลัมน์ ไม่กลายเป็นแถวเดี่ยวยาว */
	grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
}

.lot-btn {
	--lot-bg: #64748B;
	display: flex; align-items: center; justify-content: center;
	background: var(--lot-bg); color: #fff;
	padding: .5rem .35rem; border-radius: .4rem;
	font-size: .8rem; line-height: 1.3; text-align: center; text-decoration: none;
	transition: filter .15s ease, transform .1s ease;
}
.lot-btn:hover  { filter: brightness(1.13); color: #fff; }
.lot-btn:active { transform: translateY(1px); }
.lot-btn-name   { display: block; }
/* ยังไม่มีผลย้อนหลัง กดเข้าไปได้แต่บอกให้รู้ว่ายังคำนวณไม่ได้ */
.lot-btn.is-empty   { opacity: .42; }
.lot-btn.is-current { outline: 3px solid var(--c-accent); outline-offset: 1px; font-weight: 600; }

/* สีประจำกลุ่มหวย */
.lot-g-red    { --lot-bg: #C0392B; }
.lot-g-blue   { --lot-bg: #2E86C1; }
.lot-g-green  { --lot-bg: #27AE60; }
.lot-g-teal   { --lot-bg: #16A085; }
.lot-g-slate  { --lot-bg: #64748B; }
.lot-g-violet { --lot-bg: #7C3AED; }
/* การ์ดเครื่องมือช่วยเหลือ ใช้สีหลักของเว็บ จะได้เปลี่ยนตามโทนสีที่ผู้ดูแลตั้งไว้ */
.lot-g-primary { --lot-bg: var(--c-primary); }

.lot-dot {
	display: inline-block; width: .7rem; height: .7rem; border-radius: 9999px;
	background: var(--lot-bg, #64748B); flex: none;
}

/* เลขที่หลายสูตรเห็นตรงกัน */
.agree-pill {
	display: inline-flex; align-items: center; gap: .3rem;
	background: var(--c-surface); border: 1px solid rgba(15,23,42,.12);
	border-radius: 9999px; padding: .1rem .55rem .1rem .1rem;
}
.agree-pill .agree-d {
	display: inline-grid; place-items: center;
	width: 1.6rem; height: 1.6rem; border-radius: 9999px;
	background: rgba(15,23,42,.08); color: var(--c-text);
	font-weight: 600; font-size: .9rem;
}
.agree-pill .agree-n { font-size: .7rem; color: #64748B; }
.agree-pill.is-strong .agree-d { background: var(--c-accent); color: var(--c-on-accent); }
.agree-pill.is-strong { border-color: var(--c-accent-dark); }

/* ------------------- ตารางสูตร : จอเล็ก 2 สูตร/แถว จอคอม 5 สูตร/แถว */
.formula-grid {
	display: grid; gap: .85rem;
	align-items: start;               /* การ์ดสูงเท่าเนื้อหาของตัวเอง ไม่ยืดตามการ์ดที่สูงสุด */
	grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 1024px) {
	.formula-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .7rem; }
}
@media (min-width: 1536px) {
	.formula-grid { gap: 1rem; }
}

/* คอลัมน์แคบลงกว่าหน้ารวม จึงย่อตัวอักษรและระยะห่างให้พอดี */
.formula-grid .stat-column-head { font-size: .92rem; padding: .45rem .5rem; gap: .25rem; }
.formula-grid .stat-column-head .pin { font-size: .7rem; }
/* สูงพอดีกับจำนวนบรรทัด ไม่ต้องมีแถบเลื่อนในกล่องทุกขนาดจอ */
.formula-grid .stat-lines { max-height: none; overflow: visible; }
.formula-grid .stat-line { font-size: .8rem; padding: .1rem .5rem; gap: .3rem; }
.formula-grid .stat-line .ln { width: 1.35rem; font-size: .62rem; }
.formula-grid .stat-line .pred { width: 2ch; }

/* 5 คอลัมน์ทำให้แต่ละคอลัมน์แคบลง จึงย่อตัวอักษรลงอีกขั้นในช่วงจอ 1024-1439px
   เผื่อที่ไว้ให้เลขลำดับงวด 3 หลักด้วย เพราะชุดที่สะสมข้อมูลนาน ๆ จะเกิน 99 งวด */
@media (min-width: 1024px) and (max-width: 1439px) {
	.formula-grid .stat-line { font-size: .7rem; padding: .1rem .25rem; gap: .2rem; }
	.formula-grid .stat-line .ln { width: 1rem; font-size: .56rem; }
	.formula-grid .stat-column-head { font-size: .84rem; padding: .4rem .3rem; }
}

/* แท็บสูตรตระกูลวิน (F31-F38) : เลขทำนายยาว 6-7 หลัก ต้องบีบตัวอักษรเป็นพิเศษ
   จำนวนคอลัมน์เท่าแท็บอื่น คือมือถือแถวละ 2 สูตร จอคอมแถวละ 5 สูตร
   (ดูบล็อก max-width: 639px และ 1024-1439px ที่ย่อตัวอักษรให้พอดี) */
.formula-grid.is-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1024px) {
	.formula-grid.is-wide { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.stat-line .pred.is-wide,
.formula-grid .stat-line .pred.is-wide { width: 7ch; }

/* จอมือถือ : 2 คอลัมน์ x (เลขวิน 7 หลัก + ผลจริง 5 หลัก) ต้องบีบให้พอดีไม่ให้ล้นขอบจอ
   ใช้ specificity สูงกว่าบล็อก max-width: 480px ด้านล่างจึงทับค่าได้ไม่ว่าลำดับใด */
@media (max-width: 639px) {
	.formula-grid.is-wide .stat-line { font-size: .66rem; padding: .1rem .2rem; gap: .14rem; letter-spacing: 0; }
	.formula-grid.is-wide .stat-line .ln { width: .95rem; font-size: .52rem; }
	.formula-grid.is-wide .stat-line .sep { margin: 0; }
	.formula-grid.is-wide .stat-column-head { font-size: .78rem; padding: .35rem .25rem; gap: .15rem; }
	/* ชื่อสูตรตัวใหญ่ขึ้นแล้วอาจยาวเกินคอลัมน์แคบ ยอมให้ตัดเป็นสองบรรทัดดีกว่าตัดคำทิ้ง */
	.formula-grid.is-wide .stat-column-head .truncate { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.2; }
	.formula-grid.is-wide .stat-column-head .pin { display: none; }
	.formula-grid.is-wide .stat-column-next { padding: .45rem .25rem; gap: .2rem; }
	.formula-grid.is-wide .stat-column-sum { font-size: .6rem; padding: .3rem .3rem; }
	.formula-grid.is-wide .stat-column-sum .badge { padding: .05rem .35rem; font-size: .6rem; }
	.formula-grid.is-wide .stat-column-next .digit-ball.sm { width: 1.25rem; height: 1.25rem; font-size: .68rem; }
	.formula-grid.is-wide .stat-copy { width: 1.25rem; height: 1.25rem; font-size: .7rem; }
	.formula-grid.is-wide .stat-pool { gap: .15rem; margin-top: .25rem; padding-top: .25rem; }
	.formula-grid.is-wide .stat-pool-label { font-size: .52rem; }
	.formula-grid.is-wide .stat-pool-digits .pd { font-size: .64rem; }
}

/* ปุ่มคัดลอกเลขวินของงวดถัดไป อยู่ในแถบสีเหลืองท้ายคอลัมน์
   มีแต่ไอคอนอย่างเดียว คอลัมน์แคบมากจึงไม่มีที่ให้ข้อความ
   ผลการกดบอกด้วยการเปลี่ยนไอคอนเป็น ✓ / ✕ (ดู .btn-copy-icon ใน app.js) */
.stat-copy {
	display: inline-flex; align-items: center; justify-content: center;
	width: 1.5rem; height: 1.5rem; padding: 0; border-radius: 9999px;
	background: var(--c-surface); border: 1px solid rgba(15,23,42,.18);
	color: var(--c-primary-dark); font-family: inherit; font-size: .8rem; font-weight: 500;
	line-height: 1; cursor: pointer;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.stat-copy:hover { background: rgba(29,78,216,.08); }
.stat-copy.is-done { background: var(--c-accent); border-color: var(--c-accent-dark); color: var(--c-on-accent); }
.stat-copy.is-fail { background: rgba(220,38,38,.12); border-color: rgba(220,38,38,.5); color: #B91C1C; }

/* แถวเลขเต็มที่สูตรเรียงไว้ก่อนคัดเลข ตัวจางคือเลขที่ถูกตัดทิ้ง */
.stat-pool {
	width: 100%;
	display: flex; align-items: center; justify-content: center;
	flex-wrap: wrap; gap: .25rem;
	margin-top: .3rem; padding-top: .3rem;
	border-top: 1px dashed rgba(15,23,42,.15);
}
.stat-pool-label { font-size: .6rem; color: #64748B; white-space: nowrap; }
.stat-pool-digits { display: inline-flex; gap: .06rem; letter-spacing: .02em; }
.stat-pool-digits .pd {
	font-size: .78rem; font-weight: 600; line-height: 1.2;
	color: var(--c-primary-dark);
}
.stat-pool-digits .pd.is-cut {
	color: #94A3B8; font-weight: 400;
	text-decoration: line-through;
	text-decoration-thickness: 1px;
}

.stat-column-next {
	display: flex; align-items: center; justify-content: center;
	flex-wrap: wrap; gap: .3rem;
	padding: .6rem .5rem;
	background: rgba(250,204,21,.15);
	border-top: 1px solid rgba(15,23,42,.08);
}
.stat-column-next .digit-ball { margin-right: 0; }

@media (max-width: 480px) {
	.formula-grid { gap: .6rem; }
	.formula-grid .stat-line { font-size: .72rem; padding: .1rem .3rem; gap: .22rem; }
	.formula-grid .stat-line .ln { width: 1.15rem; font-size: .58rem; }
	.formula-grid .stat-column-head { font-size: .84rem; padding: .4rem .3rem; }
	.lot-grid { gap: .4rem; }
	.lot-btn { font-size: .72rem; padding: .45rem .25rem; }
}

/* ------------------------------------------------ ระบบสมาชิก : แพ็กเกจ */
.plan-option {
	display: block; cursor: pointer;
	border: 2px solid rgba(15,23,42,.12); border-radius: .9rem;
	padding: 1rem; text-align: center;
	transition: border-color .15s ease, background .15s ease;
}
.plan-option:hover { border-color: var(--c-primary-light); }
.plan-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.plan-option.is-selected,
.plan-option:focus-within { border-color: var(--c-accent); background: rgba(250,204,21,.08); }
.plan-body  { display: block; }
.plan-name  { display: block; font-size: .85rem; color: #64748B; margin-bottom: .3rem; }
.plan-price { display: block; font-size: 1.9rem; font-weight: 600; color: var(--c-primary-dark); line-height: 1.2; }
.plan-price small { font-size: .85rem; font-weight: 400; color: #64748B; }
.plan-sub   { display: block; font-size: .78rem; color: #94A3B8; margin-top: .25rem; }
.plan-save  { display: inline-block; margin-top: .5rem; font-size: .72rem;
              background: rgba(250,204,21,.3); color: #854D0E; padding: .15rem .6rem; border-radius: 9999px; }

/* ป้ายตัวเลขบนเมนูข้าง */
.side-badge {
	flex: none; min-width: 1.35rem; text-align: center;
	background: #E11D48; color: #fff;
	font-size: .7rem; font-weight: 600; line-height: 1.35rem;
	border-radius: 9999px; padding: 0 .3rem;
}

/* ------------------------------------------------------ กระดิ่งแจ้งเตือน */
.noti-wrap { position: relative; }
.noti-btn {
	position: relative; display: grid; place-items: center;
	width: 2.25rem; height: 2.25rem; border-radius: .7rem;
	background: rgba(15,23,42,.05); color: var(--c-text);
	border: none; cursor: pointer; transition: background .15s ease;
}
.noti-btn:hover { background: rgba(15,23,42,.1); }
.noti-btn svg { width: 1.2rem; height: 1.2rem; }
.noti-dot {
	position: absolute; top: -.3rem; right: -.3rem;
	background: #E11D48; color: #fff;
	font-size: .65rem; font-weight: 600; line-height: 1.1rem;
	min-width: 1.1rem; padding: 0 .25rem; border-radius: 9999px;
}

.noti-panel {
	position: absolute; right: 0; top: calc(100% + .5rem); z-index: 50;
	width: min(22rem, calc(100vw - 2rem));
	background: var(--c-surface);
	border: 1px solid rgba(15,23,42,.12);
	border-radius: .9rem; overflow: hidden;
	box-shadow: 0 12px 32px -12px rgba(15,23,42,.4);
	max-height: 26rem; overflow-y: auto;
}
.noti-head {
	display: flex; align-items: center; justify-content: space-between;
	padding: .65rem .9rem; font-size: .85rem; font-weight: 500;
	background: rgba(15,23,42,.03);
	border-bottom: 1px solid rgba(15,23,42,.08);
}
.noti-empty { padding: 1.5rem .9rem; text-align: center; font-size: .85rem; color: #94A3B8; }
.noti-item {
	display: block; padding: .7rem .9rem; text-decoration: none; color: var(--c-text);
	border-bottom: 1px solid rgba(15,23,42,.06);
}
.noti-item:hover { background: rgba(29,78,216,.05); }
.noti-item.is-unread { background: rgba(250,204,21,.1); }
.noti-item.is-unread .noti-title::before {
	content: ''; display: inline-block; width: .45rem; height: .45rem;
	border-radius: 9999px; background: #E11D48; margin-right: .4rem; vertical-align: middle;
}
.noti-title  { font-size: .85rem; font-weight: 500; }
.noti-detail { font-size: .78rem; color: #64748B; margin-top: .15rem; line-height: 1.5; }
.noti-time   { font-size: .7rem; color: #94A3B8; margin-top: .25rem; }

/* ------------------- บล็อคเลขแนะนำบนแดชบอร์ด : จอคอมแถวละ 5 บล็อค */
.suggest-grid {
	display: grid; gap: 1rem;
	align-items: start;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 768px) {
	.suggest-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
	/* 10 สูตรลงตัวพอดี 2 แถว : F1-F5 และ F6-F10 */
	.suggest-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; }
}
@media (min-width: 1536px) {
	.suggest-grid { gap: 1rem; }
}

/* การ์ดแคบลงมาก จึงย่อระยะห่างและตัวอักษรให้พอดีช่อง */
.suggest-grid .card-head { padding: .6rem .75rem; }
.suggest-grid .card-title { font-size: .82rem; }
.suggest-grid .card-body  { padding: .75rem; }

/* คำอธิบายวิธีคำนวณยาวเกินกว่าจะอ่านรู้เรื่องในช่องแคบ ๆ ตัดออกทั้งหมด
   (ดูชื่อเต็มได้จากหัวการ์ด และรายละเอียดที่เมนู "สูตรคำนวณ") */
.suggest-grid .card-head p { display: none; }

.suggest-grid .digit-ball.xl {
	width: 2.4rem; height: 2.4rem; font-size: 1.15rem; margin-right: 0;
}

/* กล่องเลขเด่นและกล่องเลขแนะนำ */
.suggest-grid .card-body > div:first-child { padding: .6rem !important; margin-bottom: .6rem !important; }
.suggest-grid .card-body > div:first-child > div:first-child { font-size: .72rem; margin-bottom: .35rem; }
.suggest-grid .card-body > div:first-child > div:last-child  { font-size: .65rem; margin-top: .35rem; line-height: 1.4; }

/* ช่องแคบเกินกว่าจะวาง 3 ตัวบน / 2 ตัวล่าง คู่กัน จึงเรียงลงมาแทน */
.suggest-grid .grid.grid-cols-2 { grid-template-columns: minmax(0, 1fr); gap: .4rem; margin-bottom: .6rem; }
.suggest-grid .grid.grid-cols-2 > div { padding: .45rem .3rem; }
.suggest-grid .grid.grid-cols-2 .text-2xl { font-size: 1.25rem; }
.suggest-grid .grid.grid-cols-2 .text-lg  { font-size: .95rem; }
.suggest-grid .grid.grid-cols-2 .text-xs  { font-size: .68rem; margin-bottom: .1rem; }

.suggest-grid .card-body > .text-xs:last-child { font-size: .65rem; margin-top: .5rem; line-height: 1.5; }

@media (min-width: 1536px) {
	.suggest-grid .card-title { font-size: .9rem; }
	.suggest-grid .digit-ball.xl { width: 2.8rem; height: 2.8rem; font-size: 1.35rem; }
	.suggest-grid .grid.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ช่วงจอ 1024-1279px การ์ดแคบราว 123px จึงย่อลงอีกขั้น
   ให้ลูกบอลเลขเด่นสองตัวอยู่บรรทัดเดียวกัน และเลข 2 ตัวล่างไม่ตกบรรทัด */
@media (min-width: 1024px) and (max-width: 1279px) {
	.suggest-grid .digit-ball.xl { width: 2.2rem; height: 2.2rem; font-size: 1.05rem; }
	.suggest-grid .card-body > div:first-child { padding: .5rem !important; }
	.suggest-grid .card-head { padding: .5rem .55rem; }
	.suggest-grid .card-body { padding: .55rem; }
	.suggest-grid .card-title { font-size: .76rem; }
	.suggest-grid .grid.grid-cols-2 > div { padding: .4rem .2rem; }
	.suggest-grid .grid.grid-cols-2 .text-2xl { font-size: 1.1rem; }
	.suggest-grid .grid.grid-cols-2 .text-lg  { font-size: .8rem; }
}

/* หน้าคำนวณ/บันทึกผล แสดงขั้นตอนการคำนวณด้วย จึงต้องย่อส่วนนี้ให้พอดีช่องแคบ
   (บนแดชบอร์ดไม่แสดงขั้นตอน กฎชุดนี้จึงไม่มีผลที่นั่น) */
.suggest-grid .card-body .space-y-2 > div {
	flex-direction: column; align-items: stretch; gap: .15rem;
	padding: .35rem .45rem; font-size: .72rem;
}
.suggest-grid .card-body .space-y-2 > div .font-medium { font-size: .7rem; line-height: 1.35; }
.suggest-grid .card-body .space-y-2 > div .text-xs     { font-size: .64rem; line-height: 1.35; }
.suggest-grid .card-body .space-y-2 > div > div:last-child { text-align: right; font-size: .78rem; }

/* หัวข้อย่อย "ขั้นตอนการคำนวณ" / "คะแนนของเลข 0-9" */
.suggest-grid .card-body .text-sm.font-medium { font-size: .75rem; margin-bottom: .35rem; }

/* แถบคะแนนของเลข 0-9 */
.suggest-grid .bar-track { height: .35rem; }
.suggest-grid .space-y-1 > div { gap: .25rem; }
.suggest-grid .space-y-1 > div > span { font-size: .62rem; }
.suggest-grid .space-y-1 > div > span:first-child { width: .8rem; }
.suggest-grid .space-y-1 > div > span:last-child  { width: 1.4rem; }

/* ------------------- หน้าสูตรคำนวณ : จอคอมแถวละ 5 บล็อค */
.formula-settings-grid {
	display: grid; gap: 1rem;
	align-items: start;
	grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 768px)  { .formula-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .formula-settings-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; } }
@media (min-width: 1536px) { .formula-settings-grid { gap: 1rem; } }

/* ช่องกรอกในการ์ดแคบ ๆ ต้องย่อลง ไม่งั้นล้นออกนอกการ์ด */
@media (min-width: 1024px) {
	.formula-settings-grid .card-head { padding: .6rem .7rem; }
	.formula-settings-grid .card-title { font-size: .78rem; }
	.formula-settings-grid .card-body { padding: .7rem; }
	.formula-settings-grid .label { font-size: .72rem; margin-bottom: .2rem; }
	.formula-settings-grid .input,
	.formula-settings-grid .select,
	.formula-settings-grid .textarea { padding: .35rem .5rem; font-size: .75rem; border-radius: .5rem; }
	.formula-settings-grid .textarea { min-height: 60px !important; line-height: 1.5; }
	.formula-settings-grid .help { font-size: .64rem; line-height: 1.4; margin-top: .2rem; }
	.formula-settings-grid .btn { padding: .4rem .6rem; font-size: .75rem; }

	/* พารามิเตอร์ที่เดิมวางเรียงข้างกัน ให้เรียงลงมาแทน */
	.formula-settings-grid .grid { grid-template-columns: minmax(0, 1fr) !important; gap: .5rem !important; }
	.formula-settings-grid .mb-4 { margin-bottom: .55rem; }

	/* กล่องตัวอย่างสูตร : ตัดคำแทนการล้นออกนอกกรอบ */
	.formula-settings-grid .mono { font-size: .62rem; letter-spacing: 0; overflow-wrap: anywhere; }
	.formula-settings-grid .text-xs { font-size: .66rem; line-height: 1.5; }
	.formula-settings-grid .rounded-xl.p-3 { padding: .45rem .5rem; }
	.formula-settings-grid .digit-ball { width: 1.9rem; height: 1.9rem; font-size: .95rem; margin-right: .2rem; }
}

/* ---------------------------------------- แท็บแบ่งชุดสูตร (F1-F10 / F11-F20) */
.ftabs { display: block; }
.ftab-nav {
	display: flex; flex-wrap: wrap; gap: .4rem;
	margin-bottom: .9rem;
	border-bottom: 2px solid rgba(15,23,42,.08);
	padding-bottom: .5rem;
}
.ftab-btn {
	display: inline-flex; align-items: center; gap: .4rem;
	padding: .45rem 1rem; border-radius: .7rem .7rem 0 0;
	background: rgba(15,23,42,.05); color: #475569;
	border: none; cursor: pointer;
	font-size: .85rem; font-weight: 500; font-family: inherit;
	transition: background .15s ease, color .15s ease;
}
.ftab-btn:hover { background: rgba(15,23,42,.1); }
.ftab-btn.is-active {
	background: var(--c-primary); color: var(--c-on-primary); font-weight: 600;
}
.ftab-btn .ftab-count {
	font-size: .7rem; opacity: .75;
	background: rgba(255,255,255,.25); padding: 0 .4rem; border-radius: 9999px;
}
.ftab-btn:not(.is-active) .ftab-count { background: rgba(15,23,42,.08); }

.ftab-panel { display: none; }
.ftab-panel.is-active { display: block; }

@media (max-width: 480px) {
	.ftab-btn { padding: .4rem .7rem; font-size: .78rem; }
}

/* ป้ายอันดับความแม่นยำบนคอลัมน์สถิติ */
.rank-chip {
	display: inline-block; margin-right: .2rem;
	background: rgba(15,23,42,.08); color: #475569;
	font-size: .62rem; font-weight: 600;
	padding: 0 .3rem; border-radius: 9999px;
	vertical-align: middle;
}

/* ------------------------------------------------------------ วินเลข */
.win-chip {
	display: inline-flex; align-items: center; gap: .25rem;
	background: rgba(15,23,42,.05); border-radius: 9999px;
	padding: .1rem .1rem .1rem .5rem;
	font-size: .7rem; color: #475569;
}
.win-chip-code  { font-weight: 600; }
.win-chip-digit {
	display: inline-grid; place-items: center;
	width: 1.3rem; height: 1.3rem; border-radius: 9999px;
	background: var(--c-primary); color: var(--c-on-primary);
	font-size: .72rem; font-weight: 600;
}

.win-lines {
	border: 1px solid rgba(15,23,42,.1); border-radius: .7rem;
	overflow: hidden; padding: .2rem 0;
}
.win-line {
	display: flex; align-items: baseline; gap: .45rem;
	padding: .15rem .6rem;
	font-size: .82rem; line-height: 1.6;
	font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.win-line:nth-child(even) { background: rgba(15,23,42,.025); }
.win-line .ln  { flex: none; width: 1.6rem; text-align: right; font-size: .68rem; color: #94A3B8; }
.win-line .sep { flex: none; color: #94A3B8; }
.win-line .act { color: var(--c-text); }
.win-line .win-digits {
	flex: 1; font-weight: 600; color: var(--c-primary-dark); letter-spacing: .08em;
}
.win-marks { flex: none; display: inline-flex; gap: .3rem; }
.win-marks span { font-weight: 700; font-size: .8rem; }

@media (max-width: 480px) {
	.win-line { font-size: .74rem; padding: .12rem .4rem; gap: .3rem; }
	.win-line .ln { width: 1.3rem; font-size: .62rem; }
}

/* ------------------------------------------------- รูปโปรไฟล์ / ห้องสนทนา */

.avatar {
	flex: none; display: inline-grid; place-items: center;
	border-radius: 999px; object-fit: cover; overflow: hidden;
	background: rgba(15,23,42,.08);
}
.avatar-text { color: #fff; font-weight: 600; line-height: 1; }
.av-xs { width: 1.35rem; height: 1.35rem; font-size: .65rem; }
.av-sm { width: 2.1rem;  height: 2.1rem;  font-size: .9rem; }
.av-md { width: 2.8rem;  height: 2.8rem;  font-size: 1.15rem; }
.av-lg { width: 6rem;    height: 6rem;    font-size: 2.6rem; }

/* รายการห้อง / รายชื่อผู้ใช้ */
.room-list { display: flex; flex-direction: column; gap: .25rem; }
.room-item {
	display: flex; align-items: center; gap: .7rem;
	padding: .55rem .6rem; border-radius: .7rem;
	color: var(--c-text); text-decoration: none;
	transition: background .15s ease;
}
.room-item:hover   { background: rgba(15,23,42,.05); }
.room-item.is-active { background: rgba(29,78,216,.1); }
.room-main    { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.room-title   { font-size: .9rem; font-weight: 500; display: flex; align-items: center; gap: .35rem; }
.room-title, .room-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-preview { font-size: .76rem; color: #64748B; }
.room-tag     { font-size: .62rem; padding: .05rem .35rem; }
.room-side    { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }
.room-time    { font-size: .68rem; color: #94A3B8; white-space: nowrap; }
.room-unread {
	min-width: 1.25rem; padding: 0 .35rem; border-radius: 999px;
	background: var(--c-accent); color: var(--c-on-accent);
	font-size: .68rem; font-weight: 700; text-align: center; line-height: 1.25rem;
}

/* โครงหน้าห้องสนทนา */
.chat-wrap { display: grid; grid-template-columns: 17rem 1fr; gap: 1.25rem; align-items: start; }
.chat-side-body { display: flex; flex-direction: column; }
.chat-main { display: flex; flex-direction: column; height: calc(100vh - 12rem); min-height: 26rem; }
.chat-head { display: flex; align-items: center; gap: .7rem; }
.chat-back { display: none; font-size: 1.15rem; color: var(--c-primary); text-decoration: none; }

.chat-members {
	display: flex; flex-wrap: wrap; gap: .4rem;
	padding: .7rem 1rem; border-bottom: 1px solid rgba(15,23,42,.08);
	background: rgba(15,23,42,.02);
}
.chat-chip {
	display: inline-flex; align-items: center; gap: .35rem;
	padding: .18rem .5rem .18rem .2rem; border-radius: 999px;
	background: var(--c-surface); border: 1px solid rgba(15,23,42,.1);
	font-size: .76rem;
}
.chat-chip-tag { font-size: .62rem; color: var(--c-primary-dark); font-weight: 600; }

/* พื้นที่ข้อความ */
.chat-stream {
	flex: 1; overflow-y: auto; padding: 1rem;
	display: flex; flex-direction: column; gap: .7rem;
	background: rgba(15,23,42,.02);
}
.chat-empty { margin: auto; font-size: .85rem; color: #94A3B8; text-align: center; }

.msg { display: flex; align-items: flex-start; gap: .5rem; max-width: 78%; }
.msg-mine { margin-left: auto; flex-direction: row-reverse; }
.msg-avatar { margin-top: 1.1rem; }
.msg-body { min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.msg-mine .msg-body { align-items: flex-end; }
.msg-who { font-size: .72rem; color: #64748B; display: flex; align-items: center; gap: .3rem; }
.msg-tag { font-size: .58rem; padding: .02rem .3rem; }

.bubble {
	padding: .5rem .8rem; border-radius: 1rem;
	background: var(--c-surface); border: 1px solid rgba(15,23,42,.08);
	font-size: .88rem; line-height: 1.6; word-break: break-word;
}
.msg-mine .bubble {
	background: var(--c-primary); color: var(--c-on-primary); border-color: transparent;
}
.bubble-gone { font-style: italic; color: #94A3B8; background: rgba(15,23,42,.04); }
.msg-mine .bubble-gone { color: rgba(255,255,255,.75); background: rgba(29,78,216,.55); }

.chat-link { text-decoration: underline; color: var(--c-primary-dark); }
.msg-mine .chat-link { color: #fff; }

.msg-image { display: block; max-width: 16rem; max-height: 16rem; border-radius: .6rem; }
.bubble-img { padding: .25rem; }

.msg-foot { display: flex; gap: .5rem; font-size: .66rem; color: #94A3B8; padding: 0 .3rem; }
.msg-del { color: #E11D48; text-decoration: none; }
.msg-del:hover { text-decoration: underline; }

/* ช่องพิมพ์ */
.chat-compose { border-top: 1px solid rgba(15,23,42,.08); padding: .7rem 1rem; }
.chat-compose-row { display: flex; align-items: flex-end; gap: .5rem; }
.chat-input {
	flex: 1; resize: none; max-height: 140px;
	padding: .55rem .8rem; border-radius: .8rem;
	border: 1px solid rgba(15,23,42,.15); background: var(--c-surface);
	font-size: .88rem; line-height: 1.5;
}
.chat-input:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.chat-send { flex: none; }
.chat-attach {
	flex: none; width: 2.4rem; height: 2.4rem; border-radius: .7rem;
	display: grid; place-items: center; cursor: pointer;
	background: rgba(15,23,42,.05); color: var(--c-text);
}
.chat-attach:hover { background: rgba(15,23,42,.1); }
.chat-attach svg { width: 1.2rem; height: 1.2rem; }

.chat-preview { position: relative; display: inline-block; margin-bottom: .5rem; }
.chat-preview img { max-height: 6rem; border-radius: .6rem; display: block; }
.chat-preview-x {
	position: absolute; top: -.4rem; right: -.4rem;
	width: 1.4rem; height: 1.4rem; border-radius: 999px;
	background: #E11D48; color: #fff; font-size: .9rem; line-height: 1.4rem;
	border: none; cursor: pointer;
}
.chat-note { font-size: .72rem; color: #64748B; min-height: 1rem; margin-top: .3rem; }
.chat-note.is-bad { color: #E11D48; }
.chat-muted { font-size: .82rem; color: #9F1239; background: #FFE4E6; text-align: center; }

/* ป้ายจำนวนข้อความใหม่บนเมนู */
.nav-dot {
	display: inline-block; min-width: 1.15rem; padding: 0 .3rem;
	margin-left: .25rem; border-radius: 999px;
	background: var(--c-accent); color: var(--c-on-accent);
	font-size: .65rem; font-weight: 700; line-height: 1.15rem; text-align: center;
}

@media (max-width: 1023px) {
	.chat-wrap { grid-template-columns: 1fr; }
	.chat-side { display: none; }
	.chat-back { display: inline-block; }
	.chat-main { height: calc(100vh - 10rem); }
	.msg { max-width: 88%; }
}

/* ------------------------------------------------- กล่องสนทนาลอย มุมขวาล่าง */

.chat-dock {
	position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
	display: flex; flex-direction: column; align-items: flex-end; gap: .5rem;
	pointer-events: none;            /* ให้คลิกทะลุไปหน้าเว็บได้ ยกเว้นลูกที่เปิดไว้ */
}
.chat-dock > * { pointer-events: auto; }

/* ปุ่มลอย */
.dock-launcher {
	position: relative; width: 3.4rem; height: 3.4rem; border-radius: 999px;
	display: grid; place-items: center; border: none; cursor: pointer;
	background: var(--c-primary); color: var(--c-on-primary);
	box-shadow: 0 10px 25px -8px rgba(15,23,42,.55);
	transition: transform .15s ease, background .15s ease;
}
.dock-launcher:hover { background: var(--c-primary-dark); transform: translateY(-2px); }
.dock-launcher svg { width: 1.6rem; height: 1.6rem; }
.dock-badge {
	position: absolute; top: -.2rem; right: -.2rem;
	min-width: 1.3rem; padding: 0 .3rem; border-radius: 999px;
	background: var(--c-accent); color: var(--c-on-accent);
	font-size: .68rem; font-weight: 700; line-height: 1.3rem; text-align: center;
	border: 2px solid var(--c-surface);
}

/* แถบแท็บ */
.dock-tabs { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; max-width: 22rem; }
.dock-tab {
	display: flex; align-items: center; border-radius: 999px; overflow: hidden;
	background: var(--c-surface); border: 1px solid rgba(15,23,42,.12);
	box-shadow: 0 6px 16px -10px rgba(15,23,42,.5);
}
.dock-tab.is-active { border-color: var(--c-primary); box-shadow: 0 0 0 2px rgba(29,78,216,.18); }
.dock-tab-main {
	display: flex; align-items: center; gap: .35rem;
	padding: .2rem .15rem .2rem .2rem; max-width: 9rem;
	border: none; background: none; cursor: pointer; color: var(--c-text);
}
.dock-tab-name {
	font-size: .76rem; max-width: 5.6rem;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dock-tab-dot {
	min-width: 1.1rem; padding: 0 .25rem; border-radius: 999px;
	background: var(--c-accent); color: var(--c-on-accent);
	font-size: .62rem; font-weight: 700; line-height: 1.1rem; text-align: center;
}
.dock-tab-x {
	border: none; background: none; cursor: pointer;
	padding: .2rem .5rem .2rem .3rem; font-size: 1rem; line-height: 1;
	color: #94A3B8;
}
.dock-tab-x:hover { color: #E11D48; }

/* หน้าต่างคุย และกล่องรายการ */
.dock-win, .dock-list {
	width: 20rem; background: var(--c-surface);
	border: 1px solid rgba(15,23,42,.12); border-radius: 1rem;
	box-shadow: 0 20px 45px -20px rgba(15,23,42,.6);
	display: flex; flex-direction: column; overflow: hidden;
}
.dock-win { height: 26rem; }
.dock-list { max-height: 24rem; }

.dock-win-head {
	display: flex; align-items: center; gap: .45rem;
	padding: .5rem .6rem; border-bottom: 1px solid rgba(15,23,42,.08);
	background: var(--c-primary); color: var(--c-on-primary);
}
.dock-win-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.dock-win-title { font-size: .84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-win-sub   { font-size: .66rem; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-icon {
	flex: none; width: 1.5rem; height: 1.5rem; border-radius: .4rem;
	display: grid; place-items: center; border: none; cursor: pointer;
	background: rgba(255,255,255,.15); color: inherit;
	font-size: .95rem; line-height: 1; text-decoration: none;
}
.dock-icon:hover { background: rgba(255,255,255,.3); }

.dock-stream {
	flex: 1; overflow-y: auto; padding: .7rem;
	display: flex; flex-direction: column; gap: .5rem;
	background: rgba(15,23,42,.02);
}
.dock-stream .msg { max-width: 90%; }
.dock-stream .bubble { font-size: .8rem; padding: .4rem .65rem; }
.dock-stream .msg-image { max-width: 10rem; max-height: 10rem; }
.dock-empty { margin: auto; font-size: .78rem; color: #94A3B8; text-align: center; padding: 1rem; }

.dock-compose { border-top: 1px solid rgba(15,23,42,.08); padding: .5rem .6rem; }
.dock-compose-row { display: flex; align-items: flex-end; gap: .35rem; }
.dock-input {
	flex: 1; resize: none; max-height: 90px;
	padding: .4rem .6rem; border-radius: .7rem;
	border: 1px solid rgba(15,23,42,.15); background: var(--c-surface);
	font-size: .82rem; line-height: 1.45;
}
.dock-input:focus { outline: none; border-color: var(--c-primary); }
.dock-attach, .dock-send {
	flex: none; width: 2rem; height: 2rem; border-radius: .6rem;
	display: grid; place-items: center; cursor: pointer; border: none;
}
.dock-attach { background: rgba(15,23,42,.05); color: var(--c-text); }
.dock-attach:hover { background: rgba(15,23,42,.1); }
.dock-send { background: var(--c-primary); color: var(--c-on-primary); }
.dock-send:hover { background: var(--c-primary-dark); }
.dock-attach svg, .dock-send svg { width: 1rem; height: 1rem; }

.dock-preview { position: relative; display: inline-block; margin-bottom: .4rem; }
.dock-preview img { max-height: 4rem; border-radius: .5rem; display: block; }
.dock-preview-x {
	position: absolute; top: -.35rem; right: -.35rem;
	width: 1.2rem; height: 1.2rem; border-radius: 999px;
	background: #E11D48; color: #fff; font-size: .8rem; line-height: 1.2rem;
	border: none; cursor: pointer;
}
.dock-note { font-size: .66rem; color: #64748B; min-height: .9rem; margin-top: .2rem; }
.dock-note.is-bad { color: #E11D48; }
.dock-muted {
	padding: .55rem .6rem; font-size: .74rem; text-align: center;
	background: #FFE4E6; color: #9F1239; border-top: 1px solid rgba(15,23,42,.08);
}

/* กล่องรายการ */
.dock-list-head {
	display: flex; align-items: center; gap: .5rem;
	padding: .6rem .7rem; border-bottom: 1px solid rgba(15,23,42,.08);
}
.dock-mini-link { margin-left: auto; font-size: .7rem; color: var(--c-primary); text-decoration: underline; }
.dock-x { border: none; background: none; cursor: pointer; font-size: 1.15rem; line-height: 1; color: #94A3B8; }
.dock-x:hover { color: var(--c-text); }
.dock-list-search { padding: .5rem .7rem; border-bottom: 1px solid rgba(15,23,42,.06); }
.dock-list-search .input { font-size: .8rem; padding: .4rem .6rem; }
.dock-list-body { overflow-y: auto; padding: .35rem; }
.dock-sec { font-size: .66rem; color: #94A3B8; padding: .4rem .5rem .2rem; font-weight: 600; }
.dock-row {
	width: 100%; display: flex; align-items: center; gap: .5rem;
	padding: .4rem .5rem; border: none; background: none; cursor: pointer;
	border-radius: .6rem; text-align: left; color: var(--c-text);
}
.dock-row:hover { background: rgba(15,23,42,.05); }
.dock-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dock-row-title, .dock-row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-row-title { font-size: .8rem; font-weight: 500; }
.dock-row-sub   { font-size: .7rem; color: #64748B; }
.dock-row-tag   { font-size: .6rem; color: var(--c-primary-dark); font-weight: 600; }

@media (max-width: 640px) {
	.chat-dock { right: .6rem; bottom: .6rem; left: .6rem; align-items: flex-end; }
	.dock-win, .dock-list { width: 100%; }
	.dock-win { height: 70vh; }
	.dock-tabs { max-width: 100%; }
}

/* ------------------------------------------------- จุดบอกสถานะออนไลน์ */

.av-wrap { position: relative; display: inline-block; flex: none; line-height: 0; }
.av-dot {
	position: absolute; right: -1px; bottom: -1px;
	width: .62rem; height: .62rem; border-radius: 999px;
	border: 2px solid var(--c-surface);
	box-sizing: content-box;
}
.av-dot.is-on  { background: #22C55E; }
.av-dot.is-off { background: #CBD5E1; }

/* รูปใหญ่ใช้จุดใหญ่ตาม ไม่งั้นจุดจะเล็กจนมองไม่เห็น */
.av-wrap .av-lg + .av-dot { width: 1rem; height: 1rem; right: 2px; bottom: 2px; }
.av-wrap .av-xs + .av-dot { width: .42rem; height: .42rem; border-width: 1.5px; }

/* จุดบนพื้นเข้ม เช่น หัวหน้าต่างของกล่องลอย ต้องใช้ขอบสีเดียวกับพื้น */
.dock-win-head .av-dot { border-color: var(--c-primary); }

/* ข้อความสถานะ */
.pres { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; }
.pres::before {
	content: ''; width: .45rem; height: .45rem; border-radius: 999px; background: #CBD5E1;
}
.pres.is-on { color: #15803D; }
.pres.is-on::before { background: #22C55E; }
.pres.is-off { color: #94A3B8; }

/* ป้ายนับคนออนไลน์ */
.online-chip {
	display: inline-flex; align-items: center; gap: .35rem;
	padding: .15rem .55rem; border-radius: 999px;
	background: #DCFCE7; color: #166534; font-size: .72rem; font-weight: 500;
}
.online-chip::before {
	content: ''; width: .45rem; height: .45rem; border-radius: 999px; background: #22C55E;
}

.dock-sec-on { color: #15803D; font-weight: 500; }

/* --------------------------------------------- แถบสรุปงวดถัดไป (hero) */
/* วันที่ของการ์ด อยู่ใต้ปุ่มคัดลอกรูป และติดไปกับรูปด้วย */
.hero-date {
	margin: .9rem 0 0;
	font-size: 1rem; font-weight: 500; line-height: 1.4;
	color: rgba(255,255,255,.92);
}
@media (max-width: 480px) {
	.hero-date { font-size: .92rem; margin-top: .75rem; }
}

/* ข้อความท้ายการ์ดเลขเด่น (ผู้ดูแลตั้งเองที่หน้าตั้งค่า) ติดไปกับรูปที่คัดลอกด้วย
   ใช้กรอบโค้งมนพื้นโปร่งชุดเดียวกับกล่องเลขเด่น จะได้ดูเป็นการ์ดใบเดียวกัน */
.hero-note-row { margin-top: 1.25rem; text-align: center; }
/* จอคอมพิวเตอร์ : แถบสรุปวางสองคอลัมน์ กล่องเลขเด่นอยู่ขวาสุด
   จึงดันกรอบข้อความไปชิดขวาให้ขอบขวาตรงกับกล่องเลขเด่นพอดี */
@media (min-width: 1024px) {
	.hero-note-row { text-align: right; }
}
.hero-note {
	display: inline-block; max-width: 100%;
	padding: .55rem 1.5rem; border-radius: 1rem;
	background: rgba(255,255,255,.12);
	backdrop-filter: blur(4px);
	font-size: 1.25rem; font-weight: 600; line-height: 1.5;
	color: var(--c-accent);
	overflow-wrap: anywhere;
}
@media (max-width: 480px) {
	.hero-note-row { margin-top: 1rem; }
	.hero-note { font-size: 1.05rem; padding: .5rem 1.1rem; }
}

/* ชื่อชุดข้อมูลคือหัวเรื่องของแถบนี้ จึงใช้ขนาดเดียวกับหัวข้อใหญ่ */
.hero-setname {
	font-size: 1.75rem;
	line-height: 1.35;
	font-weight: 600;
	margin-bottom: .5rem;
}
@media (min-width: 640px) {
	.hero-setname { font-size: 2.1rem; }
}

/* ปุ่มคัดลอกข้อความไปวางในไลน์ อยู่บนพื้นเข้มจึงใช้พื้นโปร่งขอบขาว */
.btn-copy {
	display: inline-flex; align-items: center; gap: .45rem;
	padding: .5rem 1.1rem; border-radius: 9999px;
	background: rgba(255,255,255,.16);
	border: 1px solid rgba(255,255,255,.45);
	color: #fff; font-family: inherit; font-size: .9rem; font-weight: 500;
	cursor: pointer; transition: background .15s ease, border-color .15s ease;
}
.btn-copy:hover { background: rgba(255,255,255,.28); }
.btn-copy:active { background: rgba(255,255,255,.34); }
.btn-copy.is-done {
	background: var(--c-accent);
	border-color: var(--c-accent);
	color: var(--c-on-accent);
}
.btn-copy-icon { font-size: 1.05rem; line-height: 1; }

/* กล่องแสดงรูปสรุป สำหรับเครื่องที่คัดลอกรูปลงคลิปบอร์ดไม่ได้ (เว็บที่ไม่ใช่ https) */
.cardshot-mask {
	position: fixed; inset: 0; z-index: 1200;
	display: flex; align-items: center; justify-content: center;
	padding: 1rem; background: rgba(15,23,42,.72);
}
.cardshot-box {
	background: var(--c-surface); color: var(--c-text);
	border-radius: 1rem; padding: 1rem;
	max-width: min(92vw, 420px); max-height: 92vh; overflow: auto;
	text-align: center; box-shadow: 0 20px 45px -15px rgba(15,23,42,.6);
}
.cardshot-img {
	width: 100%; height: auto; border-radius: .9rem; display: block;
}
.cardshot-hint { font-size: .8rem; color: #64748B; margin: .7rem 0; line-height: 1.6; }
.cardshot-row { display: flex; gap: .5rem; justify-content: center; }
.cardshot-link {
	margin-top: .7rem; background: none; border: 0; cursor: pointer;
	font-family: inherit; font-size: .8rem; color: var(--c-primary); text-decoration: underline;
}

/* ------------------------------------------ เครื่องมือช่วยจัดเลข (วินเลข / จับมัด) */
.tool-row { display: flex; align-items: flex-end; gap: .4rem; margin-bottom: .6rem; }
.tool-row .input { flex: 1; min-width: 0; }
.btn-ok {
	background: #1E7A6F; color: #fff; border-color: #1E7A6F;
	padding: .55rem .9rem; font-weight: 600;
}
.btn-ok:hover { filter: brightness(1.1); color: #fff; }
.btn-reset {
	background: #2E86C1; color: #fff; border-color: #2E86C1;
	padding: .55rem .75rem; font-size: 1rem; line-height: 1;
}
.btn-reset:hover { filter: brightness(1.1); color: #fff; }

/* กล่องผลลัพธ์ : ตัวเลขเรียงเป็นแถวเหมือนเขียนในกระดาษ จึงใช้ pre + ฟอนต์ความกว้างเท่ากัน */
.tool-out {
	min-height: 11rem; max-height: 22rem; overflow: auto;
	margin: 0; padding: .7rem .8rem;
	border: 1px solid rgba(15,23,42,.14); border-radius: .5rem;
	background: #fff; color: var(--c-text);
	font-family: var(--font-app); font-variant-numeric: tabular-nums;
	font-size: .92rem; line-height: 1.9; letter-spacing: .06em;
	white-space: pre-wrap; word-break: break-word;
}
.tool-foot {
	display: flex; align-items: center; justify-content: space-between; gap: .5rem;
	margin-top: .5rem; font-size: .78rem; color: #64748B;
}
.tool-copy {
	background: none; border: 0; cursor: pointer; font-family: inherit;
	font-size: .78rem; color: var(--c-primary); text-decoration: underline;
}

/* ------------------------------------------------------ ตารางคู่บวก - ลบ */
.pair-box {
	background: var(--c-surface);
	border: 1px solid rgba(15,23,42,.1);
	border-radius: .9rem;
	overflow: hidden;
	margin-bottom: 1.25rem;
	box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px -18px rgba(15,23,42,.35);
}
.pair-title {
	padding: .6rem .9rem;
	color: #fff; font-weight: 600; text-align: center; letter-spacing: .02em;
}
.pair-add-box .pair-title { background: #16A34A; }
.pair-sub-box .pair-title { background: #DC2626; }

/* ตารางกว้างกว่าจอมือถือเสมอ จึงให้เลื่อนซ้าย-ขวาได้ในกรอบของตัวเอง */
.pair-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.pair-table {
	width: 100%; border-collapse: collapse;
	font-variant-numeric: tabular-nums;
	font-size: .82rem; font-weight: 600;
}
.pair-table td {
	padding: .4rem .3rem; text-align: center; white-space: nowrap;
	min-width: 4.2rem;
}
.pair-add td { border: 1px solid #BBF7D0; color: #14532D; background: #F0FDF4; }
.pair-add tr:nth-child(even) td { background: #DCFCE7; }
.pair-sub td { border: 1px solid #FECACA; color: #7F1D1D; background: #FEF2F2; }
.pair-sub tr:nth-child(even) td { background: #FEE2E2; }

.pair-foot {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
	gap: .5rem; padding: .55rem .9rem; font-size: .78rem; color: #64748B;
	border-top: 1px solid rgba(15,23,42,.08);
}
.pair-acts { display: flex; gap: .9rem; }
.pair-link {
	background: none; border: 0; padding: 0; cursor: pointer;
	font-family: inherit; font-size: .78rem; color: var(--c-primary); text-decoration: underline;
}
.pair-link.is-done { color: #15803D; text-decoration: none; font-weight: 600; }
.pair-both { text-align: center; margin-bottom: 1.25rem; }
.pair-empty {
	background: var(--c-surface); border: 1px dashed rgba(15,23,42,.18);
	border-radius: .9rem; padding: 2.5rem 1rem; text-align: center;
	color: #64748B; font-size: .9rem;
}

@media (max-width: 640px) {
	.pair-table { font-size: .76rem; }
	.pair-table td { min-width: 3.9rem; padding: .35rem .2rem; }
}

/* บอกให้เลื่อนตารางเฉพาะจอที่แคบกว่าตาราง */
.pair-hint { display: none; }
@media (max-width: 900px) {
	.pair-hint {
		display: block; padding: .35rem .9rem 0;
		font-size: .72rem; color: #94A3B8; text-align: center;
	}
}
