/* ปรับแต่งเพิ่มจาก Trezo (public/assets/trezo/css/style.css) — อย่าแก้ไฟล์ของ template โดยตรง */

/* ใช้ K2D (template โหลดไว้แล้ว) กับข้อความทั้งหมด ให้ภาษาไทยดูเป็นชุดเดียวกัน */
body {
    font-family: "K2D", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ปุ่มออกจากระบบในเมนูซ้าย (เป็น form POST) ให้หน้าตาเหมือนลิงก์เมนู */
.menu-link-button {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

/* รูปโปรไฟล์แบบตัวอักษรย่อ (ยังไม่มีรูปผู้ใช้) */
.avatar-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    background: var(--bs-primary, #605dff);
}
.avatar-initial.wh-40 { font-size: 18px; }
.avatar-initial.wh-30 { font-size: 14px; }

/* ไอคอนในการ์ดหน้าแรก */
.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    font-size: 28px;
}

/* ไอคอนแสดง/ซ่อนรหัสผ่าน */
.password-toggle-icon {
    right: 15px;
    font-size: 16px;
    color: #a9a9c8;
    cursor: pointer;
}

/* เมนูที่ยังไม่ได้ทำ (Menu::isComingSoon) */
.menu-link.is-coming-soon .title,
.menu-link.is-coming-soon .menu-icon { color: #e03131 !important; }
.menu-link.is-coming-soon .title { text-decoration: line-through; }

/* ---------- ตารางข้อมูลเล็กในแผงซ้าย ---------- */
.info-table th { font-weight: 500; color: var(--bs-body-color); }
.info-table td, .info-table th { padding: 4px 0; background: transparent; }
.info-table td + td, .info-table th + th { padding-left: 14px; }

/* ---------- ดูเลขทั้งหมด ---------- */
.summary-table { font-variant-numeric: tabular-nums; font-size: 14px; }
.summary-table th, .summary-table td { padding: 3px 10px; white-space: nowrap; text-align: left; border-color: #eef0f7; }
.summary-table thead th { text-align: center; position: sticky; top: 0; }
.summary-table .group-row th { font-weight: 700; }
.summary-table .group-top { background: #d9f7e3; color: #157347; }
.summary-table .group-bottom { background: #ffe3e3; color: #b02a37; }
.summary-table .total-row th { background: #e7f1ff; font-weight: 600; }
.summary-table .name-row th { color: #fff; }
.summary-table .name-odd { background: #e03131; }
.summary-table .name-even { background: #212529; }
.summary-table td .num { font-weight: 600; }
.summary-table td.is-danger { background: #fff3a8; }
.summary-table .row-no { color: #9aa0b4; text-align: right; font-size: 12px; }
/* กดเลขเพื่อดูโพยที่ซื้อเลขนั้น (หน้าดูเลขทั้งหมด) */
.summary-table .cell-link { all: unset; display: block; width: 100%; cursor: pointer; border-radius: 4px; }
.summary-table .cell-link:hover .num, .summary-table .cell-link:focus-visible .num { color: var(--bs-primary, #605DFF); text-decoration: underline; }
.summary-table .cell-link:focus-visible { outline: 2px solid var(--bs-primary, #605DFF); outline-offset: 2px; }
.number-tickets-sum { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.number-tickets-sum > div { flex: 1 1 120px; padding: 8px 12px; border-radius: 8px; background: #f4f5fa; }
.number-tickets-sum dt { font-weight: 500; color: #3A4252; font-size: 13px; }
.number-tickets-sum dd { margin: 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: #3A4252; }
/* อัตราจ่าย/บาท ในฟอร์มตรวจเลข (dealer/round/result) */
.round-rate-label { font-weight: 600; color: #3A4252; }
body[data-theme="dark"] .round-rate-label { color: #e5e7eb; }
/* ช่องบังคับกรอก (app.js ใส่ .is-required ที่ป้ายชื่อของช่อง [required]) */
.is-required::after { content: " *"; color: var(--bs-danger); font-weight: 600; }
/* ราคาลูกค้า: เพดาน = ราคาของสมาชิก */
.rate-max { color: #3A4252; }
body[data-theme="dark"] .rate-max { color: #e5e7eb; }
/* หน้า Agent ของ Super Admin (dealer/agents) */
.agent-table td, .agent-table td a { color: #3A4252; }
body[data-theme="dark"] .agent-table td, body[data-theme="dark"] .agent-table td a { color: #e5e7eb; }
.agent-table td .text-danger { color: var(--bs-danger) !important; }
.agent-switch { min-width: 56px; }
.round-rate-grid .form-control { font-variant-numeric: tabular-nums; }/* รายชื่อสมาชิกตอนเข้าแทงโพย (dealer/tickets/create #member-pick-modal) */
.member-pick-open { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 20px; font-size: 14px; }
.member-pick-open i { font-size: 16px; line-height: 1; }
.member-pick-open:hover i { color: #fff; }
.member-pick-search { width: 240px; max-width: 100%; height: 40px; }
.member-pick-table { font-size: 15px; font-variant-numeric: tabular-nums; color: #3A4252; }
.member-pick-table th { font-weight: 600; color: #3A4252; white-space: nowrap; }
.member-pick-table td { color: #3A4252; font-weight: 500; }
.member-pick-table .member-pick-action { width: 1%; }
body[data-theme="dark"] .member-pick-table, body[data-theme="dark"] .member-pick-table th, body[data-theme="dark"] .member-pick-table td { color: #e5e7eb; }
@media (max-width: 575.98px) { .member-pick-search { order: 3; width: 100%; } }
.number-tickets-table { font-size: 14px; font-variant-numeric: tabular-nums; }
.number-tickets-table th { white-space: nowrap; }
.number-tickets-table { color: #3A4252; }
[data-theme="dark"] .number-tickets-sum > div { background: rgba(255, 255, 255, .06); }
.legend-danger { display: inline-block; width: 12px; height: 12px; background: #fff3a8; border: 1px solid #e6d36b; vertical-align: middle; }
/* เนื้อหา / วิธีแทง (partials/how-to-bet.php) */
.how-to-bet { font-size: 15px; line-height: 1.7; }
.how-to-bet-nav { display: flex; flex-wrap: wrap; gap: 8px; position: sticky; top: 8px; z-index: 5; }
.how-to-bet-nav .btn { background: #fff; }
.how-to-bet section { scroll-margin-top: 72px; }
.how-format { display: inline-block; padding: 8px 16px; border-radius: 8px; background: #f4f5fa; font-size: 18px; font-weight: 600; }
.how-format span { color: #605DFF; }
.how-to-bet kbd { padding: 1px 7px; border: 1px solid #D5D9E2; border-bottom-width: 2px; border-radius: 5px; background: #fff; color: #3A4252; font-size: 13px; font-family: inherit; }
.how-key { padding: 2px 8px; border-radius: 5px; background: #EFEFFF; color: #3A2FD8; font-size: 14px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.how-table th { white-space: nowrap; }
.how-sample { padding: 12px 16px; border: 1px solid #D5D9E2; border-radius: 8px; background: #fbfbfe; font-size: 14px; line-height: 1.7; white-space: pre; overflow-x: auto; }
[data-theme="dark"] .how-format, [data-theme="dark"] .how-sample { background: rgba(255, 255, 255, .05); border-color: #172036; }
[data-theme="dark"] .how-to-bet-nav .btn { background: #0c1427; }
[data-theme="dark"] .how-to-bet kbd { background: #15203c; border-color: #172036; color: #fff; }
[data-theme="dark"] .how-key { background: rgba(96, 93, 255, .2); color: #c9c8ff; }
/* ตารางสิทธิ (หน้าพนักงาน): หัวกลุ่มตามเมนูซ้าย + ปุ่มย่อยเยื้องใต้หน้าของมัน */
.perm-group th { padding-top: 14px; background: #f4f5fa; color: #605DFF; font-weight: 600; font-size: 14px; }
.perm-sub td:first-child { padding-left: 32px; font-weight: 500 !important; }
.perm-branch { margin-right: 6px; color: #b4bac8; }
[data-theme="dark"] .perm-group th { background: rgba(255, 255, 255, .05); color: #a5a3ff; }
/* Tom Select: ทุก select.form-select (app.js) ให้เหมือนช่องกรอกของ Trezo
   ธีม bootstrap5 ของ Tom Select วางกรอบ/ลูกศรไว้ที่ wrapper (.ts-wrapper.form-select) ส่วน .ts-control ไม่มีกรอบ จึงแต่งที่ wrapper
   wrapper ได้ class เดิมของ select ไปด้วย (form-control, h-55, w-auto, form-select-sm, time-select, is-invalid)
   รายการ (.ts-dropdown) ย้ายไปไว้ที่ body กันการ์ด/ตารางตัดขอบ (ยกเว้นใน modal) จึงแต่งที่ body .ts-dropdown (ให้ชนะธีมที่โหลดทีหลัง) */
.ts-wrapper.form-select { min-width: 200px; min-height: 42px; align-items: center; border: 1px solid #D5D9E2; border-radius: 7px; background-color: #fff; font-size: 15px; color: #3A4252; cursor: pointer; transition: border-color .15s ease; }
.ts-wrapper.form-select.focus { border-color: #605DFF; box-shadow: none; }
.ts-wrapper.form-select .ts-control { flex-wrap: nowrap; padding: 8px 2.25rem 8px 14px !important; /* ธีมบังคับ padding-right ด้วย !important แต่ค่าออกมาเป็น 0 ข้อความทับลูกศร */ font-size: 15px; color: #3A4252; cursor: pointer; }
.ts-wrapper.form-select .ts-control > .item { white-space: nowrap; }
.ts-wrapper.form-select .ts-control > input { font-size: 15px; color: #3A4252; }
.ts-wrapper.form-select.form-control { padding: 0; }
.ts-wrapper.form-select.form-control.h-55 { height: 55px; }
.ts-wrapper.form-select.w-auto { min-width: 150px; }
.ts-wrapper.form-select.form-select-sm { min-width: 160px; min-height: 34px; font-size: 14px; }
.ts-wrapper.form-select.form-select-sm .ts-control { padding: 5px 2rem 5px 10px !important; font-size: 14px; }
.ts-wrapper.form-select.time-select { min-width: 0; width: 5.5rem; }
.ts-wrapper.form-select.time-select .ts-control { padding: 8px 1.75rem 8px 12px !important; }
.ts-wrapper.form-select.is-invalid { border-color: #dc3545; }
.ts-wrapper.form-select.disabled { background-color: #f4f5fa; cursor: not-allowed; opacity: 1; }
.ts-wrapper.form-select.disabled .ts-control { cursor: not-allowed; opacity: .75; }
body .ts-dropdown { min-width: max-content; margin-top: 6px; border: 1px solid #D5D9E2; border-radius: 10px; background: #fff; box-shadow: 0 10px 30px rgba(31, 41, 79, .12); overflow: hidden; font-size: 15px; z-index: 1060; }
body .ts-dropdown .ts-dropdown-content { max-height: 280px; padding: 6px; }
/* ช่องพิมพ์ค้นที่หัวรายการ (plugin dropdown_input, ตัวเลือกเกิน 8) */
body .ts-dropdown .dropdown-input-wrap { padding: 8px 8px 2px; }
body .ts-dropdown .dropdown-input { width: 100%; height: 36px; padding: 6px 10px; border: 1px solid #D5D9E2; border-radius: 6px; background: #fff; font-size: 14px; color: #3A4252; box-shadow: none; outline: 0; }
body .ts-dropdown .dropdown-input:focus { border-color: #605DFF; }
body[data-theme="dark"] .ts-dropdown .dropdown-input { background: #15203c; border-color: #172036; color: #fff; }
body .ts-dropdown .option { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 12px; border-radius: 6px; color: #3A4252; white-space: nowrap; }
body .ts-dropdown .option.active { background: #EFEFFF; color: #605DFF; }
body .ts-dropdown .option.selected { font-weight: 600; color: #605DFF; }
.ts-meta { font-size: 13px; font-weight: 400; color: #8695AA; }
.ts-wrapper.form-select .ts-control .item .ts-meta { margin-left: 8px; }
[data-theme="dark"] .ts-wrapper.form-select { background-color: #15203c; border-color: #15203c; color: #fff; }
[data-theme="dark"] .ts-wrapper.form-select.focus { border-color: #605DFF; }
[data-theme="dark"] .ts-wrapper.form-select.disabled { background-color: #101a33; }
[data-theme="dark"] .ts-wrapper.form-select .ts-control, [data-theme="dark"] .ts-wrapper.form-select .ts-control > input { color: #fff; }
body[data-theme="dark"] .ts-dropdown { background: #0c1427; border-color: #172036; }
body[data-theme="dark"] .ts-dropdown .option { color: #d5d9e2; }
body[data-theme="dark"] .ts-dropdown .option.active { background: rgba(96, 93, 255, .2); color: #fff; }
/* ช่องรหัสผ่าน + ปุ่มรูปตา (รายการสมาชิก/พนักงาน) */
.pw-cell { white-space: nowrap; }
.pw-value { display: inline-block; min-width: 88px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .5px; vertical-align: middle; color: var(--bs-secondary-color, #8695aa); }
.pw-value.is-shown { color: var(--bs-body-color); font-weight: 600; user-select: all; }
.pw-toggle { vertical-align: middle; }
/* ค้นเลข (ดูเลขทั้งหมด, app.js [data-find-number]) */
.find-number-result { position: absolute; top: 100%; left: 0; margin-top: 4px; font-size: 13px; white-space: nowrap; color: var(--bs-body-color); }
.summary-table td.is-found { box-shadow: inset 0 0 0 2px #605DFF; background: #EFEFFF; }
.summary-table td.is-found-current { box-shadow: inset 0 0 0 3px #605DFF; }
.summary-table td.is-found .num { color: #605DFF; font-weight: 700; }
[data-theme="dark"] .summary-table td.is-found { background: rgba(96, 93, 255, .25); }
/* เลขถูกหลังตรวจเลข (ดูเลขทั้งหมด) */
.summary-table td.is-win { background: #c9f2d6; box-shadow: inset 0 0 0 2px #2fb344; }
.summary-table td.is-win .num { color: #146c2e; font-weight: 700; }
.legend-win { display: inline-block; width: 12px; height: 12px; background: #c9f2d6; border: 2px solid #2fb344; vertical-align: middle; }
.number-tickets-win { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 4px 12px; border-radius: 999px; background: #c9f2d6; color: #146c2e; font-weight: 600; }
/* หน้าต่างเลข: แท็บสมาชิก / โพยเข้า */
.number-members-table tbody tr.nt-member { cursor: pointer; }
.number-members-table tbody tr.nt-member:hover td, .number-members-table tbody tr.nt-member.is-open td { background: #f4f5fa; }
.number-members-table .nt-chevron { display: inline-block; font-size: 18px; transition: transform .15s ease; }
.number-members-table tr.is-open .nt-chevron { transform: rotate(180deg); }
.number-members-table tr.nt-detail > td { padding: 0 0 8px 24px; background: #f4f5fa; border-bottom-width: 1px; }
.nt-detail-table { font-size: 14px; background: #fff; border-radius: 6px; overflow: hidden; }
.nt-detail-table td { color: #3A4252; font-weight: 500; }
.nt-detail-table td a { color: #605DFF; font-weight: 700; }
.nt-detail-table th { font-weight: 600; color: #3A4252; }
.number-members-table .nt-chevron { color: #3A4252; }
.number-members-table tfoot th { border-bottom: 0; }
.number-tickets-table .member-link { all: unset; cursor: pointer; }
.number-tickets-table .member-link:hover .fw-semibold, .number-tickets-table .member-link:focus-visible .fw-semibold { color: var(--bs-primary, #605DFF); text-decoration: underline; }
.number-tickets-table .member-link:focus-visible { outline: 2px solid var(--bs-primary, #605DFF); outline-offset: 2px; border-radius: 4px; }
[data-theme="dark"] .summary-table td.is-win { background: rgba(47, 179, 68, .25); }
[data-theme="dark"] .summary-table td.is-win .num, [data-theme="dark"] .number-tickets-win { color: #8ce99a; }
[data-theme="dark"] .number-tickets-win { background: rgba(47, 179, 68, .2); }
[data-theme="dark"] .number-members-table tbody tr.nt-member:hover td, [data-theme="dark"] .number-members-table tbody tr.nt-member.is-open td, [data-theme="dark"] .number-members-table tr.nt-detail > td { background: rgba(255, 255, 255, .06); }
[data-theme="dark"] .nt-detail-table { background: transparent; }
[data-theme="dark"] .number-tickets-sum dt, [data-theme="dark"] .number-tickets-sum dd:not(.text-primary):not(.text-danger), [data-theme="dark"] .number-tickets-table, [data-theme="dark"] .nt-detail-table th, [data-theme="dark"] .nt-detail-table td, [data-theme="dark"] .number-members-table .nt-chevron { color: #e5e7eb; }

/* ---------- แทงโพย ---------- */
.bet-grid {
    column-width: 330px;
    column-gap: 18px;
}
.bet-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 3px;
    padding: 2px 4px;
    break-inside: avoid;
    border: 1px solid transparent;
    border-radius: 6px;
}
.bet-row.is-valid { background: rgba(25, 135, 84, 0.07); }
.bet-row.is-invalid { background: rgba(220, 53, 69, 0.08); border-color: rgba(220, 53, 69, 0.5); }
.bet-no { width: 36px; flex-shrink: 0; text-align: right; font-size: 12px; color: #9aa0b4; }
.bet-side {
    width: 44px;
    height: 32px;
    flex-shrink: 0;
    border: 0;
    border-radius: 4px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.bet-side.side-top { background: #e7e6ff; color: #4b47d6; }
.bet-side.side-bottom { background: #ffe3e3; color: #d6336c; }
.bet-side.side-both { background: #fff1d6; color: #b8650a; font-size: 12px; }
.bet-row .form-control { height: 32px; padding: 2px 8px; font-size: 15px; text-align: center; font-variant-numeric: tabular-nums; }
.bet-row .form-control.bet-missing,
.bet-row .form-control.bet-missing:focus { border-color: #dc3545 !important; box-shadow: 0 0 0 1px #dc3545; } /* ข้ามแถวทั้งที่ช่องนี้ยังว่าง: แดงจริง (--bs-danger ของ template เป็นส้ม), !important ทับขอบโหมดมืดของ template */
.bet-number { width: 66px; flex-shrink: 0; }
.bet-amount { flex: 1; min-width: 140px; } /* ต้องพอใส่ยอดยาว ๆ เช่น 1000*1000/500 */
.bet-eq { color: #9aa0b4; }
.bet-hint-bar {
    position: sticky;
    bottom: 0;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f3f4fb;
    font-size: 14px;
    z-index: 2;
}
kbd { padding: 1px 5px; font-size: 12px; }
/* ใบที่ (แก้ได้) + ป้ายปุ่มลัดบนปุ่มส่งโพย */
.ticket-seq { width: 90px; height: 36px; padding: 4px 10px; font-size: 16px; }
.ticket-kbd { margin-left: 4px; padding: 0 5px; background: rgba(255, 255, 255, .22); color: #fff; font-size: 11px; font-weight: 500; vertical-align: 1px; }

/* ---------- ดูโพย ---------- */
.ticket-table tr.is-cancelled td { color: #9aa0b4; text-decoration: line-through; }
.ticket-table tr.is-cancelled td:nth-child(4), .ticket-table tr.is-cancelled td:last-child { text-decoration: none; }
.ticket-head { background: #e03131; }
.ticket-lines { display: flex; flex-direction: column; gap: 4px; max-width: 520px; }
.ticket-line { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.ticket-line .bet-side { display: inline-flex; align-items: center; justify-content: center; cursor: default; }
.ticket-line.is-win { background: #c3f7c8; }
.ticket-number { min-width: 44px; font-weight: 600; font-size: 16px; }
.ticket-amount { flex: 1; font-size: 16px; }

/* ประวัติแก้ไขโพย: เลขที่ต่างจากโพยเดิมไฮไลต์แบบปากกาเน้นข้อความ (สีเตือนของ template), บรรทัดที่ลบขีดฆ่า */
.ticket-lines .is-changed, .ticket-edit-history .is-changed, .ticket-edit-legend .is-changed {
    padding: 0 4px; border-radius: 4px;
    background: rgba(var(--bs-warning-rgb), .45);
    box-shadow: inset 0 -2px 0 rgba(var(--bs-warning-rgb), 1);
}
.ticket-line .bet-side.is-changed { box-shadow: 0 0 0 2px rgba(var(--bs-warning-rgb), 1); }
.ticket-line.is-edited { box-shadow: inset 3px 0 0 rgba(var(--bs-warning-rgb), 1); }
.ticket-line.is-removed { opacity: .55; }
.ticket-line.is-removed .ticket-number, .ticket-line.is-removed .ticket-amount { text-decoration: line-through; }
.ticket-was { font-size: 13px; color: var(--bs-secondary-color, #8695aa); white-space: nowrap; }
.ticket-edit-legend { font-size: 14px; }
/* บรรทัดที่เคยแก้เป็นปุ่ม กดแล้วเปิดกล่องโพยประวัติของบรรทัดนั้น */
/* บรรทัดที่เคยแก้: พื้นเหลืองตลอด (ไม่ต้อง hover) — บรรทัดที่ถูกยังเป็นพื้นเขียว */
button.ticket-line { width: 100%; border: 0; background: rgba(var(--bs-warning-rgb), .2); color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.ticket-line.is-win { background: #c3f7c8; }
button.ticket-line:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 1px; }
.ticket-history-icon { color: var(--bs-secondary-color, #8695aa); font-size: 16px; }
/* ประวัติแก้ไขบรรทัด (modal): 1 การ์ดต่อครั้ง = หัว (ครั้งที่ + ประเภท) | เมื่อ/โดย | กล่องก่อนแก้ → หลังแก้ */
.ticket-line-history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.line-history-item { padding: 12px 14px; border: 1px solid var(--bs-border-color, #dde1ea); border-radius: 8px; }
.line-history-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.line-history-no { font-weight: 600; }
.line-history-info { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0 0 10px; font-size: 14px; }
.line-history-info dt { font-weight: 400; color: var(--bs-secondary-color, #8695aa); }
.line-history-info dd { margin: 0; font-variant-numeric: tabular-nums; }
.line-history-diff { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.line-history-diff .diff-box:only-child { grid-column: 1 / -1; }
.diff-box { padding: 6px 10px; border-radius: 6px; background: var(--bs-tertiary-bg, #f6f7f9); }
.diff-box.is-after { background: rgba(var(--bs-success-rgb), .1); }
.diff-box.is-removed { background: rgba(var(--bs-danger-rgb), .08); }
.diff-box.is-removed .diff-line { text-decoration: line-through; color: var(--bs-secondary-color, #8695aa); }
.diff-label { font-size: 12px; color: var(--bs-secondary-color, #8695aa); margin-bottom: 2px; }
.diff-line { font-size: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.diff-box.is-before .diff-line { color: var(--bs-secondary-color, #8695aa); }
.diff-arrow { color: var(--bs-secondary-color, #8695aa); font-size: 18px; }
.ticket-line-history .is-changed { padding: 0 4px; border-radius: 4px; background: rgba(var(--bs-warning-rgb), .45); box-shadow: inset 0 -2px 0 rgba(var(--bs-warning-rgb), 1); color: var(--bs-body-color); }
@media (max-width: 420px) {
    .line-history-diff { grid-template-columns: 1fr; }
    .diff-arrow { justify-self: center; transform: rotate(90deg); }
}
.ticket-edit-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.ticket-edit-line + .ticket-edit-line { margin-top: 6px; }
.ticket-edit-line .badge { min-width: 40px; }
.ticket-edit-line .edit-no { min-width: 28px; color: var(--bs-secondary-color, #8695aa); }
.ticket-edit-line .edit-text { white-space: nowrap; }
.ticket-edit-line .edit-text.is-before { color: var(--bs-secondary-color, #8695aa); }
.ticket-edit-line .edit-text.is-removed { text-decoration: line-through; color: var(--bs-secondary-color, #8695aa); }
.edit-number { font-weight: 600; }
.edit-arrow { color: var(--bs-secondary-color, #8695aa); }

/* ---------- แทงออก / ตัดเลข ---------- */
.betout-grid { display: grid; grid-template-columns: repeat(8, minmax(112px, 1fr)); gap: 6px 10px; overflow-x: auto; padding-bottom: 4px; }
.betout-head { padding: 4px 8px; margin-bottom: 4px; border-radius: 4px; color: #fff; text-align: center; font-weight: 600; font-size: 14px; }
.betout-head.name-odd { background: #e03131; }
.betout-head.name-even { background: #212529; }
.betout-row { display: flex; align-items: center; gap: 3px; margin-bottom: 3px; }
.betout-row .form-control { height: 30px; padding: 2px 6px; font-size: 14px; text-align: center; font-variant-numeric: tabular-nums; }
.betout-number { width: 44px; flex-shrink: 0; }
.betout-amount { flex: 1; min-width: 44px; }
.cut-caps { display: grid; grid-template-columns: repeat(8, minmax(110px, 1fr)); gap: 8px; overflow-x: auto; }
.input-seq { width: 7rem; }
.input-date { flex: 1 1 8rem; min-width: 8.5rem; }
.input-time { flex: 0 0 auto; }
.time-select { width: 4.75rem; padding-right: 1.75rem; }

/* ปฏิทิน Lightpick: ใช้ฟอนต์/สีของระบบ */
.lightpick { font-family: inherit; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); z-index: 1060; }
.lightpick__day.is-today { color: var(--bs-primary, #605dff); }
.lightpick__day.is-start-date, .lightpick__day.is-end-date, .lightpick__day.is-start-date:hover { background-color: var(--bs-primary, #605dff); background-image: none; color: #fff; }
.print-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; font-variant-numeric: tabular-nums; }

/* ---------- สู้บน / สู้ล่าง ---------- */
.fight-head { padding: 6px 12px; border-radius: 4px; background: #d9f7e3; color: #157347; font-weight: 700; }
.fight-list { column-gap: 14px; font-size: 13px; font-variant-numeric: tabular-nums; }
.fight-list li { padding: 2px 6px; border-bottom: 1px solid #eef0f7; break-inside: avoid; white-space: nowrap; }
.fight-list .num { font-weight: 600; }
.fight-cols-10 { column-count: 10; }
.fight-cols-5 { column-count: 5; }
@media (max-width: 1399px) { .fight-cols-10 { column-count: 6; } }
@media (max-width: 767px) { .fight-cols-10, .fight-cols-5 { column-count: 3; } }

/* ---------- ตรวจเลข ---------- */
.result-number { font-size: 32px; font-weight: 700; letter-spacing: 0.08em; color: var(--bs-primary, #605dff); line-height: 1.2; }
.result-input { letter-spacing: 0.15em; }
.sheet-title { padding: 8px 14px; border-radius: 6px; background: #e03131; color: #fff; font-weight: 600; }

/* ---------- หน้าพิมพ์ (layouts/print) ---------- */
.print-sheet { max-width: 900px; font-variant-numeric: tabular-nums; }
.print-ticket { border: 1px solid #dee2e6; border-radius: 6px; padding: 12px 16px; margin-bottom: 16px; break-inside: avoid; }
.print-ticket .col-no { width: 3em; text-align: right; color: #6c757d; }
.print-ticket .col-side { width: 3.5em; }
.sheet-table th, .sheet-table td { padding: 6px 12px; }
.sheet-narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
.sheet-table thead th, .sheet-table tfoot th { background: #e7f1ff; }
@media print {
    .print-toolbar { display: none !important; }
    .print-sheet { max-width: none; padding: 0 !important; }
}

/* ---------- เลขเต็ม/อั้น ---------- */
.numbers-table tr > :first-child { width: 120px; white-space: nowrap; } /* คอลัมน์ประเภทแคบ ช่องหมายเลขกินที่เหลือ */

/* ---------- ราคาสมาชิก ---------- */
.rates-table { font-variant-numeric: tabular-nums; font-size: 14px; }
.rates-table th, .rates-table td { padding: 6px 10px; white-space: nowrap; }
.rates-table .type-head { border-left: 1px solid #e5e7f0; }
.rates-table .sub-head { font-size: 12px; font-weight: 500; }
.copy-targets { max-height: 420px; overflow-y: auto; }

/* ---------- แถบงวดปัจจุบัน (partials/round-bar.php) — ที่เหลือใช้ class ของธีม ---------- */
.round-bar-icon { flex-shrink: 0; width: 40px; height: 40px; font-size: 24px; }
/* อยู่ใน navbar ข้างปุ่มเมนู: เส้นสีสถานะด้านซ้าย ชื่องวด + สถานะ (จอแคบตัดเป็น 2 บรรทัด) */
.header-round { margin-left: 18px; }
.round-bar { padding-left: 14px; }
.round-bar .round-bar-icon { width: 36px; height: 36px; font-size: 21px; }
.round-bar-text { column-gap: 14px; row-gap: 0; line-height: 1.35; }
/* โหมดมืดของ template ทับสีขอบเป็นเทา — คงสีตามสถานะไว้ */
body[data-theme=dark] .round-bar.border-success { border-color: var(--bs-success) !important; }
body[data-theme=dark] .round-bar.border-danger { border-color: var(--bs-danger) !important; }
body[data-theme=dark] .round-bar.border-warning { border-color: var(--bs-warning) !important; }
body[data-theme=dark] .round-bar.border-primary { border-color: var(--bs-primary) !important; }
body[data-theme=dark] .round-bar.border-info { border-color: var(--bs-info) !important; }
body[data-theme=dark] .round-bar.border-secondary { border-color: var(--bs-secondary) !important; }
@media (max-width: 575.98px) {
    .header-round { margin-left: 10px; }
    .round-bar { padding-left: 10px; }
    .round-bar .round-bar-icon { display: none; } /* จอมือถือ: เหลือแค่ข้อความ (ลูกบอลนับถอยหลังยังขึ้น แต่เล็กลง) */
    .round-bar .lk-ball.lk-ball--bar { width: 28px; height: 28px; }
    .round-bar .lk-ball.lk-ball--bar b { font-size: .9rem; }
    .round-bar-text .fs-16 { font-size: 13px !important; }
    .header-round { flex: 1 1 auto; }
}
.min-w-0 { min-width: 0; }

/* ---------- ปุ่มกำลังทำงาน (app.js Lucky.setBusy) ---------- */
.btn.is-busy { cursor: progress; opacity: .75; }
.btn-spinner { vertical-align: -.15em; }

/* ---------- หน้าแทงโพยจอเล็ก: สมาชิก → ช่องคีย์ → ยอด/ราคาจ่าย (tickets/create.php) ---------- */
@media (max-width: 1199.98px) {
    .ticket-side { display: contents; }
    .ticket-side > * { width: 100%; padding-left: calc(var(--bs-gutter-x) * .5); padding-right: calc(var(--bs-gutter-x) * .5); }
    .ticket-side > .card { padding: 0; margin-left: calc(var(--bs-gutter-x) * .5); margin-right: calc(var(--bs-gutter-x) * .5); width: calc(100% - var(--bs-gutter-x)); }
    .ticket-side-member { order: 1; }
    .ticket-keys { order: 2; }
    .ticket-side-info { order: 3; }
}

/* ---------- ปุ่มไอคอนในตาราง (แก้ไข/ตั้งราคา/ลบ) ---------- */
.icon-action { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border-radius: 6px; line-height: 1; }
.icon-action:hover { background: var(--bs-gray-100, #f6f7f9); }

/* ---------- จอสัมผัส/มือถือ: ปุ่มและช่องให้นิ้วกดง่าย (อย่างน้อย ~40px) ---------- */
@media (max-width: 991.98px) {
    .header-burger-menu, .sidebar-burger-menu, .switch-toggle, .fullscreen-btn {
        display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px;
    }
    .btn-sm { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; }
    .icon-action { width: 40px; height: 40px; }
    .form-check { min-height: 32px; display: flex; align-items: center; gap: .5rem; }
    .form-check .form-check-input { width: 1.4rem; height: 1.4rem; margin-top: 0; flex-shrink: 0; }
    .form-check-inline { margin-right: 1.25rem; }
}

/* ---------- อนิเมชันแนวหวย (ลูกบอลแดง / หมุนเลขแบบออกรางวัล) — เครื่องที่ตั้ง "ลดการเคลื่อนไหว" จะไม่ขยับ ---------- */
.round-bar.is-closing { border-color: var(--bs-warning, #ffb264) !important; }
.round-bar.is-closing .round-bar-status { color: #e8890c !important; }
.lk-rolling { font-variant-numeric: tabular-nums; }

/* แทงโพย: บรรทัดที่ผิด เลขบรรทัดเป็นลูกบอลพิมพ์แบนสีแดง */
.bet-row.is-invalid .bet-no {
    display: inline-grid; place-items: center; width: 24px; height: 24px; margin-left: 12px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 11px; text-align: center;
    background: var(--ball-c); box-shadow: 1px 1px 0 0 var(--ball-offset);
}

/* แถบงวด: ลูกบอลนับถอยหลัง */
.lk-ball.lk-ball--bar { width: 40px; height: 40px; flex-shrink: 0; }
.lk-ball.lk-ball--bar b { font-size: 1.25rem; }
.lk-ball.lk-ball--bar.is-seconds b { font-size: 1rem; }

/* ลูกบอลกลิ้งบนปุ่มตอนกำลังบันทึก (แทนวงหมุน): ลูกขาวพิมพ์แบน คาดแถบสีหลักให้เห็นว่าหมุน */
.lk-ball.lk-ball--spin { display: inline-block; width: 16px; height: 16px; box-shadow: none; border: 1px solid #cfd4de; }
.lk-ball.lk-ball--spin::before { inset: 5px -1px; border: 0; border-radius: 2px; background: var(--bs-primary, #605DFF); opacity: .85; }

@media (prefers-reduced-motion: no-preference) {

    /* ดูเลขทั้งหมด: เลขที่ยอดเปลี่ยนพื้นกะพริบชมพู (ยอดหมุนด้วย JS) */
    .summary-table td.is-changed { animation: lk-flash 2.4s ease-out 2; }

    /* แทงโพย: ส่งไม่ผ่าน ลูกบอลเลขบรรทัดเด้งตกแล้วส่าย */
    .bet-row.is-invalid .bet-no.lk-ball-pop { animation: lk-ball-drop .7s cubic-bezier(.3, 0, .4, 1) both, lk-ball-sway .7s ease-in-out .7s; }

    /* แทงโพย: ข้ามแถวทั้งที่ยังมีช่องว่าง ช่องนั้นสั่น */
    .bet-row .bet-missing.bet-shake { animation: lk-shake .35s ease; }

    /* แถบงวด: เลขเปลี่ยนแล้วลูกเด้ง / ปิดแล้วลูกตกลงมา */
    .lk-ball--bar.lk-tick { animation: lk-bump .35s ease-out; }
    .lk-ball--bar.lk-drop { animation: lk-ball-drop .9s cubic-bezier(.3, 0, .4, 1) both; }
    .round-bar { transition: border-color .4s ease; }

    /* ปุ่มกำลังบันทึก: ลูกบอลกลิ้ง */
    .lk-ball--spin { animation: lk-spin .7s linear infinite; }
}
@keyframes lk-roll-in { from { opacity: 0; transform: translateX(-36px) rotate(-360deg); } to { opacity: 1; transform: none; } }
@keyframes lk-fade-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes lk-fade-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes lk-flash { 0%, 40% { background-color: var(--lk-flash, rgba(var(--bs-primary-rgb, 96, 93, 255), .14)); } 100% { background-color: transparent; } }
@keyframes lk-bump { 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes lk-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes lk-spin { to { transform: rotate(360deg); } }
[data-theme="dark"] .summary-table td.is-changed { --lk-flash: rgba(var(--bs-primary-rgb, 96, 93, 255), .3); }

/* ---------- ปุ่มออกจากระบบ: คนเดินออกประตู (partials/logout-icon.php) ---------- */
.lk-logout-icon { display: block; flex-shrink: 0; overflow: visible; }
.lk-logout-door { fill: var(--bs-primary, #605dff); transform-box: view-box; transform-origin: 20.2px 12px; }
.lk-logout-person, .lk-logout-leg-a, .lk-logout-leg-b, .lk-logout-arm { transform-box: view-box; }
.lk-logout-leg-a, .lk-logout-leg-b { transform-origin: 7px 13.6px; }
.lk-logout-arm { transform-origin: 7px 9.8px; }
@media (prefers-reduced-motion: no-preference) {
    .lk-logout-door { transition: transform .3s ease; }
    .lk-logout-person { transition: transform .3s ease; }
    /* ชี้: ประตูแง้ม คนหันไปทางประตู */
    .lk-logout:hover .lk-logout-door, .lk-logout:focus-visible .lk-logout-door { transform: scaleX(.45); }
    .lk-logout:hover .lk-logout-person, .lk-logout:focus-visible .lk-logout-person { transform: translateX(1.5px); }
    /* กด: เดินเข้าประตู แล้วประตูปิด */
    .lk-logout.is-leaving .lk-logout-door { animation: lk-door .85s ease forwards; }
    .lk-logout.is-leaving .lk-logout-person { animation: lk-walk-out .85s ease-in forwards; }
    .lk-logout.is-leaving .lk-logout-leg-a { animation: lk-step .2s ease-in-out infinite alternate; }
    .lk-logout.is-leaving .lk-logout-leg-b { animation: lk-step .2s ease-in-out infinite alternate-reverse; }
    .lk-logout.is-leaving .lk-logout-arm { animation: lk-swing .2s ease-in-out infinite alternate; }
}
@keyframes lk-door { 0% { transform: scaleX(.45); } 15%, 70% { transform: scaleX(.1); } 100% { transform: scaleX(1); } }
@keyframes lk-walk-out { 0% { transform: translateX(1.5px); opacity: 1; } 65% { transform: translateX(10px); opacity: 1; } 80%, 100% { transform: translateX(11.5px); opacity: 0; } }
@keyframes lk-step { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
@keyframes lk-swing { from { transform: rotate(-10deg); } to { transform: rotate(12deg); } }

/* ---------- ลูกบอลหวยพิมพ์แบน (ตราบนกล่องโพย, แถบงวดนับถอยหลัง, ปุ่มกำลังบันทึก, เลขบรรทัดผิด, คิวโพยใหม่) ----------
   งานพิมพ์สีทึบแบบป้ายผลรางวัล: วงขาวด้านใน + พิมพ์เหลื่อมนิดหน่อย (เงาทึบเยื้อง) — ไม่มีแสงเงา 3D
   สีตามความหมายจาก template (Trezo --bs-*): สำเร็จ = success, เตือน = warning, ผิดพลาด = danger (ค่าเริ่มต้น), คำถาม/แจ้งข้อมูล = primary, กำลังทำงาน = ขาว */
.lk-ball, .bet-row.is-invalid .bet-no {
    --ball-c: var(--bs-danger, #FD5812); --ball-ink: #fff; --ball-ring: rgba(255, 255, 255, .85);
    --ball-offset: color-mix(in srgb, var(--ball-c) 50%, #000);
}
.lk-ball--success { --ball-c: var(--bs-success, #37D80A); }
.lk-ball--warning { --ball-c: var(--bs-warning, #FFBC2B); --ball-ink: #3a2a00; }
.lk-ball--info { --ball-c: var(--bs-primary, #605DFF); }
.lk-ball--white { --ball-c: #ffffff; --ball-ink: var(--bs-primary, #605DFF); --ball-ring: transparent; --ball-offset: #b9c1cf; }
.lk-ball {
    position: relative; z-index: 1; display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
    background: var(--ball-c);
    box-shadow: 1.5px 1px 0 0 color-mix(in srgb, var(--ball-offset) 60%, transparent); /* พิมพ์เหลื่อม */
}
.lk-ball::before { content: ""; position: absolute; inset: 10%; border-radius: 50%; border: 1.5px solid var(--ball-ring); pointer-events: none; }
.lk-ball b {
    position: relative; color: var(--ball-ink); font: 800 2.4rem/1 Arial, 'Helvetica Neue', var(--bs-font-sans-serif, sans-serif);
    font-variant-numeric: tabular-nums;
}

/* ---------- กล่องข้อความแบบ "โพย" (app.js slip → Lucky.alert / confirm / flash / notice) ----------
   หัวโพย 66px: ตราลูกบอล + ประเภท + งวด/เวลา → รอยปรุฉีก (เส้นประ + รอยบากสองข้างแบบตั๋ว) → หัวข้อ/รายละเอียดชิดซ้าย → ปุ่มชิดขวา
   แถบสีบนสุดและสีตรา = ความหมาย; ตัวเลขใช้ฟอนต์ความกว้างเท่ากันแบบพิมพ์บนสลิป */
.swal2-popup.lk-slip {
    --slip-paper: #fffdf8; --slip-ink: #262a3b; --slip-muted: #6b7286; --slip-rule: #e7e2d4;
    --slip-accent: var(--bs-danger, #FD5812); --slip-stub: 66px;
    --slip-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
    position: relative; width: min(400px, calc(100vw - 32px)); padding: 0; border-radius: 10px; text-align: left;
    font-family: inherit; color: var(--slip-ink); overflow: hidden;
    background:
        radial-gradient(circle at 0 var(--slip-stub), transparent 9px, var(--slip-paper) 9.5px) left / 51% 100% no-repeat,
        radial-gradient(circle at 100% var(--slip-stub), transparent 9px, var(--slip-paper) 9.5px) right / 51% 100% no-repeat;
    box-shadow: 0 22px 50px rgba(15, 23, 42, .22), 0 2px 6px rgba(15, 23, 42, .08);
}
.swal2-popup.lk-slip::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--slip-accent); }
.swal2-popup.lk-slip.lk-swal--success { --slip-accent: var(--bs-success, #37D80A); }
.swal2-popup.lk-slip.lk-swal--warning { --slip-accent: var(--bs-warning, #FFBC2B); }
.swal2-popup.lk-slip.lk-swal--info { --slip-accent: var(--bs-primary, #605DFF); }
[data-theme="dark"] .swal2-popup.lk-slip { --slip-paper: #141b2e; --slip-ink: #e3e6ef; --slip-muted: #8a94a8; --slip-rule: #2a3350; }

/* หัวโพย (ช่อง icon ของ swal) */
.swal2-popup.lk-slip .swal2-icon.lk-slip-head {
    position: relative; display: flex !important; align-items: center; justify-content: flex-start; gap: 12px;
    width: auto; height: var(--slip-stub); margin: 0; padding: 4px 22px 0; border: 0 !important; border-radius: 0;
    font-size: inherit; line-height: 1.25; color: inherit; cursor: default; animation: none !important;
}
.swal2-popup.lk-slip .swal2-icon.lk-slip-head .swal2-icon-content { display: contents; font-size: inherit; }
.swal2-popup.lk-slip .lk-slip-head::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; border-bottom: 2px dashed var(--slip-rule); }
.lk-ball.lk-slip-stamp { width: 40px; height: 40px; }
.lk-ball.lk-slip-stamp b { font-size: 1.15rem; }
.lk-slip-kind { font-weight: 700; font-size: .95rem; letter-spacing: .01em; color: color-mix(in srgb, var(--slip-accent) 68%, #1f2335); }
[data-theme="dark"] .lk-slip-kind { color: color-mix(in srgb, var(--slip-accent) 80%, #fff); }
.lk-slip-meta { margin-left: auto; text-align: right; font: 500 .72rem/1.4 var(--slip-mono); color: var(--slip-muted); font-variant-numeric: tabular-nums; }

/* เนื้อหา */
.swal2-popup.lk-slip .lk-slip-title { margin: 0; padding: 18px 22px 0; text-align: left; font-size: 1.15rem; font-weight: 600; line-height: 1.45; color: var(--slip-ink); }
.swal2-popup.lk-slip .lk-slip-body { margin: 6px 22px 0; padding: 0; text-align: left; font-size: .92rem; line-height: 1.55; color: var(--slip-muted); }
.lk-slip-text { margin: 0; }
.lk-slip .lk-swal-lines { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px dashed var(--slip-rule); }
.lk-slip .lk-swal-lines li { position: relative; padding: 7px 0 7px 14px; border-bottom: 1px dashed var(--slip-rule); color: var(--slip-ink); font-size: .88rem; }
.lk-slip .lk-swal-lines li::before { content: ""; position: absolute; left: 0; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--bs-danger, #FD5812); }
.lk-slip .lk-swal-more { margin: 8px 0 0; font-size: .82rem; }

/* สรุปโพยในกล่องยืนยันส่งโพย: แถวแบบสลิป ยอดตัวใหญ่ */
.lk-slip .lk-confirm-summary { display: grid; margin: 12px 0 0; border-top: 1px dashed var(--slip-rule); }
.lk-slip .lk-confirm-summary > div { display: flex; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--slip-rule); }
.lk-slip .lk-confirm-summary span { flex: none; color: var(--slip-muted); }
.lk-slip .lk-confirm-summary strong { margin-left: auto; text-align: right; color: var(--slip-ink); font-weight: 600; min-width: 0; }
.lk-slip .lk-confirm-summary > div:last-child strong { font: 700 1.35rem/1 var(--slip-mono); font-variant-numeric: tabular-nums; }

/* ปุ่ม: ชิดขวา เรียงแบบฟอร์มอื่นในระบบ (ยืนยันก่อน ยกเลิกหลัง) */
.swal2-popup.lk-slip .lk-slip-actions { justify-content: flex-end; gap: 8px; width: auto; margin: 20px 22px; padding: 0; }
.swal2-popup.lk-slip .lk-slip-actions .btn { margin: 0; padding: .5rem 1.25rem; }
.swal2-popup.lk-slip .lk-slip-actions .btn:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--slip-accent) 35%, transparent); }
.swal2-popup.lk-slip .lk-slip-actions .btn-outline-secondary { color: var(--slip-ink); border-color: color-mix(in srgb, var(--slip-ink) 30%, transparent); background: transparent; }
.swal2-popup.lk-slip .lk-slip-actions .btn-outline-secondary:hover { background: color-mix(in srgb, var(--slip-ink) 7%, transparent); color: var(--slip-ink); }
.swal2-popup.lk-slip .lk-slip-actions .btn-outline-secondary:focus, .swal2-popup.lk-slip .lk-slip-actions .btn-outline-secondary:focus-visible {
    background: transparent; color: var(--slip-ink); border-color: var(--slip-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--slip-ink) 18%, transparent);
}

/* แถบเวลา (ข้อความสำเร็จ) = รอยปรุล่างสุดที่หดลง */
.swal2-popup.lk-slip .swal2-timer-progress-bar { height: 3px; background: var(--slip-accent); opacity: .8; }

/* ข้อความสำเร็จ: ไม่มีพื้นหลังมืด และไม่บังการคลิกหน้าเว็บ (คลิกได้เฉพาะตัวโพย) */
.swal2-container.lk-flash-container { pointer-events: none; }
.lk-flash-container .swal2-popup { pointer-events: auto; }

@media (prefers-reduced-motion: no-preference) {
    /* โพยเลื่อนออกมาแบบพิมพ์จากเครื่อง แล้วลูกบอลหล่นลงที่หัวโพย / ผิดพลาด: ลูกสั่น / ปิด: ฉีกออก */
    .lk-slip-in { animation: lk-slip-print .3s cubic-bezier(.2, .8, .2, 1) both; }
    .lk-slip-in .lk-slip-stamp { animation: lk-ball-print .32s cubic-bezier(.3, 1.3, .5, 1) .14s both; }
    .lk-swal--error.lk-slip-in .lk-slip-stamp { animation: lk-ball-print .32s cubic-bezier(.3, 1.3, .5, 1) .14s both, lk-shake .35s ease .5s; }
    .lk-slip-out { animation: lk-slip-tear .18s ease-in forwards; }
}
@keyframes lk-slip-print { from { opacity: 0; transform: translateY(-14px); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }
@keyframes lk-ball-print { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes lk-slip-tear { to { opacity: 0; transform: translateY(6px) rotate(-.6deg); } }
@keyframes lk-ball-drop {
    0% { opacity: 0; transform: translateY(-90px) rotate(-200deg); }
    45% { opacity: 1; transform: translateY(0) rotate(0); }
    62% { transform: translateY(-18px); }
    78% { transform: translateY(0); }
    88% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}
@keyframes lk-ball-sway { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }

/* หน้าตั้งงวด: ปุ่มเลือกงวดเร็ว (1 / 16) — ปุ่มที่ตรงกับวันงวดตอนนี้เป็นสีเต็ม */
.btn[data-fill-date][aria-pressed="true"] { background: var(--bs-primary, #605DFF); border-color: var(--bs-primary, #605DFF); color: #fff; }

/* ตรวจเลข: ช่องที่ดึงผลจากสำนักงานสลากฯ มาเติม — ขอบสีหลักให้รู้ว่าระบบเติมให้ ตรวจทานก่อนกดตรวจเลข */

/* ---------- ผลรางวัลแบบประกาศสำนักงานสลากฯ (partials/result-board.php, ฟอร์มตรวจเลข) ----------
   4 คอลัมน์: รางวัลที่ 1 | เลขหน้า 3 ตัว | เลขท้าย 3 ตัว | เลขท้าย 2 ตัว — หัวคอลัมน์ชื่อรางวัล + ประเภทที่ใช้คิดในระบบ
   กล่องแคบ (< 640px) เรียง 2 x 2 ด้วย container query */
.result-board-wrap { container-type: inline-size; }
.result-board {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr);
    border: 1px solid var(--bs-border-color, #eceef2); border-radius: 10px; overflow: hidden; background: var(--bs-body-bg, #fff);
}
.result-board__col { display: grid; grid-template-rows: auto 1fr; min-width: 0; border-left: 1px solid var(--bs-border-color, #eceef2); }
.result-board__col:first-child { border-left: 0; }
.result-board__head {
    display: grid; gap: 2px; margin: 0; padding: 10px 12px; text-align: center;
    background: var(--bs-tertiary-bg, #f6f7f9); border-bottom: 1px solid var(--bs-border-color, #eceef2);
}
.result-board__head b { font-weight: 700; font-size: .98rem; color: var(--bs-primary, #605DFF); }
.result-board__head small { font-size: .8rem; color: var(--bs-secondary-color, #6b7286); }
.result-board__body { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 16px 12px; min-height: 84px; }
.result-board__num { font: 700 1.75rem/1 var(--bs-font-sans-serif, 'K2D', sans-serif); font-variant-numeric: tabular-nums; letter-spacing: .04em; color: var(--bs-secondary, #3A4252); }
[data-theme="dark"] .result-board__num:not(.result-board__num--first) { color: var(--bs-body-color, #e3e6ef); }
.result-board__num--first { font-size: 2.3rem; font-weight: 800; color: var(--bs-primary, #605DFF); letter-spacing: .06em; }
/* ฟอร์มตรวจเลข: ช่องกรอกอยู่ในตารางแบบเดียวกัน */
.result-board--form .result-board__body { padding: 12px; gap: 8px; }
.result-board--form .result-board__body .form-control { height: 52px; font-size: 1.35rem; letter-spacing: .06em; min-width: 0; }
.result-board--form .result-board__col--first .form-control { font-size: 1.6rem; color: var(--bs-primary, #605DFF); }
.result-board--form .result-board__body { flex-wrap: wrap; }
.result-board--form .result-board__body .invalid-feedback { flex-basis: 100%; text-align: center; margin-top: 0; }
.result-board--form .result-board__pair .form-control { flex: 1 1 0; width: auto; min-width: 0; } /* เลขหน้า/เลขท้าย 2 ชุดเรียงข้างกันแบบประกาศ */
@container (max-width: 640px) {
    .result-board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .result-board__col:nth-child(3) { border-left: 0; }
    .result-board__col:nth-child(n + 3) { border-top: 1px solid var(--bs-border-color, #eceef2); }
}

/* หน้าตั้งงวด: รายการไม่ตัดบรรทัดวันที่ (ตารางเลื่อนในกรอบแทน) / งวดที่เพิ่งตั้ง/แก้ กะพริบในรายการ */
.round-list th, .round-list td { white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
    .round-list tr.is-added td { animation: lk-flash 2.4s ease-out 2; }
}
.number-history-line + .number-history-line { margin-top: 4px; }

/* ---------- หน้า login: ป้ายประกาศรางวัล + ฟอร์มเป็นตั๋วสลาก ----------
   พื้นกระดาษสลากลายพิมพ์กันปลอม (วงซ้อนสองชุดตัดกันเป็นลายเส้น), ฝั่งซ้ายลูกบอลพิมพ์แบนสะกด LOTTERY (ไม่แสดงผลรางวัลจริง),
   ตั๋ว: แถบสีบน + รอยปรุมีรอยบากสองข้าง */
body.lk-auth {
    --lk-page: #f3efe4; --lk-guilloche: rgba(96, 93, 255, .055);
    --lk-ink: #262a3b; --lk-muted: #6b7286; --lk-rule: #e5dfcf; --lk-paper: #fffdf8; --lk-field: #ffffff;
    --lk-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
    min-height: 100vh; color: var(--lk-ink);
    background-color: var(--lk-page);
    background-image:
        repeating-radial-gradient(circle at 12% 115%, transparent 0 13px, var(--lk-guilloche) 13px 14px),
        repeating-radial-gradient(circle at 88% -15%, transparent 0 13px, var(--lk-guilloche) 13px 14px);
    background-attachment: fixed;
}
body.lk-auth[data-theme="dark"] {
    --lk-page: #10121a; --lk-guilloche: rgba(255, 255, 255, .035);
    --lk-ink: #e3e6ef; --lk-muted: #9aa1b5; --lk-rule: #2d3142; --lk-paper: #1b1e2a; --lk-field: #141722;
}
.lk-login {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); align-items: center; gap: clamp(40px, 7vw, 110px);
    min-height: 100vh; max-width: 1080px; margin: 0 auto; padding: 48px 0;
}

/* ป้ายประกาศ */
.lk-login__balls { display: flex; gap: 12px; }
.lk-ball.lk-login__ball { width: 64px; height: 64px; }
.lk-ball.lk-login__ball b { font-size: 2.1rem; }

/* ตั๋ว */
.lk-ticket {
    --head: 86px;
    position: relative; justify-self: end; width: 100%; max-width: 440px; border-radius: 14px; color: var(--lk-ink);
    background:
        radial-gradient(circle at 0 var(--head), transparent 10px, var(--lk-paper) 10.5px) left / 51% 100% no-repeat,
        radial-gradient(circle at 100% var(--head), transparent 10px, var(--lk-paper) 10.5px) right / 51% 100% no-repeat;
    filter: drop-shadow(0 22px 38px rgba(38, 42, 59, .13)) drop-shadow(0 1px 2px rgba(38, 42, 59, .08));
}
.lk-ticket::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; border-radius: 14px 14px 0 0; background: var(--bs-primary, #605DFF); }
.lk-ticket__head {
    display: flex; align-items: center; gap: 12px; height: var(--head); margin: 0 16px; padding: 6px 8px 0;
    border-bottom: 2px dashed var(--lk-rule);
}
.lk-ball.lk-ticket__stamp { width: 44px; height: 44px; }
.lk-ball.lk-ticket__stamp b { font: 800 1.3rem/1 inherit; }
.lk-ticket__brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.3rem; font-weight: 800; letter-spacing: .08em; }
.lk-ticket__body { padding: 26px 28px 28px; }
.lk-ticket__title { margin: 0 0 22px; font-size: 1.6rem; font-weight: 800; color: var(--lk-ink); }
.lk-ticket__alert { margin-bottom: 18px; padding: 10px 14px; border-radius: 10px; font-size: .92rem; }
.lk-ticket__field { margin-bottom: 18px; }
.lk-ticket__field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .9rem; color: var(--lk-ink); }
body.lk-auth .lk-ticket .form-control {
    height: 52px; padding: 0 16px; border: 1.5px solid var(--lk-rule); border-radius: 10px; font-size: 1rem;
    color: var(--lk-ink); background: var(--lk-field);
}
/* template ใส่ !important ให้ช่องกรอกโหมดมืด ต้องทับด้วย !important ให้ช่องอยู่บนกระดาษตั๋วเดียวกัน */
body.lk-auth[data-theme="dark"] .lk-ticket .form-control { background-color: var(--lk-field) !important; border-color: var(--lk-rule) !important; color: var(--lk-ink) !important; }
body.lk-auth[data-theme="dark"] .lk-ticket .form-control:focus { border-color: var(--bs-primary, #605DFF) !important; }
body.lk-auth .lk-ticket .form-control::placeholder { color: var(--lk-muted); opacity: .75; }
body.lk-auth .lk-ticket .form-control:focus { border-color: var(--bs-primary, #605DFF); box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb, 96, 93, 255), .15); }
.lk-ticket .password-wrapper .form-control { padding-right: 44px; }
.lk-ticket__submit { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; margin-top: 6px; border-radius: 10px; font-weight: 600; font-size: 1.05rem; }
.lk-ticket__submit .material-symbols-outlined { font-size: 20px; color: #fff; }

@media (max-width: 991.98px) {
    .lk-login { grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: center; gap: 28px; padding: 28px 0; }
    .lk-login__balls { justify-content: center; gap: 8px; }
    .lk-ball.lk-login__ball { width: 46px; height: 46px; }
    .lk-ball.lk-login__ball b { font-size: 1.5rem; }
    .lk-ticket { justify-self: center; }
}
@media (max-width: 420px) {
    .lk-login__balls { gap: 6px; }
    .lk-ball.lk-login__ball { width: 40px; height: 40px; }
    .lk-ball.lk-login__ball b { font-size: 1.3rem; }
    .lk-ticket__body { padding: 22px 20px 22px; }
    .lk-ticket__head { margin: 0 12px; }
}


/* ---------- หน้าแรก: dashboard 3D (วาดโดย public/assets/js/dashboard.js) ----------
   ผู้ใช้ให้อิสระเต็มที่ที่หน้านี้: 3D/ตัวเลขพลิก/ลูกเล่นได้ แต่ลูกบอลยังเป็นแบบพิมพ์แบน (ไม่ใช้ลูกเงามันวาว)
   ธีมตาม template: สว่าง = ค่าเริ่มต้น, มืด = body[data-theme="dark"]; อนิเมชันทั้งหมดอยู่ใน prefers-reduced-motion: no-preference */
.d3 {
    --ink: #232838; --muted: #5b667c; --glass: #ffffff; --glass-b: #E6E8F0; --chip: #F1F2F7;
    --floor: rgba(96, 93, 255, .05); --floor-line: rgba(96, 93, 255, .18); --flapA: #2a3160; --flapB: #20264d;
    --panel: rgba(96, 93, 255, .07); --panel-b: rgba(96, 93, 255, .38); --city: #dcdff4; --shadow: rgba(30, 40, 90, .16);
    --primary: var(--bs-primary, #605DFF); --primary-ink: #4f4ce6; --danger: var(--bs-danger, #FD5812); --danger-ink: #C2410C;
    --success: var(--bs-success, #37D80A); --success-ink: #2B7A0B; --warning: var(--bs-warning, #FFBC2B); --warn-ink: #7a5200;
    color: var(--muted); font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .d3 {
    --ink: #EEF0FA; --muted: #9AA5BC; --glass: #0C1427; --glass-b: rgba(255, 255, 255, .09); --chip: rgba(255, 255, 255, .06);
    --floor: rgba(120, 130, 255, .07); --floor-line: rgba(160, 170, 255, .16); --flapA: #232b52; --flapB: #1b2245;
    --panel: rgba(150, 170, 255, .08); --panel-b: rgba(255, 255, 255, .26); --city: #1d2347; --shadow: rgba(0, 0, 0, .55);
    --primary-ink: #B3B1FF; --danger-ink: #FF8A5C; --success-ink: #7BE356; --warn-ink: #FFD36B;
}
.d3 *, .d3 *::before, .d3 *::after { box-sizing: border-box; }
.d3 h2 { margin: 0; color: var(--ink); font-size: 18px; font-weight: 700; }
.d3-glass { min-width: 0; padding: 24px; border: 1px solid var(--glass-b); border-radius: 16px; background: var(--glass); box-shadow: 0 24px 48px -30px var(--shadow); }
.d3-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; }
.d3-s5 { grid-column: span 5; }
.d3-s7 { grid-column: span 7; }
.d3-s12 { grid-column: span 12; }
.d3-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.d3-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 20px; }
.d3-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1199.98px) { .d3-s5, .d3-s7 { grid-column: span 12; } }
@media (max-width: 767.98px) {
    .d3-hero { grid-template-columns: minmax(0, 1fr); }
    .d3-glass { padding: 16px; }
    .d3-grid { gap: 16px; }
    .d3-hide-sm { display: none; }
}
.d3-seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--chip); }
.d3-tab { min-height: 34px; padding: 4px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.d3-tab.is-on { background: var(--primary); color: #fff; }

/* ลูกบอลพิมพ์แบน (ชุดเดียวกับ .lk-ball) */
.d3-ball {
    --c: var(--danger); --bi: #fff; position: relative; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 50%;
    background: var(--c); color: var(--bi); font-weight: 800; font-family: Arial, 'Helvetica Neue', sans-serif; line-height: 1;
    box-shadow: 1.5px 1px 0 0 color-mix(in srgb, color-mix(in srgb, var(--c) 50%, #000) 60%, transparent);
}
.d3-ball::before { content: ""; position: absolute; inset: 10%; border: 1.5px solid rgba(255, 255, 255, .85); border-radius: 50%; pointer-events: none; }
.d3-ball.t-primary { --c: var(--primary); }
.d3-ball.t-warning { --c: var(--warning); --bi: #3a2a00; }
.d3-ball.t-success { --c: #2fb80a; }
.d3-ball.t-info { --c: #2DB6F5; --bi: #06263a; }
.d3-ball.t-empty { --c: transparent; --bi: var(--muted); box-shadow: none; border: 2px dashed var(--glass-b); }
.d3-ball.t-empty::before { display: none; }
.d3-ball.z-lg { width: 64px; height: 64px; font-size: 30px; }
.d3-ball.z-md { width: 54px; height: 54px; font-size: 24px; }
.d3-ball.z-md3 { width: 54px; height: 54px; font-size: 16px; }
.d3-ball.z-sm { width: 38px; height: 38px; font-size: 15px; }
.d3-ball.z-xs { width: 26px; height: 26px; font-size: 11px; }

/* ตัวเลขแบบป้ายพลิก (ตารางบินสนามบิน) */
.d3-flaps { display: inline-flex; perspective: 320px; }
.d3-fd {
    position: relative; display: inline-block; min-width: .66em; margin-right: 2px; padding: 3px 2px; border-radius: 5px; text-align: center; color: #fff;
    background: linear-gradient(180deg, var(--flapA) 0 50%, var(--flapB) 50% 100%); transform-origin: 50% 50%;
}
.d3-fd::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0, 0, 0, .5); }
.d3-fd.sep { min-width: 0; padding: 3px 1px; background: none; color: var(--ink); }
.d3-fd.sep::after { display: none; }
.d3-clock { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.d3-clock-label { font-size: 13px; line-height: 1.3; }
/* นับถอยหลังปิดรับ: กระดานดำ เลขขาวหนา โคลอนสี่เหลี่ยมเทา ชื่อหน่วยตัวห่างข้างใต้ (ดำทั้งสองธีมตามรูปที่ผู้ใช้ส่ง) */
.d3-cd {
    --cd-size: clamp(22px, 2.2vw, 30px);
    display: inline-flex; align-items: flex-start; gap: calc(var(--cd-size) * .4); padding: 8px 16px 6px; border-radius: 10px;
    background: #000; color: #fff; perspective: 320px;
}
.d3-cd-unit { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.d3-cd-num {
    display: flex; font-family: 'Arial Black', 'Helvetica Neue', Arial, sans-serif; font-size: var(--cd-size); font-weight: 900;
    line-height: 1; letter-spacing: .02em; font-variant-numeric: tabular-nums;
}
.d3-cd-d { display: inline-block; min-width: .68em; text-align: center; transform-origin: 50% 50%; }
.d3-cd-label { color: #cfd2da; font-size: 11px; font-weight: 500; line-height: 1.2; letter-spacing: .04em; white-space: nowrap; } /* ห่างมากกว่านี้สระไทยแยกจากพยัญชนะ */
.d3-cd-colon {
    position: relative; flex-shrink: 0; width: calc(var(--cd-size) * .2); height: calc(var(--cd-size) * .82);
    margin-top: calc(var(--cd-size) * .1);
}
.d3-cd-colon::before, .d3-cd-colon::after {
    content: ""; position: absolute; left: 0; width: 100%; aspect-ratio: 1; background: #8e8e8e;
}
.d3-cd-colon::before { top: 18%; }
.d3-cd-colon::after { bottom: 18%; }
@media (max-width: 575.98px) {
    .d3-clock { width: 100%; align-items: stretch; }
    .d3-cd { --cd-size: clamp(22px, 7vw, 30px); justify-content: space-between; padding: 8px 14px 6px; }
}

/* การ์ดตัวเลข */
.d3-tile {
    display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 18px; border: 1px solid var(--glass-b); border-radius: 14px; background: var(--glass);
    color: var(--muted); text-decoration: none; transform-style: preserve-3d; box-shadow: 0 18px 36px -30px var(--shadow);
}
a.d3-tile:hover { color: var(--muted); border-color: var(--primary); }
.d3-tile .d3-flaps { flex-wrap: wrap; color: var(--ink); font-size: 21px; font-weight: 700; }
.d3-tile-sub { font-size: 12px; }

/* ตู้หมุนหวย (CSS 3D: วงแผ่น 16 แผ่นหมุนรอบแกน + ฝาสองข้าง + ลูกบอลลอยวนข้างใน) */
.d3-stage { position: relative; perspective: 900px; }
.d3-p3 { position: absolute; transform-style: preserve-3d; }
.d3-drum { height: 300px; }
.d3-drum-shadow { position: absolute; left: 50%; bottom: 14px; width: 250px; height: 24px; margin-left: -125px; border-radius: 50%; background: radial-gradient(closest-side, var(--shadow), transparent); }
.d3-drum-stand {
    position: absolute; left: 50%; bottom: 26px; width: 170px; height: 66px; margin-left: -85px; clip-path: polygon(22% 0, 78% 0, 100% 100%, 0 100%);
    background: linear-gradient(180deg, rgba(96, 93, 255, .5), rgba(96, 93, 255, .16));
}
.d3-panel { position: absolute; left: -120px; top: -22px; width: 240px; height: 44px; border-top: 1px solid var(--panel-b); background: var(--panel); }
.d3-cap {
    position: absolute; left: -112px; top: -112px; width: 224px; height: 224px; border: 4px solid var(--panel-b); border-radius: 50%;
    background: radial-gradient(circle, transparent 60%, rgba(96, 93, 255, .1));
}
.d3-axle { position: absolute; left: -150px; top: -3px; width: 300px; height: 6px; border-radius: 3px; background: var(--panel-b); }
.d3-trays { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.d3-tray { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--glass-b); border-radius: 14px; background: var(--chip); }
.d3-tray-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.d3-tray-head b { color: var(--ink); font-weight: 600; }
.d3-tray-amount { font-size: 20px; font-weight: 700; }
.d3-groove {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 76px; padding: 6px 12px; border-radius: 999px;
    background: #e4e6f0; box-shadow: inset 0 3px 8px rgba(30, 40, 90, .18); perspective: 500px;
}
[data-theme="dark"] .d3 .d3-groove { background: rgba(0, 0, 0, .25); box-shadow: inset 0 3px 8px rgba(0, 0, 0, .45); }
.d3-tray-note { font-size: 12px; line-height: 1.5; }

/* เมืองตัวเลข 00–99 */
.d3-cstage { height: 420px; overflow: hidden; perspective: 900px; }
.d3-city { left: 50%; top: 50%; width: 354px; height: 354px; margin: -177px 0 0 -177px; transition: transform .7s cubic-bezier(.2, .7, .2, 1); }
.d3-floor {
    position: absolute; inset: -18px; border-radius: 14px; background-color: var(--floor);
    background-image: linear-gradient(var(--floor-line) 1px, transparent 1px), linear-gradient(90deg, var(--floor-line) 1px, transparent 1px);
    background-size: 36px 36px; background-position: 16px 16px;
}
.d3-col { position: absolute; width: 30px; height: 30px; padding: 0; border: 0; background: transparent; cursor: pointer; transform-style: preserve-3d; }
.d3-f { position: absolute; left: 0; top: 0; width: 30px; height: 30px; }
.d3-col .d3-top { display: grid; place-items: center; font-family: inherit; font-size: 12px; font-weight: 700; }
.d3-col:hover .d3-top { filter: brightness(1.25); }
.d3-col:focus-visible .d3-top { outline: 2px solid var(--ink); }
.d3-tag {
    position: absolute; left: 0; top: 0; padding: 6px 10px; border-radius: 8px; background: #fff; color: #1b1f33; font-family: inherit; font-size: 13px; font-weight: 700;
    white-space: nowrap; transform-origin: 0 0; box-shadow: 0 8px 20px rgba(0, 0, 0, .3); pointer-events: none;
}
.d3-tag::after { content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: #fff; }
.d3-sel { padding: 12px 14px; border-radius: 10px; background: var(--chip); color: var(--ink); line-height: 1.6; }
.d3-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; font-size: 12px; }
.d3-sw { display: inline-block; width: 14px; height: 14px; margin-right: 4px; border-radius: 4px; vertical-align: -2px; }
.d3-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; }
.d3-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border: 1px solid var(--glass-b); border-radius: 999px; background: var(--chip); color: var(--ink); }
.d3-chip .d3-ball { width: auto; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; font-size: 11px; }

/* โพยล่าสุด */
.d3-feed { perspective: 900px; }
.d3-slip {
    position: relative; display: flex; align-items: center; gap: 12px; margin-bottom: 8px; padding: 12px 14px; border: 1px dashed var(--glass-b); border-radius: 12px;
    background: var(--glass); color: var(--muted); text-decoration: none; transform-origin: 50% 0;
}
a.d3-slip:hover { border-color: var(--primary); color: var(--muted); }
.d3-slip-main { flex: 1 1 auto; min-width: 0; }
.d3-slip-name { overflow: hidden; color: var(--ink); font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.d3-slip-meta { font-size: 12px; }
.d3-slip-side { flex-shrink: 0; text-align: right; }
.d3-slip-amount { color: var(--ink); font-weight: 700; }
.d3-slip-status { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 12px; }
.d3-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.d3-pill.ok { background: rgba(55, 216, 10, .18); color: var(--success-ink); }
.d3-pill.wait { background: rgba(255, 188, 43, .22); color: var(--warn-ink); }
.d3-empty { padding: 24px 0; text-align: center; }

/* กำไร/ขาดทุน: แท่ง 3D บนพื้นตาราง ได้ตั้งขึ้น เสียจมลง */
.d3-scroll-x { overflow-x: auto; overflow-y: hidden; }
.d3-pstage { height: 340px; perspective: 1100px; }
.d3-pscene { left: 50%; top: 50%; height: 120px; transform: rotateX(60deg) rotateZ(-12deg); }
.d3-plabel { position: absolute; left: 0; top: 0; font-family: inherit; font-size: 13px; font-weight: 700; white-space: nowrap; transform-origin: 0 0; }
.d3-ptxt { position: absolute; width: 84px; color: var(--ink); font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.35; text-align: center; }
.d3-ptxt span { color: var(--muted); font-weight: 400; }

@media (prefers-reduced-motion: no-preference) {
    .d3-rise { animation: lk3-rise .5s cubic-bezier(.2, .7, .2, 1) both; }
    .d3-ring { animation: lk3-drum 14s linear infinite; }
    .d3-wob1 { animation: lk3-wob1 3.1s ease-in-out infinite; }
    .d3-wob2 { animation: lk3-wob2 2.6s ease-in-out infinite; }
    .d3-wob3 { animation: lk3-wob3 3.7s ease-in-out infinite; }
    .d3-disc { animation: lk3-disc 4s ease-in-out infinite; }
    .d3-drop-a { animation: lk3-drop-a .9s cubic-bezier(.3, 0, .3, 1) both; }
    .d3-flip-a { animation: lk3-flip-a .5s cubic-bezier(.3, 1.4, .5, 1); }
    .d3-flip-b { animation: lk3-flip-b .5s cubic-bezier(.3, 1.4, .5, 1); }
    .d3-tilt { transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
    .d3-tilt:hover { transform: perspective(700px) rotateX(7deg) rotateY(-7deg) translateZ(6px); }
    .d3-grow { animation: lk3-grow .7s cubic-bezier(.2, .7, .2, 1) both; }
    .d3-push { animation: lk3-push .5s cubic-bezier(.2, .8, .2, 1); }
    .d3-fly { animation: lk3-fly .6s cubic-bezier(.2, .9, .25, 1) both; }
    .d3-tagin { animation: lk3-fade .3s ease-out both; }
}
@keyframes lk3-rise { from { opacity: 0; transform: translateY(16px) rotateX(-8deg); } to { opacity: 1; transform: none; } }
@keyframes lk3-drum { from { transform: rotateX(0); } to { transform: rotateX(360deg); } }
@keyframes lk3-wob1 { 0%, 100% { transform: translate3d(0, 0, 0); } 25% { transform: translate3d(34px, -38px, 40px); } 50% { transform: translate3d(-10px, -60px, -30px); } 75% { transform: translate3d(-36px, -20px, 24px); } }
@keyframes lk3-wob2 { 0%, 100% { transform: translate3d(0, 0, 0); } 30% { transform: translate3d(-40px, -30px, -36px); } 60% { transform: translate3d(20px, -56px, 30px); } 85% { transform: translate3d(30px, -10px, -10px); } }
@keyframes lk3-wob3 { 0%, 100% { transform: translate3d(0, 0, 0); } 20% { transform: translate3d(20px, -50px, -40px); } 55% { transform: translate3d(-30px, -34px, 46px); } 80% { transform: translate3d(-14px, -8px, -20px); } }
@keyframes lk3-disc { 0%, 70% { transform: rotateY(0); } 100% { transform: rotateY(360deg); } }
@keyframes lk3-drop-a { 0% { opacity: 0; transform: translateY(-130px) rotateY(-540deg); } 45% { opacity: 1; transform: translateY(0) rotateY(-40deg); } 62% { transform: translateY(-16px) rotateY(10deg); } 78% { transform: translateY(0) rotateY(0); } 90% { transform: translateY(-4px); } 100% { transform: none; } }
@keyframes lk3-flip-a { 0% { transform: rotateX(95deg); filter: brightness(1.8); } 100% { transform: none; filter: none; } }
@keyframes lk3-flip-b { 0% { transform: rotateX(95deg); filter: brightness(1.8); } 100% { transform: none; filter: none; } }
@keyframes lk3-grow { from { transform: scaleZ(.02); } to { transform: scaleZ(1); } }
@keyframes lk3-push { from { transform: translateY(-72px); } to { transform: none; } }
@keyframes lk3-fly { from { opacity: 0; transform: translate3d(0, -40px, 320px) rotateX(-75deg); } to { opacity: 1; } }
@keyframes lk3-fade { from { opacity: 0; } }
.d3-city-fit { position: absolute; inset: 0; transform-origin: 50% 50%; transform-style: preserve-3d; } /* JS ย่อให้พอดีกล่องบนจอแคบ */
/* dashboard ผลรางวัล: 4 แถวเรียงแบบหน้าปิดหวย (รางวัลที่ 1, เลขหน้า 3 ตัว, เลขท้าย 3 ตัว, เลขท้าย 2 ตัว) เลขเต็มในลูกบอลแคปซูล */
.d3-board { display: grid; gap: 8px; }
.d3-board-slot { display: grid; gap: 6px; padding: 8px 10px; border: 1px solid var(--glass-b); border-radius: 12px; background: var(--chip); }
.d3-board-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; line-height: 1.25; }
.d3-board-head b { color: var(--primary-ink); font-weight: 700; font-size: 14px; }
.d3-board-head small { font-size: 12px; }
.d3-groove.d3-groove--board { flex-wrap: nowrap; min-height: 56px; padding: 6px 8px; }
.d3-ball.z-pill { width: auto; min-width: 44px; height: 44px; padding: 0 14px; border-radius: 22px; font-size: 21px; letter-spacing: .06em; }
.d3-ball.z-pill::before { inset: 4px; border-radius: 18px; }
.d3-board-slot.is-first .d3-ball.z-pill { height: 48px; padding: 0 18px; border-radius: 24px; font-size: 25px; }
.d3-fd.sep.unit { align-self: center; padding: 0 8px 0 4px; font-size: .5em; font-weight: 600; white-space: pre; } /* คำหน่วยในป้ายพลิก เช่น "วัน" */

/* วางข้อความโพย: ตัวใหญ่พอให้อ่านข้อความจากแชตได้ (16px กัน iOS ซูม) */
.paste-text { font-size: 16px; line-height: 1.6; min-height: 260px; }
/* ช่องค้นหาในแถวกรอง (สมาชิก, ยอดสรุปเป็นใบ): สูงเท่า dropdown ข้าง ๆ ให้ label บนช่องอยู่แนวเดียวกัน */
form .table-src-form .form-control { height: 42px; }
