/*
 * หน้าร้านคอร์สออนไลน์ — หน้าตาแบบ "แผ่นรองตัดสีเขียว"
 *
 * ที่มา: ยกหน้าตามาจากร้านคอสเพลย์รุ่นแรก (~/podeetua.old-cosplay-20261117-072858) เพราะเจ้าของร้านบอกว่าสวยกว่า (18 พ.ย. 2569)
 *        หน้าตาแบบสมุดจดสีน้ำเงินที่ใช้ก่อนหน้านี้ เก็บไว้ที่ ~/podeetua.prev-look-20261118 บนเครื่องบ้าน (ย้อนกลับ = เอาไฟล์ชุดนั้นมาวางทับ)
 *
 * จุดเด่นมีที่เดียว: หัวเว็บเป็นแผ่นรองตัดสีเขียว (เส้นตาราง + เส้นทแยง + ไม้บรรทัดตามขอบ) และสายวัดที่ยืดตอนเปิดหน้า
 * — ภาพเคลื่อนไหวเดียวของหน้า ที่เหลือเรียบ: พื้นขาว ตัวหนังสือเขียวเข้ม ปุ่มหลักสีชมพู เหลืองชอล์กใช้กับเส้นเน้นและป้ายเล็ก
 * ตัวหนังสือ: Chakra Petch (หัวข้อ ตัวเลข ราคา) + IBM Plex Sans Thai (เนื้อความ)
 *
 * ชื่อคลาสทุกตัวในไฟล์นี้ถูกใช้โดย views/index.html, views/order.html, server.js (การ์ด แถบหัวข้อ),
 * public/app.js และ public/order.js — เปลี่ยนชื่อคลาสต้องแก้ทุกที่พร้อมกัน · หน้าแอดมินใช้ admin.css แยก ไม่เกี่ยวกับไฟล์นี้
 */
:root {
  --mat: #1d5a47;
  --mat-deep: #143f32;
  --mat-line: rgba(255, 255, 255, 0.13);
  --mat-major: rgba(255, 255, 255, 0.26);
  --ink: #0d2a22;
  --ink-2: #1b3d33;
  --muted: #4c675e;
  --paper: #ffffff;
  --paper-2: #f1f5f3;
  --line: #d3ddd8;
  --pink: #f2357f;
  --pink-deep: #c81f63;
  --chalk: #f3d94e;
  --chalk-soft: #fff6c9;
  --ok: #157a52;
  --bad: #b3261e;
  --head: 'Chakra Petch', 'IBM Plex Sans Thai', sans-serif;
  --body: 'IBM Plex Sans Thai', system-ui, sans-serif;
  --r-sm: 6px;
  --r-md: 12px;
  --gutter: 16px;
  /* สีประจำหัวข้อ (server.js TOPIC_COLORS: y p m o s l) — ใช้แค่ปกการ์ดที่ไม่มีรูป จุดสีบนแถบหัวข้อ และป้ายหัวข้อในหน้ารายละเอียด */
  --hl-y: #f6e27a;
  --hl-p: #f7b3cf;
  --hl-m: #a9dcc5;
  --hl-o: #f6c793;
  --hl-s: #b2d5f1;
  --hl-l: #cfc2f2;
}
/* --tab = สีอ่อน (จุดบนแถบหัวข้อ ป้ายหัวข้อ) · --tab-deep = สีเข้มของหัวข้อเดียวกัน (เส้นไอคอนบนปกที่ไม่มีรูป) */
.t-y { --tab: var(--hl-y); --tab-deep: #8f7200; }
.t-p { --tab: var(--hl-p); --tab-deep: #c81f63; }
.t-m { --tab: var(--hl-m); --tab-deep: #1d5a47; }
.t-o { --tab: var(--hl-o); --tab-deep: #b0560f; }
.t-s { --tab: var(--hl-s); --tab-deep: #2a64a8; }
.t-l { --tab: var(--hl-l); --tab-deep: #6a4bc4; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.65 var(--body);
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.15; margin: 0; }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--chalk); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
/* คลาส hand มาจากหน้าตารุ่นสมุดจด (ตัวเขียนมือ) — ตอนนี้แค่ให้หัวข้อเป็นแบบเดียวกับหัวข้ออื่น */
.hand { font-family: var(--head); font-weight: 700; color: var(--ink); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 760px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--chalk); padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: var(--r-sm);
  font: 600 1rem/1 var(--head); text-decoration: none; cursor: pointer; white-space: nowrap;
  border: 2px solid transparent;
}
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-pink { background: var(--pink); color: #fff; }               /* ปุ่มหลัก: ซื้อ จ่าย ส่งสลิป */
.btn-pink:not(:disabled):hover { background: var(--pink-deep); }
.btn-ink { background: var(--ink); color: #fff; }                 /* ปุ่มรอง: เปิดออเดอร์ ลิงก์เข้าเรียน */
.btn-ink:not(:disabled):hover { background: var(--ink-2); }
.btn-line { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-line:not(:disabled):hover { background: var(--paper-2); }
.btn-wide { width: 100%; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 0.94rem; }

/* ---------- ช่องกรอก ---------- */
label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; font-weight: 500; font-size: 0.95rem; }
label > input, label > select, label > textarea { flex: 1 1 100%; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.86rem; }
input, select, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper); font-size: 1rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--mat); outline: none; box-shadow: 0 0 0 3px rgba(29, 90, 71, 0.18); }
textarea { resize: vertical; }
.form-err { margin: 0; min-height: 1.3em; color: var(--bad); font-weight: 500; }
.form-err:empty { min-height: 0; }
.row-end { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* ---------- แถบบน ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
/* แถบบนยาวเต็มจอเหมือนร้านรุ่นแรก (ไม่บีบเข้ากล่อง 1120px แบบเนื้อหา) */
.top-in { padding: 10px max(var(--gutter), env(safe-area-inset-left)); display: flex; align-items: center; gap: 16px; }
.brand { font: 700 1.15rem/1 var(--head); color: var(--mat); text-decoration: none; white-space: nowrap; margin-right: auto; }
.top-nav { display: flex; align-items: center; gap: 16px; }
.top-link { color: var(--muted); font-weight: 500; text-decoration: none; }
.top-link:hover { color: var(--ink); }
.cart-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink); border-radius: 999px;
  padding: 6px 14px; font-weight: 600; cursor: pointer;
}
.cart-n {
  min-width: 1.6em; height: 1.6em; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--pink); color: #fff; font: 600 0.8rem/1 var(--head); font-variant-numeric: tabular-nums;
}
@media (max-width: 420px) { .top-nav { gap: 10px; } .top-link { font-size: 0.9rem; } .brand { font-size: 1.05rem; } }

/* ---------- แผ่นรองตัด (หัวเว็บหน้าแรก) ---------- */
.mat {
  position: relative; overflow: hidden;
  background-color: var(--mat);
  background-image:
    linear-gradient(var(--mat-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-major) 1px, transparent 1px),
    linear-gradient(var(--mat-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: 40px 40px, 40px 40px, 40px 40px, 40px 40px;
  color: #fff;
}
.mat::after { /* เส้นทแยง 45° แบบบนแผ่นรองตัดจริง */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, transparent calc(50% - 1px), rgba(255, 255, 255, 0.12) 50%, transparent calc(50% + 1px));
}
.mat-ruler { position: absolute; background: url('/assets/ruler.svg') repeat-x; opacity: 0.85; }
.mat-ruler--top { top: 0; left: 40px; right: 0; height: 34px; background-position: 0 0; }
.mat-ruler--left {
  top: 40px; left: 0; bottom: 0; width: 34px;
  background-image: url('/assets/ruler-v.svg'); background-repeat: repeat-y;
}
.mat-inner {
  position: relative; z-index: 1;
  max-width: 1120px; margin: 0 auto;
  padding: 72px 20px 64px 56px;
}
/* หัวข้อคอร์สยาวกว่าชื่อชุดคอส — ลดขนาดสูงสุดจาก 5.4rem และให้บรรทัดกว้างขึ้นเป็น 15ch */
.mat-title { font-size: clamp(2.3rem, 7.2vw, 4.6rem); font-weight: 700; letter-spacing: -0.01em; max-width: 15ch; }
.mat-lead { max-width: 46ch; margin: 18px 0 0; color: #d9efe6; font-size: 1.05rem; }
.mat-facts { list-style: none; padding: 0; margin: 22px 0 26px; display: grid; gap: 6px; color: #eaf6f1; }
.mat-facts li { padding-left: 22px; position: relative; }
.mat-facts li::before {
  content: ''; position: absolute; left: 0; top: 0.72em; width: 12px; height: 2px; background: var(--chalk);
}
.mat .sell-note { margin-top: 14px; color: #d9efe6; font-size: 0.92rem; }
@media (max-width: 520px) { .mat-inner { padding: 60px 16px 48px 50px; } }

/* สายวัด — ภาพเคลื่อนไหวเดียวของหน้า: ยืดจาก "จ่ายแล้ว" ไปถึง "ได้ไฟล์ทันที" ตอนเปิดหน้า */
.tape { display: flex; align-items: center; gap: 12px; margin-top: 28px; max-width: 520px; }
.tape-label { font: 600 0.9rem/1 var(--head); color: var(--chalk); white-space: nowrap; }
.tape-strip {
  flex: 1; height: 26px; border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, rgba(13, 42, 34, 0.75) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(90deg, rgba(13, 42, 34, 0.9) 0 2px, transparent 2px 40px),
    var(--chalk);
  background-size: 100% 9px, 100% 15px, 100%;
  background-repeat: no-repeat;
  background-position: 0 0, 0 0, 0 0;
  transform-origin: left center;
  animation: tape 1.4s cubic-bezier(.2, .8, .2, 1) 0.3s both;
}
.tape-read {
  font: 600 0.95rem/1 var(--head); white-space: nowrap; color: #fff;
  animation: read 0.4s ease-out 1.6s both;
}
@keyframes tape { from { transform: scaleX(0.04); } to { transform: scaleX(1); } }
@keyframes read { from { opacity: 0; } to { opacity: 1; } }

/* ---------- ชั้นคอร์ส: แถบหัวข้อเป็นเม็ดยา เลือกแล้วเป็นสีเข้ม ---------- */
.shelf { padding-top: 56px; }
.shelf h2 { margin-bottom: 16px; }
.tabs {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter) 4px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper);
  color: var(--ink); font-weight: 500; cursor: pointer;
}
.tab:not(.tab-all)::before { /* จุดสีประจำหัวข้อ = สีปกการ์ดของหัวข้อนั้น */
  content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--tab);
  box-shadow: inset 0 0 0 1px rgba(13, 42, 34, 0.2);
}
.tab-n { font: 600 0.78rem/1 var(--head); color: var(--muted); font-variant-numeric: tabular-nums; }
.tab[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }
.tab[aria-pressed='true'] .tab-n { color: var(--chalk); }
/* app.js ใส่ t-<สี> ให้ .binder ตามแถบที่เลือก — หน้าตานี้ไม่ใช้สีพื้น ปล่อยไว้เผื่ออยากใช้ทีหลัง */
.binder { padding: 22px 0 56px; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 20px; } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { display: flex; }
.card-open {
  all: unset; box-sizing: border-box; position: relative;
  display: flex; flex-direction: column; width: 100%; cursor: pointer; border-radius: var(--r-md);
}
.card-open:focus-visible { outline: 3px solid var(--chalk); outline-offset: 3px; }
.cover {
  position: relative; display: block; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden;
  background: var(--paper-2); border: 1px solid var(--line);
}
.card-open:hover .cover { border-color: var(--mat); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
/*
 * ปกที่ยังไม่มีรูป: พื้นเทาอ่อน + เส้นตารางจาง (เหมือนพื้นหลังรูปสินค้าของร้านรุ่นแรก)
 * ไอคอนชนิดไฟล์ใช้สีเข้มของหัวข้อ (--tab-deep) แทนรูปสินค้าสีสด · ป้ายความยาวมุมขวาล่าง
 */
.cover-blank {
  display: flex; align-items: flex-end; justify-content: flex-end; padding: 8px;
  color: var(--tab-deep, var(--mat));
  background-color: var(--paper-2);
  background-image:
    linear-gradient(rgba(13, 42, 34, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 42, 34, 0.06) 1px, transparent 1px);
  background-size: 16px 16px;
}
.cover-blank .ico { position: absolute; top: 50%; left: 50%; width: 30%; max-width: 64px; translate: -50% -56%; stroke-width: 1.6; }
.cover-len {
  position: relative; font: 600 0.75rem/1 var(--head); color: var(--ink);
  background: var(--paper); padding: 5px 7px; border-radius: 4px; border: 1px solid var(--line);
}
/* มือถือ (การ์ดสองคอลัมน์ ปกเตี้ยราว 90px): ไอคอนเล็กลงและยกขึ้น ไม่ให้ป้ายความยาว/ป้ายตัวอย่างทับ */
@media (max-width: 520px) {
  .cover-blank .ico { width: 24%; translate: -50% -78%; }
  .cover-len { font-size: 0.68rem; padding: 4px 5px; }
  .stamp { font-size: 0.66rem; margin-top: calc(56.25% - 26px); }
}
.ico { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.card-body { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 10px 2px 0; }
.card-name {
  font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub {
  font-size: 0.85rem; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* ลำดับในการ์ดแบบร้านรุ่นแรก: ชื่อ → คำโปรย → ราคา → ป้ายเล็ก (server.js เขียนป้ายก่อนราคา จึงสลับด้วย order) */
.card-meta { order: 4; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.card-meta span {
  font: 500 0.72rem/1 var(--head); padding: 4px 6px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--muted);
}
.card-foot { order: 3; padding-top: 4px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.price { font: 700 1.15rem/1 var(--head); color: var(--ink); font-variant-numeric: tabular-nums; }
.price-was { color: var(--muted); font-size: 0.85rem; }
.soon { font-size: 0.8rem; color: var(--bad); font-weight: 600; }
/*
 * ป้าย "ตัวอย่าง" มุมซ้ายล่างของปก — ป้ายเข้มตัวขาวแบบร้านรุ่นแรก
 * server.js วางป้ายนี้ไว้ท้ายปุ่มการ์ด (ไม่ได้อยู่ในปก) จึงคำนวณตำแหน่งจากความกว้าง:
 * margin-top แบบ % คิดจากความกว้างของการ์ด และปกสูง 56.25% ของความกว้างเสมอ (16:9) → ขอบล่างปก − 30px
 * ถ้าเปลี่ยนสัดส่วนปก ต้องแก้ 56.25% ตรงนี้ด้วย
 */
.stamp {
  position: absolute; left: 8px; top: 0; margin-top: calc(56.25% - 30px);
  font: 600 0.72rem/1 var(--head); background: var(--ink); color: #fff; padding: 4px 6px; border-radius: 3px;
}
.empty { color: var(--muted); padding: 24px 0; }

/* ---------- คอร์สที่ซื้อแล้ว + คำถาม ---------- */
.mine { padding: 48px 0; border-top: 2px dashed var(--line); border-bottom: 2px dashed var(--line); }
.mine h2, .faq h2 { margin-bottom: 8px; }
.sec-lead { color: var(--muted); margin-bottom: 18px; max-width: 64ch; }
.mine-list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; }
.mine-list a {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: baseline; padding: 12px 14px;
  border: 1.5px solid var(--line); border-left: 4px solid var(--mat); border-radius: var(--r-sm); text-decoration: none; color: var(--ink);
}
.mine-list a:hover { border-color: var(--mat); }
.mine-code { font: 700 1rem/1.2 var(--head); color: var(--mat); font-variant-numeric: tabular-nums; }
.mine-names { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-when { color: var(--muted); font-size: 0.86rem; }
.lookup { display: grid; gap: 12px; }
@media (min-width: 640px) { .lookup { grid-template-columns: 1fr 1fr auto; align-items: end; } .lookup .form-err { grid-column: 1 / -1; } }

.faq { padding: 48px 0 64px; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: '+'; font: 700 1.2rem/1 var(--head); color: var(--mat); }
.faq details[open] summary::after { content: '–'; }
.faq summary::-webkit-details-marker { display: none; }
.faq details p { margin: 10px 0 0; color: var(--muted); max-width: 70ch; }

/* ---------- ท้ายเว็บ ---------- */
.foot { background: var(--mat-deep); color: #d9efe6; padding: 32px 0 calc(32px + env(safe-area-inset-bottom)); }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.foot .brand { color: #fff; margin-right: 0; }
.foot-contact { display: flex; flex-wrap: wrap; gap: 14px; margin-right: auto; }
.contact-link { color: #fff; font-weight: 600; text-underline-offset: 3px; }
.foot .muted { color: #a9cbbf; }

/* ---------- หน้าต่างลอย (รายละเอียดคอร์ส · ตะกร้า) ---------- */
.layer { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.layer-bg { position: absolute; inset: 0; background: rgba(13, 42, 34, 0.55); animation: fade 0.18s ease-out; }
@keyframes fade { from { opacity: 0; } }
.x {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 40px; height: 40px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.x:hover { border-color: var(--ink); }
.sheet {
  position: relative; width: 100%; max-width: 780px; max-height: 94dvh; display: flex; flex-direction: column;
  background: var(--paper); border-radius: 18px 18px 0 0; overflow: hidden;
  animation: up 0.24s cubic-bezier(.2, .8, .2, 1);
}
@keyframes up { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (min-width: 800px) {
  .layer { align-items: center; padding: 24px; }
  .sheet { border-radius: 18px; max-height: 90dvh; animation: fade 0.18s ease-out; }
}
.sheet-scroll { overflow-y: auto; overscroll-behavior: contain; }
.sheet-cover .cover { aspect-ratio: 16 / 7; max-height: 36vh; border: 0; border-radius: 0; }
.sheet-cover .cover-blank { aspect-ratio: auto; height: clamp(150px, 24vh, 210px); }
.sheet-cover .cover-blank .ico { max-width: 80px; }
.sheet-cover .cover-len { font-size: 0.95rem; }
.sheet-body { padding: 18px 20px 8px; display: grid; gap: 10px; }
.sheet-kind { color: var(--muted); font-size: 0.9rem; }
.kind-topic {
  display: inline-block; margin-right: 4px; padding: 4px 8px; border-radius: 4px;
  background: var(--tab); color: var(--ink); font: 600 0.8rem/1 var(--head);
}
.sheet-title { font: 700 1.45rem/1.2 var(--head); color: var(--ink); }
.sheet-sub { color: var(--muted); }
.facts { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.facts li { font: 500 0.8rem/1 var(--head); padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }
.sheet-sec { padding-top: 14px; }
.sheet-sec h3 { font: 700 1.05rem/1.3 var(--head); color: var(--ink); margin-bottom: 8px; }
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ticks li { position: relative; padding-left: 28px; }
.ticks li::before {
  content: ''; position: absolute; left: 4px; top: 0.5em; width: 13px; height: 7px;
  border-left: 2.5px solid var(--mat); border-bottom: 2.5px solid var(--mat); rotate: -45deg;
}
.lessons { list-style: none; margin: 0; padding: 0; counter-reset: l; }
.lessons li {
  counter-increment: l; display: grid; grid-template-columns: 2em 1fr auto; gap: 10px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.lessons li::before { content: counter(l); font: 700 0.95rem/1 var(--head); color: var(--mat); text-align: right; }
.lessons .time { color: var(--muted); font: 500 0.82rem/1 var(--head); white-space: nowrap; font-variant-numeric: tabular-nums; }
.desc { white-space: pre-line; max-width: 64ch; color: var(--muted); }
.gets { margin-top: 10px; padding: 14px 16px 16px; background: var(--chalk-soft); border-radius: var(--r-md); }
.gets h3 { margin-bottom: 4px; }
.gets ul { margin: 0; padding-left: 1.2em; display: grid; gap: 2px; }
.gets .not-ready { list-style: none; margin-left: -1.2em; color: var(--bad); font-weight: 500; }
.sheet-buy {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--paper);
}
.sheet-price { margin-right: auto; display: flex; align-items: baseline; gap: 8px; }
.sheet-price .price { font-size: 1.5rem; color: var(--mat); }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-msg { flex-basis: 100%; min-height: 1.4em; font-size: 0.92rem; color: var(--ok); font-weight: 500; }
.sheet-msg:empty { display: none; }
.sheet-msg.err { color: var(--bad); }
@media (max-width: 480px) { .sheet-actions { flex: 1 1 100%; } .sheet-actions .btn { flex: 1; } }

/* ตะกร้า: มือถือเลื่อนขึ้นจากล่าง · จอใหญ่เป็นแผงชิดขวาเต็มความสูง */
.drawer {
  position: relative; width: 100%; max-width: 440px; max-height: 94dvh; display: flex; flex-direction: column;
  background: var(--paper); border-radius: 18px 18px 0 0; animation: up 0.24s cubic-bezier(.2, .8, .2, 1);
}
@media (min-width: 800px) {
  #drawer { justify-content: flex-end; align-items: stretch; padding: 0; }
  .drawer { max-height: none; height: 100dvh; border-radius: 0; animation: slide 0.22s cubic-bezier(.2, .8, .2, 1); }
  @keyframes slide { from { transform: translateX(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
}
.drawer-head { position: relative; padding: 18px 64px 14px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.3rem; }
.drawer-head .x { top: 12px; }
.drawer-body { padding: 16px 20px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 14px; overflow-y: auto; align-content: start; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.line { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line-name { font-weight: 600; line-height: 1.35; }
.line-kind { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.line-price { font: 600 1rem/1 var(--head); font-variant-numeric: tabular-nums; }
.line-x { border: 0; background: none; color: var(--bad); font-size: 1.4rem; width: 36px; height: 36px; border-radius: var(--r-sm); cursor: pointer; }
.line-x:hover { background: #fbe4e2; }
.lines-mini .line { grid-template-columns: 1fr auto; padding: 6px 0; }
.sum {
  display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
  font: 700 1.15rem/1.2 var(--head);
}
.sum:empty { display: none; }
.sum b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- หน้าออเดอร์ (views/order.html + public/order.js) ---------- */
.order-wrap { max-width: 680px; min-height: calc(100dvh - 150px); margin: 0 auto; padding: 28px var(--gutter) 56px; display: grid; gap: 18px; align-content: start; }
.order-loading { color: var(--muted); padding: 40px 0; text-align: center; }
.receipt, .unlock { position: relative; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r-md); }
.unlock { padding: 24px 20px; display: grid; gap: 14px; }
.unlock h1 { font-size: 1.6rem; }
.receipt-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 20px 20px 14px; border-bottom: 1px solid var(--line); }
.receipt-head h1 { font: 700 1.4rem/1.2 var(--head); }
.code { font-family: var(--head); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; color: var(--mat); white-space: nowrap; }
.receipt-for { color: var(--muted); font-size: 0.92rem; }
.stamp-status { /* ป้ายสถานะ — order.js ใส่คลาส paid / gone เพิ่มตามสถานะ */
  flex: none; display: inline-block; margin-top: 2px; padding: 7px 12px; border-radius: 999px;
  font: 600 0.85rem/1 var(--head); background: var(--paper-2); color: var(--ink); white-space: nowrap;
}
.stamp-status.paid { background: #dff3ea; color: var(--ok); }
.stamp-status.gone { background: #fbe4e2; color: var(--bad); }
.receipt-items { list-style: none; margin: 0; padding: 6px 20px; }
.receipt-items li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.receipt-items b { font-family: var(--head); font-variant-numeric: tabular-nums; white-space: nowrap; }
.receipt-total { display: flex; justify-content: space-between; padding: 12px 20px 18px; font: 700 1.15rem/1.2 var(--head); }
.receipt-total b { font-variant-numeric: tabular-nums; }
.receipt > section { padding: 20px; border-top: 2px dashed var(--line); display: grid; gap: 14px; }
.receipt h2 { font-size: 1.45rem; }
#payAmount { color: var(--pink-deep); }
.qr { width: min(260px, 82%); justify-self: center; padding: 10px; border: 2px solid var(--ink); border-radius: var(--r-md); background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.pay-to { text-align: center; color: var(--muted); font-size: 0.92rem; }
.pay-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 4px; }
.pay-steps li::marker { font-family: var(--head); font-weight: 700; color: var(--pink); }
.pay-late { padding: 10px 14px; background: var(--chalk-soft); border-radius: var(--r-sm); }
/* ปุ่มเลือกสลิปเป็นกรอบเส้นประสีเขียว (แบบร้านรุ่นแรก) — ในหน้าเป็น label.slip-pick.btn.btn-line */
.slip-pick.btn {
  justify-self: stretch; min-height: 64px; border: 2px dashed var(--mat); border-radius: var(--r-md);
  color: var(--mat); background: #f3faf6;
}
.slip-pick.btn:hover { background: #e8f5ee; }
.slip-preview { max-height: 260px; width: auto; justify-self: center; border: 1px solid var(--line); border-radius: var(--r-sm); }
.get-item { padding: 14px 16px; border: 1.5px solid var(--line); border-radius: var(--r-md); display: grid; gap: 10px; background: var(--paper); }
.get-item h3 { font: 700 1.1rem/1.3 var(--head); }
.get-kind { color: var(--muted); font-size: 0.88rem; margin-top: -8px; }
.get-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.get-files li { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.file-ext {
  min-width: 44px; padding: 3px 6px; border-radius: 4px; text-align: center;
  font: 700 0.72rem/1.2 var(--head); background: var(--mat); color: #fff; text-transform: uppercase;
}
.file-name { font-weight: 500; overflow-wrap: anywhere; }
.file-meta { grid-column: 2; color: var(--muted); font-size: 0.84rem; }
.get-files .btn { grid-row: 1 / span 2; grid-column: 3; }
.get-links { display: flex; flex-wrap: wrap; gap: 8px; }
.get-note { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px 14px; background: var(--chalk-soft); border-radius: var(--r-sm); }
.get-missing { color: var(--bad); }
.keep { padding: 14px 16px; border: 2px dashed var(--mat); border-radius: var(--r-md); display: grid; gap: 10px; background: #f3faf6; }
.keep input { font-size: 0.86rem; color: var(--muted); }
.closed p { color: var(--muted); }
