/* RSR Taekwondo — เว็บแอปจองคลาส
   แนว Bold color block × โดจัง: หัวกรมท่าเข้ม การ์ดขาวแถบสีตามคลาส แดง/น้ำเงิน/เหลืองสายคาด บนพื้นครีม */
:root {
  /* โทนแดงตามโลโก้ RSR-GRAND (ลูกค้าขอพื้นหลังแดง 2/12/69) · --ink = แดงเข้มสำหรับหัว/ปฏิทิน/ตัวหนังสือหัวข้อ */
  --ink: #4E0A0D; --ink-2: #6A0F13; --ink-3: #8E1B20;
  --bg-red: #8A1214;
  --red: #D62839; --blue: #1F4FA3; --yellow: #F2B705; --green: #1E8E5A;
  --cream: #F5F3EE; --card: #fff; --line: #E6E1D6; --muted: #6B6F78; --text: #1B2130;
  --radius: 18px; --shadow: 0 6px 20px rgba(15, 27, 45, .08);
  --nav-h: 68px;
  font-family: 'Sarabun', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--text); -webkit-tap-highlight-color: transparent; }
body { min-height: 100dvh; font-size: 16px; line-height: 1.5; }
h1, h2, h3, .k { font-family: 'Kanit', 'Sarabun', sans-serif; font-weight: 600; letter-spacing: .01em; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
[hidden] { display: none !important; }

/* ลายพื้นหลังโดจัง: เส้นสายคาดเฉียงจางๆ */
.dojo-bg {
  background-color: var(--cream);
  background-image:
    repeating-linear-gradient(135deg, rgba(15, 27, 45, .035) 0 2px, transparent 2px 26px),
    radial-gradient(circle at 90% 0%, rgba(214, 40, 57, .08), transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(31, 79, 163, .08), transparent 45%);
}

/* ---------- โครงหน้า ---------- */
.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); position: relative; }
.page-head { background: var(--ink); color: #fff; padding: calc(22px + env(safe-area-inset-top)) 20px 26px; border-radius: 0 0 28px 28px; position: relative; overflow: hidden; }
.page-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: linear-gradient(90deg, var(--red) 0 33%, var(--blue) 33% 66%, var(--yellow) 66%); }
.page-head h1 { font-size: 24px; }
.page-head p { margin: 4px 0 0; opacity: .7; font-size: 14px; }
.section { padding: 18px 16px 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 6px 4px 12px; }
.section-title h2 { font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- แถบเมนูล่าง ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); pointer-events: none; }
.nav-inner { pointer-events: auto; background: #fff; border-top: 1px solid var(--line); }
.nav-inner { display: flex; width: 100%; max-width: 480px; height: var(--nav-h); }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: #8A8F99; font-size: 12px; font-family: 'Kanit', sans-serif; }
.nav a svg { width: 25px; height: 25px; }
.nav a.on { color: var(--ink); }
.nav a.on svg { color: var(--red); }

/* ---------- ปุ่ม ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 13px 18px; font-family: 'Kanit', sans-serif; font-weight: 500; font-size: 16px; cursor: pointer; text-decoration: none; transition: transform .1s, opacity .2s; white-space: nowrap; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 6px 16px rgba(214, 40, 57, .28); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn-line { background: #06C755; color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--blue); cursor: pointer; padding: 4px; font-size: 14px; text-decoration: underline; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: inherit; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- ฟอร์ม ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.input { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; font-size: 16px; outline: none; }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 79, 163, .12); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; text-align: left; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip input { display: none; }

/* ---------- การ์ด ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-family: 'Kanit', sans-serif; font-weight: 500; white-space: nowrap; }
.badge-red { background: #FDE8EA; color: var(--red); }
.badge-green { background: #E3F4EC; color: var(--green); }
.badge-gray { background: #ECEBE7; color: #5B5F68; }
.badge-blue { background: #E6EDFA; color: var(--blue); }
.badge-yellow { background: #FFF4CF; color: #8A6500; }

/* อวาตาร์ (รูปจาก R2 หรือตัวอักษรย่อ) */
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--ink-3); color: #fff; display: inline-grid; place-items: center; font-size: 13px; font-family: 'Kanit', sans-serif; flex: none; overflow: hidden; border: 2px solid #fff; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av-lg { width: 56px; height: 56px; font-size: 20px; }
.av-stack { display: inline-flex; }
.av-stack .av { margin-left: -10px; }
.av-stack .av:first-child { margin-left: 0; }
.av-more { background: #EEF1F6; color: var(--ink); font-size: 12px; }

/* สายคาด: แถบสีเล็กๆ ข้างชื่อ */
.belt { display: inline-block; width: 22px; height: 9px; border-radius: 3px; vertical-align: middle; border: 1px solid rgba(0, 0, 0, .15); }

/* ---------- ปฏิทิน (หัวสีเข้ม) ---------- */
.cal { background: var(--ink); color: #fff; padding: 14px 14px 16px; margin: 16px 12px 0; border-radius: 24px; position: relative; top: env(safe-area-inset-top); z-index: 10; box-shadow: 0 10px 30px rgba(15, 27, 45, .25); }
.cal-top { display: flex; align-items: center; gap: 4px; padding: 0 4px 10px; }
.cal-title { display: flex; align-items: center; gap: 6px; background: none; border: 0; color: #fff; font-family: 'Kanit', sans-serif; font-size: 21px; font-weight: 600; padding: 4px 6px; cursor: pointer; border-radius: 10px; }
.cal-title svg { width: 20px; height: 20px; transition: transform .25s; }
.cal.collapsed { position: sticky; }
.cal.collapsed .cal-title svg { transform: rotate(180deg); }
.cal-top .grow { flex: 1; }
.cal-top .icon-btn { color: #fff; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; text-align: center; }
.cal-wd { font-size: 13px; opacity: .6; padding-bottom: 6px; font-family: 'Kanit', sans-serif; }
.cal-day { position: relative; height: 48px; border: 0; background: none; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; padding-top: 4px; font-family: 'Kanit', sans-serif; font-size: 17px; font-weight: 500; }
.cal-day .n { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; transition: background .15s; }
.cal-day.out { opacity: .32; }
.cal-day.today .n { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .55); }
.cal-day.sel .n { background: #fff; color: var(--ink); }
.cal-day .dots { display: flex; gap: 3px; height: 6px; margin-top: 1px; }
.cal-day .dot { width: 5px; height: 5px; border-radius: 50%; background: #9FB3D9; }
.cal-day .dot.mine { background: var(--red); box-shadow: 0 0 0 1.5px var(--ink); }
.cal-day.hidden-row { display: none; }
.cal-legend { display: flex; gap: 14px; justify-content: center; font-size: 12px; opacity: .65; margin-top: 8px; }
.cal-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.cal-filter { margin: 2px 4px 12px; }
.cal-filter .chip { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .25); }
.cal-filter .chip.on { background: #fff; color: var(--ink); }

/* ---------- รายการคลาสของวัน ---------- */
.day-head { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 20px 10px; }
.day-head h2 { font-size: 19px; }
.list { padding: 0 14px; touch-action: pan-y; }
.cls { position: relative; display: block; width: 100%; text-align: left; background: #fff; border: 0; border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 14px; padding: 14px 16px 0 22px; cursor: pointer; overflow: hidden; }
.cls::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--c, var(--red)); }
.cls-top { display: flex; justify-content: space-between; align-items: center; color: #3A3F4A; font-size: 16px; }
.cls-dur { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 14px; }
.cls-dur svg { width: 16px; height: 16px; }
.cls-name { font-family: 'Kanit', sans-serif; font-size: 19px; font-weight: 600; margin: 4px 0 8px; text-transform: uppercase; letter-spacing: .02em; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.cls-name .ok { color: var(--green); width: 20px; height: 20px; }
.cls-sub { margin: -6px 0 8px; font-size: 14px; color: var(--muted); }
.cls-people { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; min-height: 46px; }
.cls-people .txt { font-size: 15px; color: #444A55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cls-people .txt b { color: var(--ink); }
.cls-coach { display: flex; align-items: center; gap: 10px; border-top: 1px solid #EFECE5; padding: 10px 0 12px; font-size: 15px; color: #3A3F4A; }
.cls-coach .av { background: #5A6478; width: 30px; height: 30px; font-size: 11px; }
.cls-mine { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; margin-top: -4px; }
.cls .tag { position: absolute; right: 14px; top: 44px; }
.cls.full .cls-people .txt b { color: var(--muted); }
.cls.closed { background: #F3F1EC; }
.cls.closed .cls-name, .cls.closed .cls-top span:first-child { text-decoration: line-through; color: #8C8F96; }
.cls.closed::before { background: #B9B6AE; }
.cls.past { opacity: .55; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 64px; height: 64px; color: #C9C3B6; }

/* ปุ่มลอย */
.fab { position: fixed; right: max(18px, calc(50% - 240px + 18px)); bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); z-index: 25; width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--ink-2); color: #fff; box-shadow: 0 10px 24px rgba(15, 27, 45, .35); display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.fab svg { width: 30px; height: 30px; }
.fab-line { background: #06C755; box-shadow: 0 10px 24px rgba(6, 199, 85, .35); }

/* ---------- แผ่นเลื่อนขึ้นจากล่าง ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(10, 16, 28, .5); z-index: 50; opacity: 0; transition: opacity .2s; }
.sheet-bg.show { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-width: 480px; margin: 0 auto; background: #fff; border-radius: 24px 24px 0 0; max-height: 88dvh; overflow: auto; transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); }
.sheet.show { transform: translateY(0); }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: #DDD8CD; margin: 0 auto 12px; }
.sheet h3 { font-size: 21px; }
.sheet-close { position: absolute; right: 10px; top: 10px; }
.sheet-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 15px; margin: 6px 0 14px; }
.sheet-meta span { display: inline-flex; align-items: center; gap: 5px; }
.sheet-meta svg { width: 17px; height: 17px; }
.sheet-foot { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); background: #fff; padding: 12px 0 4px; margin-top: 8px; }
.kid { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; margin-bottom: 10px; cursor: pointer; }
.kid.sel { border-color: var(--red); background: #FFF6F7; }
.kid.dis { cursor: default; background: #FAF9F6; }
.kid .info { flex: 1; min-width: 0; }
.kid .nm { font-family: 'Kanit', sans-serif; font-weight: 500; }
.kid .sub { font-size: 13px; color: var(--muted); }
.check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #C9C3B6; display: grid; place-items: center; flex: none; }
.kid.sel .check { background: var(--red); border-color: var(--red); color: #fff; }
.check svg { width: 16px; height: 16px; }
.note { background: #F6F4EF; border-radius: 12px; padding: 10px 12px; font-size: 14px; color: #555A64; margin: 8px 0; }
.note.warn { background: #FFF4CF; color: #6B4E00; }

/* ---------- รายการทั่วไป ---------- */
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #EFECE5; }
.item:last-child { border-bottom: 0; }
.item .info { flex: 1; min-width: 0; }
.item .ttl { font-family: 'Kanit', sans-serif; font-weight: 500; }
.bar { width: 6px; align-self: stretch; border-radius: 3px; background: var(--c, var(--red)); flex: none; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 14px 16px 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .chip { white-space: nowrap; }

/* แจ้งเตือนสั้น */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 90px); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 80; opacity: 0; transition: .25s; max-width: calc(100% - 32px); text-align: center; font-size: 15px; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }

/* ---------- หน้าเข้าสู่ระบบ ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; }
.auth-hero { background: var(--ink); color: #fff; padding: calc(48px + env(safe-area-inset-top)) 26px 70px; position: relative; overflow: hidden; }
.auth-hero .logo { width: 64px; height: 64px; border-radius: 18px; background: #fff; display: grid; place-items: center; margin-bottom: 18px; }
.auth-hero .logo svg { width: 42px; height: 42px; }
.auth-hero h1 { font-size: 30px; line-height: 1.2; }
.auth-hero h1 em { font-style: normal; color: var(--yellow); }
.auth-hero p { opacity: .75; margin: 10px 0 0; }
.auth-belt { position: absolute; left: -10%; right: -10%; bottom: 26px; height: 18px; background: var(--red); transform: rotate(-4deg); box-shadow: 0 -22px 0 -4px var(--blue), 0 22px 0 -4px var(--yellow); }
.auth-card { background: #fff; margin: -34px 16px 24px; border-radius: 22px; box-shadow: var(--shadow); padding: 22px 20px; position: relative; z-index: 2; }
.seg { display: flex; background: #F1EEE7; border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.seg button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 9px; font-family: 'Kanit', sans-serif; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }

/* ---------- เว็บแอปสำหรับมือถือเท่านั้น: เปิดบนจอใหญ่ก็แสดงเป็นคอลัมน์ขนาดมือถือกลางจอ ---------- */
@media (min-width: 520px) {
  body { background-color: #E7E3DA; }
  .app { box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(15, 27, 45, .12); background: var(--cream); }
}

/* ---------- สอบเลื่อนสาย ---------- */
.exam-card { display: flex; align-items: center; gap: 14px; border-left: 5px solid var(--yellow); }
.exam-ic { width: 44px; height: 44px; border-radius: 12px; background: #FFF4CF; color: #8A6500; display: grid; place-items: center; flex: none; }
.exam-ic svg { width: 24px; height: 24px; }
.belt-card { position: relative; overflow: hidden; padding: 18px 16px 14px; }
.belt-card.ready { box-shadow: 0 0 0 2px #CFEBDD, var(--shadow); }
.bc-head { display: flex; align-items: center; gap: 14px; padding-right: 96px; }
.belt-art { position: relative; height: 14px; margin: 16px 0 6px; border-radius: 4px; background: var(--b); border: 1px solid rgba(0, 0, 0, .14); }
.belt-art i { position: absolute; left: 50%; top: 50%; width: 26px; height: 24px; transform: translate(-50%, -50%); background: var(--b); border: 1px solid rgba(0, 0, 0, .2); border-radius: 5px; }
.belt-art::before, .belt-art::after { content: ''; position: absolute; top: 9px; width: 12px; height: 26px; background: var(--b); border: 1px solid rgba(0, 0, 0, .16); border-radius: 2px; left: calc(50% - 12px); transform: rotate(18deg); transform-origin: top; }
.belt-art::after { left: 50%; transform: rotate(-18deg); }
.bc-route { display: flex; align-items: center; gap: 8px; margin: 26px 0 10px; font-family: 'Kanit', sans-serif; font-size: 15px; color: var(--muted); }
.bc-route svg { width: 16px; height: 16px; }
.bc-route .to { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; }
.bc-route .to i { width: 20px; height: 7px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .15); }
.meter { position: relative; height: 16px; border-radius: 999px; background: #EEE9DF; overflow: hidden; }
.meter > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, var(--ink-3), var(--ink)); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.ready .meter > i { background: linear-gradient(90deg, #2FA36F, var(--green)); }
/* ขีดแบ่งทุกครั้งที่มาเรียน */
.meter > span { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(100% / var(--n) - 2px), rgba(255, 255, 255, .55) calc(100% / var(--n) - 2px) calc(100% / var(--n))); }
.bc-count { display: flex; justify-content: space-between; margin-top: 8px; font-size: 14px; color: var(--muted); }
.bc-count b { font-family: 'Kanit', sans-serif; font-size: 18px; color: var(--ink); }
.ok-note { background: #E3F4EC; color: #14653F; display: flex; gap: 8px; align-items: flex-start; }
.ok-note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.stamp { position: absolute; z-index: 2; right: 12px; top: 12px; width: 98px; height: 98px; border-radius: 50%; border: 3px solid var(--red); color: var(--red);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; font-family: 'Kanit', sans-serif; text-align: center;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px var(--red); transform: rotate(-14deg); opacity: .92; animation: stamp .5s cubic-bezier(.2, 1.4, .4, 1) both .2s;
  -webkit-mask: radial-gradient(circle at 30% 40%, #000 60%, rgba(0,0,0,.75) 61%), linear-gradient(#000, #000); }
.stamp b { font-size: 24px; font-weight: 700; letter-spacing: .02em; margin: 2px 0; }
.stamp small { font-size: 10.5px; font-weight: 600; }
@keyframes stamp { from { transform: rotate(-14deg) scale(2.2); opacity: 0; } to { transform: rotate(-14deg) scale(1); opacity: .92; } }
@media (prefers-reduced-motion: reduce) { .stamp { animation: none; } .meter > i { transition: none; } }
.belt-path { display: flex; gap: 6px; overflow-x: auto; margin: 14px -16px 0; padding: 2px 16px 4px; scrollbar-width: none; }
.belt-path::-webkit-scrollbar { display: none; }
.bp { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 4px 9px; border-radius: 999px; background: #F3F1EC; font-size: 12px; color: #9A9DA4; font-family: 'Kanit', sans-serif; }
.bp i { width: 16px; height: 6px; border-radius: 2px; border: 1px solid rgba(0, 0, 0, .15); }
.bp svg { width: 13px; height: 13px; color: var(--green); }
.bp.done { color: var(--ink); background: #E3F4EC; }
.bp.now { color: #fff; background: var(--ink); }
.bp.next { color: var(--ink); background: #fff; outline: 1.5px dashed #B9B3A6; }
.bc-hist { margin-top: 10px; font-size: 13px; }
.bc-hist summary { cursor: pointer; color: var(--blue); font-family: 'Kanit', sans-serif; }
.bc-hist > div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid #EFECE5; }

/* ฟอร์มข้อมูลส่วนตัวผู้เรียน */
.form-sec { font-family: 'Kanit', sans-serif; font-weight: 600; color: var(--ink); margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid #EFECE5; }
.form-sec:first-child, #kf > .form-sec:first-of-type { border-top: 0; padding-top: 0; margin-top: 4px; }
.form-sec small { font-weight: 400; font-family: 'Sarabun', sans-serif; }
.input.ro { display: flex; align-items: center; background: #F6F4EF; color: var(--muted); }

/* ขั้นของผู้เรียน */
.tier { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; background: var(--ink); color: #fff; font: 500 11.5px/1.6 'Kanit', sans-serif; letter-spacing: .03em; }
.tier-none { background: #FFF4CF; color: #8A6500; }
.tiers { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; align-items: center; }
.plans-buy { margin: 10px 0 0; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; background: #FBFAF6; }
.plans-buy summary { cursor: pointer; padding: 11px 0; font-family: 'Kanit', sans-serif; font-weight: 500; color: var(--ink); display: flex; justify-content: space-between; gap: 8px; }
.plans-buy summary::-webkit-details-marker { display: none; }
.plans-buy summary::after { content: '›'; transform: rotate(90deg); transition: transform .2s; color: var(--muted); }
.plans-buy[open] summary::after { transform: rotate(-90deg); }
.plan-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px dashed #E6E1D6; font-size: 14px; }
.plan-row b { font-family: 'Kanit', sans-serif; font-weight: 600; color: var(--ink); white-space: nowrap; }
.plan-row small { display: block; color: var(--muted); font-size: 12px; }

/* หลอดสอบสายแบบแบ่งช่อง มีเลขครั้ง */
.meter.seg { display: grid; grid-template-columns: repeat(var(--c), 1fr); gap: 5px; height: auto; background: none; border-radius: 0; overflow: visible; }
.meter.seg > i { position: static; height: 28px; min-width: 0; border-radius: 8px; background: #EEE9DF; color: #A9A293; display: grid; place-items: center;
  font: 600 12px/1 'Kanit', sans-serif; transition: none; animation: none; }
.meter.seg > i.on { background: var(--ink); color: #fff; animation: segIn .35s both var(--d); }
.meter.seg > i.last { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--red); position: relative; z-index: 1; }
.ready .meter.seg > i.on { background: var(--green); }
@keyframes segIn { from { transform: scaleY(.3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .meter.seg > i.on { animation: none; } }

/* มาเรียนเกินเกณฑ์: ช่องต่อท้ายสีเดียวกับช่องที่ครบ ข้อความบอก +N */
.extra-n { color: #B07D00; }

/* ---------- คลังความรู้ ---------- */
.nav a span { white-space: nowrap; }
.learn-head { background-image: radial-gradient(circle at 92% 10%, rgba(214, 40, 57, .35), transparent 38%), radial-gradient(circle at 8% 110%, rgba(31, 79, 163, .45), transparent 45%); }
.home-tips { margin: 16px 16px 0; padding: 0; overflow: hidden; }
.home-tips summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.home-tips summary::-webkit-details-marker { display: none; }
.home-tips summary > span:last-child { display: flex; flex-direction: column; line-height: 1.35; }
.home-tips summary::after { content: '›'; margin-left: auto; transform: rotate(90deg); color: var(--muted); font-size: 20px; transition: transform .2s; }
.home-tips[open] summary::after { transform: rotate(-90deg); }
.tips-ic { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: #FFF4CF; color: #8A6500; font: 700 18px 'Kanit', sans-serif; }
.home-tips ol { margin: 0; padding: 0 18px 14px 38px; font-size: 14.5px; color: var(--text); }
.home-tips li { margin: 6px 0; }
#cats .chip small { margin-left: 2px; opacity: .6; font-size: 12px; }
.vcard { display: flex; gap: 12px; width: 100%; padding: 10px; margin: 0 0 12px; border: 0; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); text-align: left; cursor: pointer; font: inherit; color: inherit; }
.vcard:active { transform: scale(.99); }
.vthumb { position: relative; flex: none; width: 132px; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--ink); }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vplay { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, transparent 40%, rgba(15, 27, 45, .45)); color: #fff; }
.vplay svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .4)); }
.vbody { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-top: 2px; }
.vtitle { font-family: 'Kanit', sans-serif; font-weight: 500; font-size: 15.5px; line-height: 1.3; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vch { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vtags { display: flex; flex-wrap: wrap; gap: 5px; }
.vtag { font: 500 11px/1.7 'Kanit', sans-serif; padding: 0 8px; border-radius: 999px; background: #EEF2FA; color: var(--blue); }
.vtag-belt { background: #F4F1EA; color: var(--ink-3); }
.vfit { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--green); font-weight: 600; }
.vfit svg { width: 14px; height: 14px; }
.vcard-big { flex-direction: column; padding: 0 0 14px; overflow: hidden; }
.vcard-big .vthumb { width: 100%; border-radius: 0; }
.vcard-big .vplay svg { width: 58px; height: 58px; }
.vcard-big .vbody { padding: 4px 16px 0; gap: 5px; }
.vcard-big .vtitle { font-size: 18px; }
.vplayer { position: relative; aspect-ratio: 16 / 9; margin: 4px -4px 0; border-radius: 14px; overflow: hidden; background: #000; }
.vplayer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vdesc { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: #F6F4EF; }
.vdesc p { margin: 4px 0 0; font-size: 15px; }

/* ---------- หน้าแรก: โลโก้บนซ้าย + แบนเนอร์สไลด์ ---------- */
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--ink); color: #fff; padding: calc(14px + env(safe-area-inset-top)) 18px 84px; border-radius: 0 0 28px 28px;
  background-image: radial-gradient(circle at 96% 0%, rgba(214, 40, 57, .38), transparent 42%), radial-gradient(circle at 0% 120%, rgba(31, 79, 163, .5), transparent 50%); }
.home-top:has(+ .bn-wrap[hidden]) { padding-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; min-width: 0; }
.brand img { width: 44px; height: 44px; border-radius: 12px; flex: none; object-fit: cover; box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 6px 14px rgba(0, 0, 0, .3); }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font: 700 20px 'Kanit', sans-serif; letter-spacing: .05em; }
.brand small { font: 500 10.5px 'Kanit', sans-serif; letter-spacing: .2em; text-transform: uppercase; opacity: .7; margin-top: 3px; }
.home-me { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .12); border: 1.5px solid rgba(255, 255, 255, .3); color: #fff; font: 600 16px 'Kanit', sans-serif; text-decoration: none; }
.bn-wrap { margin-top: -70px; position: relative; z-index: 2; }
.bn-track { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 16px; scroll-padding: 0 16px; scrollbar-width: none; overscroll-behavior-x: contain; }
.bn-track::-webkit-scrollbar { display: none; }
.bn { --bg: #974032; --fg: #fff; position: relative; flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 2.05 / 1; border-radius: 22px; overflow: hidden; background: var(--bg); color: var(--fg); text-decoration: none; box-shadow: 0 12px 28px rgba(15, 27, 45, .22); display: flex; align-items: center; isolation: isolate; }
.bn-red { --bg: #974032; }
.bn-blue { --bg: #1F4FA3; }
.bn-ink { --bg: #14233A; }
.bn-yellow { --bg: #F2B705; --fg: #1B1A10; }
.bn-img { position: absolute; top: 0; right: 0; width: 56%; height: 100%; object-fit: cover; object-position: center 35%; z-index: -2; }
.bn.has-img::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, var(--bg) 44%, color-mix(in srgb, var(--bg) 55%, transparent) 54%, transparent 66%); }
.bn-text { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 0 18px; max-width: 60%; }
.bn-title { font: 700 21px/1.2 'Kanit', sans-serif; text-wrap: balance; text-shadow: 0 1px 8px rgba(0, 0, 0, .15); }
.bn-sub { font-size: 13.5px; line-height: 1.4; opacity: .9; }
.bn-cta { margin-top: 6px; display: inline-flex; align-items: center; gap: 2px; padding: 5px 10px 5px 13px; border-radius: 999px; background: var(--fg); color: var(--bg); font: 600 13.5px 'Kanit', sans-serif; }
.bn-cta svg { width: 15px; height: 15px; }
.bn-yellow .bn-cta { background: var(--ink); color: #fff; }
/* พื้นแบนเนอร์ที่ไม่มีรูป: สายคาดเรียงเฉียงจากขาวถึงดำ */
.bn-belts { position: absolute; right: -36px; top: -30%; bottom: -30%; width: 44%; display: flex; gap: 7px; transform: rotate(18deg); z-index: -1; }
.bn-belts i { flex: 1; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.bn-belts i:nth-child(1) { background: #fff; } .bn-belts i:nth-child(2) { background: #F5D20A; } .bn-belts i:nth-child(3) { background: #12994A; }
.bn-belts i:nth-child(4) { background: #1C6FD8; } .bn-belts i:nth-child(5) { background: #E8382B; } .bn-belts i:nth-child(6) { background: #141414; }
.bn-blue .bn-belts i:nth-child(4) { background: #0F1B2D; }
.bn-dots { display: flex; justify-content: center; gap: 6px; padding-top: 10px; }
.bn-dots button { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 99px; background: rgba(15, 27, 45, .2); cursor: pointer; transition: width .25s, background .25s; }
.bn-dots button.on { width: 20px; background: var(--red); }
.bn-wrap + .cal { margin-top: 12px; }
@media (min-width: 420px) { .bn-title { font-size: 23px; } }
.home-me svg { width: 21px; height: 21px; }

/* ---------- จุดแจ้งเตือนบนเมนูล่าง ---------- */
.nav a { position: relative; }
.nav-dot { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font: 600 11px/18px 'Kanit', sans-serif; text-align: center; box-shadow: 0 0 0 2px #fff; }

/* ---------- แอปครู ---------- */
.coach-app .app { padding-bottom: 40px; }
.grow { flex: 1; }
.co-top { padding-bottom: 54px; }
.co-week { margin: -40px 12px 0; position: relative; z-index: 2; padding: 12px 10px 10px; }
.co-week-top { display: flex; align-items: center; padding: 0 6px 6px; }
.co-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.co-day { border: 0; background: none; border-radius: 14px; padding: 6px 0 4px; display: flex; flex-direction: column; align-items: center; cursor: pointer; font-family: 'Kanit', sans-serif; color: var(--ink); }
.co-day small { font-size: 12px; color: var(--muted); }
.co-day b { font-size: 19px; font-weight: 600; line-height: 1.3; }
.co-day i { font-style: normal; color: var(--red); font-size: 14px; line-height: 10px; height: 10px; letter-spacing: 1px; }
.co-day.today b { color: var(--red); }
.co-day.sel { background: var(--ink); }
.co-day.sel small, .co-day.sel b, .co-day.sel i { color: #fff; }
.co-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-bottom: 12px; font-size: 14.5px; color: #444A55; }
.co-stats span { display: inline-flex; align-items: center; gap: 5px; }
.co-stats svg { width: 17px; height: 17px; color: var(--muted); }
.co-stats .done, .co-stats .done svg { color: var(--green); }
.co-cls .cls-coach svg { width: 18px; height: 18px; color: var(--muted); }
.co-head { display: flex; align-items: center; gap: 8px; margin: -40px 12px 0; position: relative; z-index: 2; border-left: 7px solid var(--c); padding: 12px 14px 12px 8px; }
.co-sum { display: flex; justify-content: center; gap: 18px; padding: 14px 16px 6px; font-size: 14px; color: var(--muted); }
.co-sum b { font: 600 18px 'Kanit', sans-serif; color: var(--ink); margin-right: 3px; }
.co-kid { padding: 12px 14px; }
.co-kid-top { display: flex; align-items: center; gap: 12px; }
.co-kid-top .av { width: 46px; height: 46px; font-size: 15px; }
.co-kid-top .info { flex: 1; min-width: 0; }
.co-kid-top .ttl { font: 600 17px 'Kanit', sans-serif; color: var(--ink); }
.co-kid-top .belt { vertical-align: 1px; }
.co-att { flex: none; display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px 7px 9px; font: 500 14px 'Kanit', sans-serif; color: var(--muted); cursor: pointer; }
.co-att svg { width: 17px; height: 17px; }
.co-att.on { background: var(--green); border-color: var(--green); color: #fff; }
.co-write { margin-top: 10px; }
.co-write svg, .co-note svg { width: 17px; height: 17px; flex: none; }
.co-note { display: flex; flex-direction: column; gap: 6px; width: 100%; margin-top: 10px; padding: 10px 12px; border: 0; border-radius: 12px; background: #F6F4EF; text-align: left; cursor: pointer; font: inherit; color: var(--text); }
.co-note-text { display: flex; gap: 8px; font-size: 14.5px; }
.co-note-text span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.co-note-audio { display: inline-flex; align-items: center; gap: 6px; font: 500 14px 'Kanit', sans-serif; color: var(--blue); }
.co-note-meta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.co-note-meta svg { width: 14px; height: 14px; color: var(--green); }
.co-quick { margin: 8px 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.co-quick .chip { font-size: 13.5px; padding: 5px 11px; }
.co-mic { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; border: 1.5px dashed #E6B9BE; border-radius: 16px; background: #FFF6F7; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.co-mic > svg { width: 48px; height: 48px; padding: 12px; border-radius: 50%; background: var(--red); color: #fff; flex: none; box-shadow: 0 6px 16px rgba(214, 40, 57, .3); }
.co-mic span { display: flex; flex-direction: column; }
.co-mic b { font: 600 16px 'Kanit', sans-serif; color: var(--ink); }
.co-mic small { font-size: 13px; color: var(--muted); }
.co-rec { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 16px; background: #FFF6F7; }
.co-rec b { font: 600 20px 'Kanit', sans-serif; color: var(--red); font-variant-numeric: tabular-nums; }
.co-rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: co-blink 1s infinite; }
@keyframes co-blink { 50% { opacity: .25; } }
.co-rec .btn svg { width: 16px; height: 16px; }
.co-play { padding: 12px; border-radius: 16px; background: #F6F4EF; }
.co-play audio { width: 100%; margin: 8px 0; }
.co-play-btns { display: flex; gap: 8px; }
.co-play-btns .btn { flex: 1; }
.co-play-btns svg { width: 16px; height: 16px; }

/* ---------- แอดมิน: เพิ่ม/เอานักเรียนออกจากคลาส (หัก/คืนครั้ง) ---------- */
.co-add-row { margin: 10px 16px 0; }
.st-admin-row .btn { white-space: normal; height: auto; min-height: 48px; padding-top: 8px; padding-bottom: 8px; line-height: 1.3; }
.co-add-row .btn svg { width: 18px; height: 18px; vertical-align: -3px; }
.co-kid-pack b { font-weight: 600; color: var(--ink); }
.co-kid-pack { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed #EAE6DE; }
.co-kid-pack .small { min-width: 0; }
.co-rm { flex: none; display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid #F0C9CD; background: #FFF6F7; color: var(--red); border-radius: 999px; padding: 5px 11px 5px 8px; font: 500 13.5px 'Kanit', sans-serif; cursor: pointer; }
.co-rm svg { width: 15px; height: 15px; }
.co-add-att { padding: 10px 0; }
.co-add-list { margin-top: 6px; }
.co-add-list .st-row { background: #fff; border: 1px solid #EFECE5; box-shadow: none; }
.co-add-list .st-right svg { color: var(--green); width: 22px; height: 22px; }

/* ---------- แอปทีมงาน (ครู + แอดมิน): นักเรียนทั้งหมด / รายละเอียด / สิทธิ์ ---------- */
.coach-app.staff-app .app { padding-bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
.st-dash { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 12px 0; }
.st-dash button { border: 0; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); border-radius: 14px; padding: 10px 4px; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: 'Kanit', sans-serif; }
.st-dash b { font-size: 19px; font-weight: 600; line-height: 1.2; }
.st-dash small { font-size: 11.5px; opacity: .85; text-align: center; line-height: 1.25; }
.st-search { border-left: 0; padding: 8px 12px; gap: 10px; }
.st-search svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.st-search .input { border: 0; padding: 8px 0; background: transparent; box-shadow: none; }
.st-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; cursor: pointer; font: inherit; color: var(--text); padding: 12px 14px; margin-bottom: 10px; }
.st-row .av { width: 48px; height: 48px; font-size: 16px; }
.st-row .info, .st-kid-link .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.st-row .ttl, .st-kid-link .ttl { font: 600 17px 'Kanit', sans-serif; color: var(--ink); }
.st-row .ttl small { font: 400 13px 'Sarabun', sans-serif; }
.st-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.st-right svg { width: 18px; height: 18px; color: var(--muted); }
.st-kid-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.st-head { border-left: 0; gap: 10px; }
.st-head .info { flex: 1; min-width: 0; }
.st-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 14px 12px 0; }
.st-stats span { display: flex; flex-direction: column; align-items: center; color: rgba(255, 255, 255, .85); font-size: 12.5px; }
.st-stats b { font: 600 21px 'Kanit', sans-serif; color: #fff; }
.st-h { font-size: 16.5px; margin: 0 0 8px; color: var(--ink); }
.st-h-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.st-h-row .st-h { margin: 0; }
.st-h-row .btn svg { width: 16px; height: 16px; }
.st-kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #EFECE5; font-size: 14.5px; }
.st-kv:last-of-type { border-bottom: 0; }
.st-kv span { color: var(--muted); flex: none; }
.st-kv b { font-weight: 500; text-align: right; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.st-kv .belt { vertical-align: 1px; }
.st-tel { display: inline-flex; align-items: center; gap: 5px; color: var(--blue); text-decoration: none; font-weight: 600; }
.st-tel svg { width: 16px; height: 16px; }
.st-pack.off { opacity: .55; }
.st-pack .icon-btn { width: 36px; height: 36px; background: #F6F4EF; }
.st-pack .icon-btn svg { width: 18px; height: 18px; }
.st-left { font: 600 22px 'Kanit', sans-serif; color: var(--ink); white-space: nowrap; }
.st-left small { font-size: 13px; color: var(--muted); font-weight: 400; }
.st-bk { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 0; border-left: 5px solid var(--c, var(--red)); background: #FAF8F4; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; font: inherit; color: var(--text); }
.st-bk-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.st-bk-top b { font: 500 15px 'Kanit', sans-serif; color: var(--ink); }
.st-bk-note { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 8px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed #E5E0D6; font-size: 14px; }
.st-bk-note > svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--muted); }
.st-bk-note > span:not(.co-note-audio) { flex: 1; min-width: 0; }
.st-bk-note small { flex-basis: 100%; }
.st-bk-note .co-note-audio svg { width: 16px; height: 16px; }
.st-closed { margin: 10px 16px 0; padding: 10px 14px; border-radius: 12px; background: #FDE8EA; color: var(--red); font: 500 15px 'Kanit', sans-serif; text-align: center; }
.st-admin-row { margin: 6px 0 8px; }
.st-admin-row .btn svg { width: 17px; height: 17px; vertical-align: -3px; }
.st-perm { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid #EFECE5; cursor: pointer; font-size: 15.5px; }
.st-perm input { position: absolute; opacity: 0; pointer-events: none; }
.st-perm i { flex: none; width: 50px; height: 30px; border-radius: 99px; background: #D9D5CC; position: relative; transition: .2s; }
.st-perm i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: .2s; }
.st-perm input:checked + i { background: var(--green); }
.st-perm input:checked + i::after { left: 23px; }
.st-perm input:focus-visible + i { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- คอมเมนต์จากครู (ฝั่งผู้ปกครอง) ---------- */
.tnote { margin: 8px 0 2px; padding: 10px 12px; border-radius: 12px; background: #FFF8E1; border-left: 4px solid var(--yellow); }
.tnote.new { background: #FFF1F2; border-left-color: var(--red); }
.tnote-head { display: flex; align-items: center; gap: 6px; font: 500 13.5px 'Kanit', sans-serif; color: var(--ink-3); }
.tnote-head svg { width: 16px; height: 16px; }
.tnote p { margin: 4px 0 0; font-size: 15px; white-space: pre-line; }
.tnote audio { width: 100%; height: 40px; margin-top: 8px; }

/* ---------- สอบสายในการ์ดลูก (หน้าบัญชี) ---------- */
.kid-belt { position: relative; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.kid-belt.ready { }
.kid-belt .stamp { top: 22px; right: 0; width: 84px; height: 84px; }
.kid-belt .stamp b { font-size: 20px; }
.kid-belt .stamp small { font-size: 9.5px; }
.kid-belt .belt-art { margin-right: 92px; }
.kid-belt .belt-path { margin-left: -16px; margin-right: -16px; }
.kb-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kb-title span { display: inline-flex; align-items: center; gap: 6px; font: 600 15px 'Kanit', sans-serif; color: var(--ink); }
.kb-title span svg { width: 18px; height: 18px; color: var(--red); }
.kb-title small { font-size: 12.5px; color: var(--muted); }
.kid-belt:not(.ready) .belt-art { margin-right: 0; }

/* ---------- จองหลายวัน ---------- */
.day-head { align-items: center; gap: 10px; }
.day-head h2 { margin-right: auto; }
.multi-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; padding: 6px 12px; }
.multi-btn svg { width: 16px; height: 16px; }
.multi-btn.on { background: var(--red); border-color: var(--red); color: #fff; }
.multi-hint { margin: -2px 14px 12px; display: flex; gap: 8px; align-items: flex-start; background: #FFF4CF; color: #6B5200; }
.multi-hint svg { width: 17px; height: 17px; flex: none; margin-top: 2px; }
.cal-day .dot.pick { background: var(--yellow); }
.cls.pickable { padding-right: 50px; }
.cls .pick-box { position: absolute; right: 14px; top: 14px; width: 28px; height: 28px; border-radius: 9px; border: 2px solid #CFC9BC; background: #fff; display: grid; place-items: center; color: transparent; z-index: 1; }
.cls .pick-box svg { width: 18px; height: 18px; }
.cls.picked { box-shadow: 0 0 0 2.5px var(--red), var(--shadow); }
.cls.picked .pick-box { background: var(--red); border-color: var(--red); color: #fff; }
.cls.pickable .tag { display: none; }
.cls.unpickable { opacity: .45; }
.mb-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 30; display: flex; justify-content: center; padding: 0 10px 10px; pointer-events: none; }
.mb-in { pointer-events: auto; width: 100%; max-width: 460px; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 18px; background: var(--ink); color: #fff; box-shadow: 0 12px 30px rgba(15, 27, 45, .35); }
.mb-txt { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.mb-txt b { font: 600 16px 'Kanit', sans-serif; }
.mb-txt small { opacity: .7; font-size: 12.5px; }
.mb-in .btn { padding: 11px 14px; }
.mb-in .btn svg { width: 17px; height: 17px; }
body:has(.mb-bar:not([hidden])) .fab { display: none; }
body:has(.mb-bar:not([hidden])) .app { padding-bottom: calc(var(--nav-h) + 110px + env(safe-area-inset-bottom)); }
.chip svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 2px; }
.chip:disabled { opacity: .45; }
.cr { border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.cr.short { border-color: #F3C1C6; background: #FFF8F8; }
.cr-head { display: flex; align-items: center; gap: 8px; }
.cr-head .av { width: 28px; height: 28px; font-size: 11px; }
.cr-head b { font: 600 15.5px 'Kanit', sans-serif; color: var(--ink); }
.cr-line { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 14px; }
.cr-line b { font-family: 'Kanit', sans-serif; color: var(--ink); }
.cr-line small { color: var(--muted); }
.cr-warn { margin-top: 8px; display: flex; align-items: center; gap: 6px; color: var(--red); font-size: 14px; }
.cr-warn svg { width: 16px; height: 16px; flex: none; }
.sum-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #EFECE5; }
.sum-row:last-child { border-bottom: 0; }
.sum-row .bar { align-self: stretch; }
.sum-row .info { flex: 1; min-width: 0; }
.sum-row .ttl { font: 500 15px 'Kanit', sans-serif; color: var(--ink); }
.sum-kids { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.sum-kids .badge svg { width: 12px; height: 12px; }
.sum-row .icon-btn { width: 34px; height: 34px; color: var(--muted); }
.done-head { display: flex; align-items: center; gap: 12px; }
.done-head > svg { width: 46px; height: 46px; padding: 10px; border-radius: 50%; background: var(--green); color: #fff; flex: none; }

/* ---------- โทนพื้นหลังแดง (ตามโลโก้) ---------- */
html, body { background: var(--bg-red); }
.dojo-bg {
  background-color: var(--bg-red);
  background-image:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 26px),
    radial-gradient(circle at 90% 0%, rgba(255, 120, 110, .18), transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(40, 0, 0, .35), transparent 45%);
  background-attachment: fixed;
}
@media (min-width: 520px) {
  body { background-color: #5E0B0E; }
  .app { background: var(--bg-red); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
}
:root { --shadow: 0 6px 20px rgba(40, 0, 0, .22); }
.home-top { background-image: radial-gradient(circle at 96% 0%, rgba(255, 90, 80, .35), transparent 42%), radial-gradient(circle at 0% 120%, rgba(0, 0, 0, .35), transparent 50%); }
.learn-head { background-image: radial-gradient(circle at 92% 10%, rgba(255, 90, 80, .35), transparent 38%), radial-gradient(circle at 8% 110%, rgba(0, 0, 0, .35), transparent 45%); }
.cal { box-shadow: 0 10px 30px rgba(30, 0, 0, .4); }
.cal-day .dot { background: rgba(255, 255, 255, .55); }
.cal-day .dot.mine { background: #FF4D57; box-shadow: 0 0 0 1.5px #fff; }
/* ตัวหนังสือที่วางบนพื้นแดงโดยตรง → ขาว */
.dojo-bg .day-head h2, .dojo-bg .section-title h2, .dojo-bg .co-sum, .dojo-bg .co-sum b { color: #fff; }
.dojo-bg .day-head .muted, .dojo-bg .section > p.muted, .dojo-bg .section > .muted,
.dojo-bg #out > p.muted, .dojo-bg .list > p.muted, .dojo-bg .empty { color: rgba(255, 255, 255, .82); }
.dojo-bg .empty svg { color: rgba(255, 255, 255, .5); }
/* คลาสที่ผ่านไปแล้ว: จางเฉพาะเนื้อหา การ์ดยังขาวทึบ (ไม่ให้พื้นแดงทะลุเป็นชมพู) */
.cls.past { opacity: 1; background: #F1ECEC; }
.cls.past > * { opacity: .55; }
.bn-dots button { background: rgba(255, 255, 255, .35); }
.bn-dots button.on { background: #fff; }

/* ---------- เลือกภาษา (i18n.js) ---------- */
.i18n-wait body { visibility: hidden; }
.lang-btn { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 11px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1.5px solid rgba(255, 255, 255, .3); color: #fff; font: 600 13px 'Kanit', system-ui, sans-serif; letter-spacing: .04em; cursor: pointer; }
.lang-btn svg { width: 17px; height: 17px; }
.home-top .lang-btn { margin-left: auto; }
.lang-float { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; z-index: 2; }
.page-head:has(.lang-float) h1, .page-head:has(.lang-float) > p { padding-right: 78px; }
.lang-menu { position: fixed; inset: 0; z-index: 200; background: rgba(20, 5, 5, .5); display: grid; place-items: center; padding: 20px; }
.lang-box { width: min(320px, 100%); background: #fff; border-radius: 22px; padding: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.lang-title { margin: 2px 6px 10px; font: 600 15px 'Kanit', system-ui, sans-serif; color: var(--ink); }
.lang-box button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 14px; margin: 0 0 6px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; color: var(--text); font: 500 16px system-ui, sans-serif; cursor: pointer; text-align: left; }
.lang-box button small { color: var(--muted); font-size: 12px; letter-spacing: .06em; }
.lang-box button.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.lang-box button.on small { color: rgba(255, 255, 255, .7); }
/* ภาษาอื่นคำยาวกว่าไทย: ให้หัววันขึ้นบรรทัดใหม่ได้ ไม่ดันปุ่มจนล้น */
html:not([lang="th"]) .day-head { flex-wrap: wrap; row-gap: 6px; }

/* ---------- ชำระเงินในแอป: QR / โอน + แนบสลิป ---------- */
.plan-row { align-items: center; }
.plan-buy { display: flex; align-items: center; gap: 10px; flex: none; }
.plan-buy .btn { padding: 6px 14px; }
.pay-amt { display: flex; justify-content: space-between; align-items: baseline; background: #FDF2F3; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.pay-amt span { color: var(--muted); font-size: 14px; }
.pay-amt b { font: 700 24px 'Kanit', sans-serif; color: var(--red); }
.pay-step { display: flex; align-items: center; gap: 8px; font: 500 16px 'Kanit', sans-serif; color: var(--ink); margin: 16px 0 10px; }
.pay-step b { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; flex: none; }
.pay-qr { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px; border: 1.5px solid var(--line); border-radius: 16px; }
.pay-qr img { width: 220px; height: 220px; object-fit: contain; display: block; border-radius: 8px; }
.pay-bank { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: #F6F4EF; }
.pay-acc { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0; }
.pay-acc b { font: 600 21px 'Kanit', sans-serif; color: var(--ink); letter-spacing: .03em; }
.pay-drop { width: 100%; min-height: 110px; border: 2px dashed #D9D2C3; border-radius: 16px; background: #FBFAF6; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; padding: 12px; }
.pay-drop svg { width: 30px; height: 30px; }
.pay-drop.has img { max-height: 260px; max-width: 100%; object-fit: contain; border-radius: 10px; }
.pay-line { display: flex; align-items: center; gap: 10px; border-radius: 12px; padding: 10px 12px; margin: 8px 0 0; font-size: 14px; }
.pay-line b { font-weight: 500; color: var(--ink); }
.pay-wait { background: #FFF4CF; color: #6B4E00; }
.pay-ok { background: #E3F4EC; color: #17603E; }
.pay-no { background: #FDE8EA; color: #A1192A; }

/* ---------- ธีมคริสต์มาส (ลูกค้าขอ 2/12/69) · ถอดออกได้ทั้งก้อน: ลบส่วนนี้ + บรรทัด xmas ใน app.js ---------- */
:root { --xmas-green: #1E7A45; --xmas-gold: #F2C94C; }
/* หิมะตกด้านหลังเนื้อหา (ไม่บังการกด) */
.xmas-snow { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.xmas-snow::before, .xmas-snow::after { content: ''; position: absolute; left: 0; right: 0; top: -100%; height: 200%; background-repeat: repeat;
  background-image: radial-gradient(circle at 20px 30px, #fff 2px, transparent 2.6px), radial-gradient(circle at 110px 90px, rgba(255,255,255,.85) 1.6px, transparent 2.2px),
    radial-gradient(circle at 170px 20px, rgba(255,255,255,.7) 2.4px, transparent 3px), radial-gradient(circle at 60px 150px, rgba(255,255,255,.8) 1.4px, transparent 2px);
  background-size: 200px 200px; animation: xmas-fall 18s linear infinite; opacity: .5; }
.xmas-snow::after { background-size: 280px 280px; animation-duration: 28s; opacity: .32; left: 40px; }
@keyframes xmas-fall { to { transform: translateY(50%); } }
@media (prefers-reduced-motion: reduce) { .xmas-snow::before, .xmas-snow::after { animation: none; } }
.app { z-index: 1; }
/* หมวกซานต้าบนโลโก้ */
.brand { position: relative; }
.brand::before, .auth-hero .logo::before { content: ''; position: absolute; left: -12px; top: -16px; width: 40px; height: 34px; z-index: 2; transform: rotate(-22deg); pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 34'%3E%3Cpath d='M6 26C8 12 18 3 30 6c3 1 6 5 5 9-2-3-5-4-8-3l1 14z' fill='%23D62839'/%3E%3Crect x='2' y='23' width='30' height='9' rx='4.5' fill='%23fff'/%3E%3Ccircle cx='35' cy='15' r='4.5' fill='%23fff'/%3E%3C/svg%3E") no-repeat center/contain; }
.auth-hero .logo { position: relative; }
.auth-hero .logo::before { left: -14px; top: -18px; width: 46px; height: 40px; }
/* หัวหน้า: ไฟประดับ + แถบลายลูกกวาด */
.home-top, .page-head { position: relative; }
.home-top::before, .page-head::before { content: ''; position: absolute; left: 0; right: 0; top: env(safe-area-inset-top); height: 20px; pointer-events: none;
  background:
    radial-gradient(circle at 12px 13px, var(--xmas-gold) 4px, transparent 5px) 0 0/72px 20px repeat-x,
    radial-gradient(circle at 36px 15px, #3FBF73 4px, transparent 5px) 0 0/72px 20px repeat-x,
    radial-gradient(circle at 60px 13px, #fff 4px, transparent 5px) 0 0/72px 20px repeat-x; }
.home-top { padding-top: calc(26px + env(safe-area-inset-top)); }
.page-head { padding-top: calc(32px + env(safe-area-inset-top)); }
.page-head::after { height: 7px; background: repeating-linear-gradient(-45deg, #fff 0 7px, var(--red) 7px 14px, #fff 14px 21px, var(--xmas-green) 21px 28px); }
.auth-belt { background: repeating-linear-gradient(-45deg, #fff 0 10px, var(--red) 10px 20px); box-shadow: 0 -22px 0 -4px var(--xmas-green), 0 22px 0 -4px var(--xmas-gold); }
.auth-hero h1 em { color: var(--xmas-gold); }
/* ปฏิทิน: หิมะเกาะขอบบน */
.cal::before { content: ''; position: absolute; left: 16px; right: 16px; top: -6px; height: 14px; pointer-events: none;
  background: radial-gradient(circle at 9px 8px, #fff 6px, transparent 6.5px) 0 0/15px 14px repeat-x, linear-gradient(#fff, #fff) 0 7px/100% 7px no-repeat; border-radius: 0 0 8px 8px; }
.cal-day.sel .n { box-shadow: 0 0 0 2px var(--xmas-gold); }
/* ปุ่มหลักไล่สีแดงคริสต์มาส · เมนูล่างที่เลือกเป็นเขียวคริสต์มาส */
.btn-primary { background: linear-gradient(180deg, #E0303F, #B81F2D); }
.nav a.on svg { color: var(--xmas-green); }
.dojo-bg .section-title h2::after { content: ' ✦'; color: var(--xmas-gold); font-size: .8em; }

/* ---------- เลือกภาษา (i18n.js) ---------- */
.i18n-wait body { visibility: hidden; }
.lang-btn { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 11px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1.5px solid rgba(255, 255, 255, .3); color: #fff; font: 600 13px 'Kanit', system-ui, sans-serif; letter-spacing: .04em; cursor: pointer; }
.lang-btn svg { width: 17px; height: 17px; }
.home-top .lang-btn { margin-left: auto; }
.lang-float { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; z-index: 2; }
.page-head:has(.lang-float) h1, .page-head:has(.lang-float) > p { padding-right: 78px; }
.lang-menu { position: fixed; inset: 0; z-index: 200; background: rgba(20, 5, 5, .5); display: grid; place-items: center; padding: 20px; }
.lang-box { width: min(320px, 100%); background: #fff; border-radius: 22px; padding: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.lang-title { margin: 2px 6px 10px; font: 600 15px 'Kanit', system-ui, sans-serif; color: var(--ink); }
.lang-box button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 14px; margin: 0 0 6px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; color: var(--text); font: 500 16px system-ui, sans-serif; cursor: pointer; text-align: left; }
.lang-box button small { color: var(--muted); font-size: 12px; letter-spacing: .06em; }
.lang-box button.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.lang-box button.on small { color: rgba(255, 255, 255, .7); }
.lang-name { display: inline-flex; align-items: center; gap: 12px; }
.lang-box .flag { flex: none; width: 30px; height: 20px; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, .14); }
.lang-box button.on .flag { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55); }
.lang-box .flag svg { display: block; width: 100%; height: 100%; }
/* ภาษาอื่นคำยาวกว่าไทย: ให้หัววันขึ้นบรรทัดใหม่ได้ ไม่ดันปุ่มจนล้น */
html:not([lang="th"]) .day-head { flex-wrap: wrap; row-gap: 6px; }
