/* my-tickets.css — กระเป๋าตั๋ว (my-tickets.html). ใช้ภาษาภาพเดียวกับ site-nav (กรมท่า + เส้นทองบาง).
   โครง: หัวหน้า → วิธีใช้ → กิจกรรม → กลุ่มโต๊ะ (details) → แถวที่นั่ง. ไม่มีการ์ดซ้อนการ์ด. */
.mt-body {
  --mt-ink: #0f1b3d;
  --mt-navy: #1d2f6e;
  --mt-navy-deep: #0e1c46;
  --mt-gold: #b8912f;
  --mt-line: #dde3ef;
  --mt-line-soft: #eceff6;
  --mt-muted: #4f5b70;      /* 7.3:1 บน #fff */
  --mt-faint: #6b7588;      /* 4.8:1 บน #fff */
  --mt-bg: #f4f6fa;
  --mt-ok: #0f6b3f;
  --mt-ok-bg: #e5f5ec;
  margin: 0; min-height: 100vh; color: var(--mt-ink); background: var(--mt-bg);
  font-family: 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.mt-body [hidden] { display: none !important; }
.mt-body .nav .wrap, .mt-body .ubar .wrap { max-width: 1180px; }
.mt-wrap { max-width: 1120px; margin: 0 auto; padding: 36px 24px 80px; }

/* ── หัวหน้า ─────────────────────────────────────────────── */
.mt-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; }
.mt-head-copy { max-width: 620px; }
.mt-title { margin: 0; color: var(--mt-navy-deep); font: 800 32px/1.2 'Bai Jamjuree', 'Sarabun', sans-serif; }
.mt-sub { margin: 8px 0 0; color: var(--mt-muted); font-size: 16px; line-height: 1.6; }
.mt-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mt-btn {
  min-height: 44px; padding: 0 18px; border-radius: 10px; display: inline-flex; gap: 8px;
  align-items: center; justify-content: center; border: 1px solid transparent;
  font: 600 15px/1 'Sarabun', sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.mt-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(29,47,110,.2); }
.mt-btn-primary { background: var(--mt-navy); color: #fff; }
.mt-btn-primary:hover { background: var(--mt-navy-deep); }
.mt-btn-ghost { background: #fff; color: var(--mt-navy); border-color: var(--mt-line); }
.mt-btn-ghost:hover { border-color: var(--mt-gold); }
.mt-btn:disabled { opacity: .6; cursor: progress; }
.mt-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }

/* ── วิธีใช้ ─────────────────────────────────────────────── */
.mt-steps {
  list-style: none; margin: 24px 0 28px; padding: 14px 0; display: flex; flex-wrap: wrap; gap: 10px 32px;
  border-top: 1px solid var(--mt-line); border-bottom: 1px solid var(--mt-line);
}
.mt-steps li { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--mt-muted); }
.mt-steps b { color: var(--mt-ink); font-weight: 700; }
.mt-steps svg { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--mt-gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── สถานะหน้า ───────────────────────────────────────────── */
.mt-state {
  min-height: 300px; padding: 48px 24px; text-align: center; display: grid; place-items: center; align-content: center;
  background: #fff; border: 1px solid var(--mt-line); border-radius: 16px;
}
.mt-state h2 { margin: 16px 0 6px; font: 700 22px/1.3 'Bai Jamjuree', 'Sarabun', sans-serif; color: var(--mt-navy-deep); }
.mt-muted { max-width: 480px; margin: 0; color: var(--mt-muted); font-size: 15px; line-height: 1.6; }
.mt-empty-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; background: #eef1f8; color: var(--mt-navy); }
.mt-empty-icon svg { width: 30px; height: 30px; }
.mt-empty-actions { display: flex; justify-content: center; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.mt-skel { display: grid; gap: 12px; }
.mt-skel span { display: block; height: 120px; border-radius: 16px; background: linear-gradient(90deg, #e9edf4 25%, #f3f5f9 50%, #e9edf4 75%); background-size: 200% 100%; animation: mt-shimmer 1.2s linear infinite; }
.mt-skel span:first-child { height: 150px; }
@keyframes mt-shimmer { to { background-position: -200% 0; } }

/* ── กิจกรรม ─────────────────────────────────────────────── */
.mt-list { display: grid; gap: 28px; }
.mt-event { background: #fff; border: 1px solid var(--mt-line); border-radius: 16px; overflow: hidden; }
.mt-event-head { display: flex; gap: 20px; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--mt-line); }
.mt-event-cover {
  flex: none; width: 84px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px;
  background: var(--mt-navy-deep); box-shadow: 0 0 0 1px rgba(15,27,61,.08);
}
.mt-event-cover.is-blank { display: grid; place-items: center; color: #fff; font: 800 22px 'Bai Jamjuree', sans-serif; }
.mt-event-text { flex: 1 1 auto; min-width: 0; }
.mt-event-title { margin: 0; color: var(--mt-navy-deep); font: 800 22px/1.3 'Bai Jamjuree', 'Sarabun', sans-serif; text-wrap: balance; }
.mt-event-meta { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--mt-muted); font-size: 15px; }
.mt-event-meta span { display: inline-flex; align-items: center; gap: 6px; }
.mt-event-meta svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.mt-event-count { margin: 10px 0 0; font-size: 14px; color: var(--mt-muted); }
.mt-event-count strong { color: var(--mt-ink); }
.mt-event-actions { flex: none; display: flex; gap: 8px; }

/* ── กลุ่มโต๊ะ ───────────────────────────────────────────── */
.mt-table + .mt-table { border-top: 1px solid var(--mt-line); }
.mt-table > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 10px 24px; background: #fafbfd;
}
.mt-table > summary::-webkit-details-marker { display: none; }
.mt-table > summary:hover { background: #f3f5fa; }
.mt-table > summary:focus-visible { outline: none; box-shadow: inset 0 0 0 3px rgba(29,47,110,.25); }
.mt-table-name { font: 800 18px/1.2 'Bai Jamjuree', 'Sarabun', sans-serif; color: var(--mt-navy-deep); white-space: nowrap; }
.mt-table-tier { color: var(--mt-muted); font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-table-sum { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--mt-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mt-table-sum.is-done { color: var(--mt-ok); font-weight: 700; }
.mt-chev { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--mt-muted); stroke-width: 2; transition: transform .2s ease; }
.mt-table[open] .mt-chev { transform: rotate(180deg); }

/* ── แถวที่นั่ง ──────────────────────────────────────────── */
.mt-seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.mt-ticket {
  display: flex; gap: 16px; align-items: flex-start; min-width: 0; padding: 16px 24px;
  border-top: 1px solid var(--mt-line-soft);
}
.mt-qr {
  flex: none; width: 96px; height: 96px; display: block; padding: 4px; border-radius: 8px;
  background: #fff; box-shadow: 0 0 0 1px var(--mt-line);
}
.mt-qr:hover { box-shadow: 0 0 0 2px var(--mt-gold); }
.mt-qr:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--mt-navy); }
.mt-qr img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.mt-qr.is-void { background: repeating-linear-gradient(45deg, #f1f2f5 0 6px, #e6e8ee 6px 12px); }
.mt-ticket.st-used .mt-qr img { opacity: .4; }
.mt-tk-body { flex: 1 1 auto; min-width: 0; }
.mt-tk-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-tk-seat { color: var(--mt-navy-deep); font: 800 18px/1.2 'Bai Jamjuree', 'Sarabun', sans-serif; }
.mt-tk-holder { margin: 4px 0 0; color: var(--mt-ink); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-tk-holder.is-empty { color: var(--mt-faint); }
.mt-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid transparent; }
.mt-chip.ok { background: #eef1f8; color: var(--mt-navy); }
.mt-chip.used { background: var(--mt-ok-bg); color: var(--mt-ok); }
.mt-chip.void { background: #fdecec; color: #9f1d15; }
.mt-tk-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.mt-link {
  min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  color: var(--mt-navy); font: 600 14px 'Sarabun', sans-serif; display: inline-flex; align-items: center; gap: 6px;
}
.mt-link:hover { background: #eef1f8; }
.mt-link:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(29,47,110,.25); }
.mt-link svg, .mt-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.mt-tk-editform { margin-top: 10px; display: grid; gap: 8px; max-width: 360px; }
.mt-input {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid #c9d1e1; border-radius: 10px; box-sizing: border-box;
  font: 15px 'Sarabun', sans-serif; color: var(--mt-ink); background: #fff;
}
.mt-input:focus { border-color: var(--mt-navy); box-shadow: 0 0 0 4px rgba(29,47,110,.14); outline: 0; }
.mt-input::placeholder { color: var(--mt-faint); }
[data-save-error] { margin: 0; color: #9f1d15; font-size: 14px; }

@media (max-width: 760px) {
  .mt-wrap { padding: 24px 16px 56px; }
  .mt-title { font-size: 28px; }
  .mt-head-actions { width: 100%; }
  .mt-head-actions .mt-btn { flex: 1 1 0; }
  .mt-steps { flex-direction: column; }
  .mt-event-head { flex-wrap: wrap; padding: 16px; gap: 14px; }
  .mt-event-cover { width: 68px; }
  .mt-event-text { flex-basis: calc(100% - 90px); }
  .mt-event-actions { width: 100%; }
  .mt-event-actions .mt-btn { flex: 1 1 0; }
  .mt-table > summary { padding: 10px 16px; flex-wrap: wrap; gap: 4px 12px; }
  .mt-chev { order: 2; margin-left: auto; }
  .mt-table-sum { order: 3; flex-basis: 100%; margin-left: 0; }
  .mt-seats { grid-template-columns: 1fr; }
  /* มือถือ: QR + ชื่ออยู่บรรทัดบน ปุ่มลงมาเต็มความกว้าง */
  .mt-ticket { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 4px 14px; padding: 14px 16px; }
  .mt-tk-body { display: contents; }
  .mt-qr { width: 76px; height: 76px; grid-row: 1 / span 2; }
  .mt-tk-top { grid-column: 2; align-self: end; }
  .mt-tk-holder { grid-column: 2; align-self: start; margin: 0; }
  .mt-tk-actions, .mt-tk-editform { grid-column: 1 / -1; max-width: none; }
  .mt-tk-actions .mt-btn-primary { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .mt-chev, .mt-btn { transition: none; }
  .mt-skel span { animation: none; }
}
