/* Component & Interactive Styles for CardDiwa */

/* Hero Section */
.hero-section {
  padding: 5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-title {
  font-size: 3.2rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-sub);
  max-width: 700px;
  margin: 0 auto 2rem;
  font-weight: 300;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  transition: var(--transition-normal);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Steps / Progress Navigation */
.stepper-nav {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 3rem;
}

.stepper-nav::before {
  content: '';
  position: absolute;
  top: 24px;
  left: 40px;
  right: 40px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 1;
}

.stepper-nav-progress {
  position: absolute;
  top: 24px;
  left: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-gold), var(--accent-cyan));
  z-index: 1;
  transition: var(--transition-normal);
  width: 0%;
}

.step-item {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: default;   /* ปกติกดไม่ได้ จะกดได้เฉพาะตอนเปิดโหมดทดสอบ (class is-clickable) */
  width: 100px;
}

.step-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-dark);
  border: 2px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 1.1rem;
  transition: var(--transition-normal);
}

.step-item.active .step-icon {
  border-color: var(--primary-gold);
  background: var(--primary-gold);
  color: #000;
  box-shadow: 0 0 15px var(--gold-glow);
}

.step-item.completed .step-icon {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald);
  color: #fff;
}

.step-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  font-weight: 500;
}

.step-item.active .step-title {
  color: var(--primary-gold);
  font-weight: 600;
}

/* ---------------------------------------------------------------------------
   โหมดทดสอบ — กดหัวข้อขั้นตอนเพื่อข้ามไปมาได้
   class "is-clickable" กับแถบ .dev-step-jump-banner ถูกใส่จาก js/submit.js
   ตอน DEV_STEP_JUMP = true เท่านั้น พอปิดสวิตช์แล้ว style ชุดนี้จะไม่ถูกใช้เอง
--------------------------------------------------------------------------- */
.step-item.is-clickable {
  cursor: pointer;
}

.step-item.is-clickable:hover .step-icon {
  border-color: var(--primary-gold);
  color: var(--primary-gold);
  transform: scale(1.08);
}

.step-item.is-clickable.active:hover .step-icon,
.step-item.is-clickable.completed:hover .step-icon {
  color: #000;
}

.step-item.is-clickable:hover .step-title {
  color: var(--text-main);
}

.step-item.is-clickable:focus-visible {
  outline: 2px solid var(--primary-gold);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.dev-step-jump-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px dashed var(--primary-gold);
  border-radius: var(--radius-md);
  padding: 0.7rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-sub);
}

.dev-step-jump-banner strong {
  color: var(--primary-gold);
}

.dev-step-jump-banner code {
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--text-main);
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.95rem;
  color: var(--text-sub);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.85rem 1.2rem;
  background: rgba(9, 13, 22, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.form-textarea {
  min-height: 96px;
  line-height: 1.6;
  /* ลากขยายได้เฉพาะแนวตั้ง กันลากจนล้นออกนอกฟอร์ม */
  resize: vertical;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary-gold);
  box-shadow: 0 0 10px var(--gold-glow);
  outline: none;
}

.file-drop-area {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: var(--transition-fast);
}

.file-drop-area:hover {
  border-color: var(--primary-gold);
  background: rgba(245, 158, 11, 0.04);
}

.file-drop-area i {
  font-size: 2.5rem;
  color: var(--primary-gold);
  margin-bottom: 0.75rem;
}

/* ช่องอัปโหลดที่บังคับกรอก (ตอนนี้ใช้กับสลิปชำระเงิน)
   .is-missing ถูกเติม/ถอดโดย js/submit.js ตอนกด "ถัดไป" โดยยังไม่แนบไฟล์ */
.file-drop-area.is-missing {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
  animation: slip-shake 0.4s ease;
}

.file-drop-area.is-missing i {
  color: #f87171;
}

@keyframes slip-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

.label-required {
  color: #f87171;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.35rem;
}

.slip-required-hint {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  line-height: 1.5;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.preview-thumb {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  position: relative;
}

.preview-thumb-container {
  position: relative;
}

.btn-remove-thumb {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tracking Timeline Component */
.tracking-card {
  max-width: 850px;
  margin: 0 auto;
}

.tracking-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* เลขพัสดุ / รหัสออเดอร์
   ฟอนต์ Kanit ตัวหนาขนาดเล็ก ตัวเลขจะเบียดจนเส้นชนกันเป็นก้อนเดียว อ่านผิดได้ง่าย
   จึงใช้ Inter (โหลดมาแล้วใน main.css) ที่มีตัวเลขความกว้างเท่ากัน + เว้นระยะเพิ่มเล็กน้อย */
.tracking-code {
  font-family: 'Inter', ui-monospace, 'Segoe UI', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.tracking-timeline {
  position: relative;
  padding-left: 2rem;
}

.tracking-timeline::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 11px;
  bottom: 10px;
  width: 2px;
  background: var(--border-color);
}

.timeline-step {
  position: relative;
  padding-bottom: 2.5rem;
}

.timeline-step:last-child {
  padding-bottom: 0;
}

.timeline-node {
  position: absolute;
  left: -2rem;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-dark);
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.timeline-step.active .timeline-node {
  border-color: var(--primary-gold);
  background: var(--primary-gold);
  color: #000;
  box-shadow: 0 0 12px var(--gold-glow);
}

.timeline-step.completed .timeline-node {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald);
  color: #fff;
}

.timeline-content {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
}

.timeline-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .timeline-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

.timeline-desc {
  font-size: 0.9rem;
  color: var(--text-sub);
}

.media-proof-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.8rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.media-proof-badge:hover {
  background: rgba(6, 182, 212, 0.25);
}

/* Status Badges */
.badge-status {
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.badge-status.pending {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-status.received {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-status.verified {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-status.in-grading {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-status.grading-done {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-status.completed {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ปุ่มแจ้งออเดอร์ผ่าน LINE ในหน้าต่างส่งเกรดสำเร็จ
   จอมือถือแคบพอที่ข้อความจะตัดเป็น 2 บรรทัด (คำท้ายตกไปอยู่บรรทัดล่างเดี่ยว ๆ)
   บังคับบรรทัดเดียวแล้วย่อฟอนต์ลงนิดหน่อยแทน — เฉพาะจอมือถือ เดสก์ท็อปคงเดิม */
@media (max-width: 480px) {
  #successLineBtn {
    white-space: nowrap;
    font-size: 1rem !important;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }
}

/* ==========================================================================
   Admin: หัวตารางออเดอร์ + ปุ่มกรองสถานะ
   ปุ่มถูกวาดจาก js/admin.js (renderStatusFilterBar) และใช้สีเดียวกับ .badge-status
   ของแต่ละขั้นตอน แอดมินจะได้จำสีเดียวกันทั้งปุ่มกรองและป้ายบนการ์ด
   ========================================================================== */
.orders-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.orders-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.status-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 1rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-color);
}

.status-chip {
  cursor: pointer;
  font-family: inherit;
  line-height: 1.3;
  opacity: 0.62;
  transition: var(--transition-fast);
}

.status-chip:hover {
  opacity: 1;
  transform: translateY(-1px);
}

/* ปุ่มที่เลือกอยู่ — ทึบขึ้นและมีขอบเรืองแสง ให้เห็นชัดว่ากำลังกรองอะไรอยู่ */
.status-chip.is-active {
  opacity: 1;
  font-weight: 700;
  box-shadow: 0 0 0 2px currentColor inset, 0 4px 12px rgba(0, 0, 0, 0.28);
}

/* ปุ่ม "ทั้งหมด" ไม่ผูกกับขั้นตอนไหน จึงใช้สีกลาง (ฟ้าอมเขียวของธีมแอดมิน) */
.badge-status.chip-all {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan, #22d3ee);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

/* ตัวเลขจำนวนออเดอร์ท้ายปุ่ม */
.status-chip-count {
  display: inline-block;
  min-width: 1.35rem;
  margin-left: 0.4rem;
  padding: 0 0.32rem;
  border-radius: 50px;
  background: rgba(0, 0, 0, 0.32);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
}

/* --------------------------------------------------------------------------
   ดรอปดาวน์กรองสถานะ (เฉพาะจอมือถือ) — ซ่อนไว้บนจอใหญ่ ใช้แถวปุ่มแทน
   ทำเองไม่ใช้ <select> เพราะป๊อปอัปเนทีฟล้นขอบจอและจัดสไตล์ไม่ได้
   เมนูใช้ left:0/right:0 จึงกว้างเท่ากล่องเป๊ะ ไม่มีทางล้นออกนอกจอ
   -------------------------------------------------------------------------- */
.status-filter-select-wrap {
  display: none;
  position: relative;
  padding-bottom: 1rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-color);
}

.status-filter-select-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

/* จุดสีบอกสถานะ ใช้สีชุดเดียวกับป้าย .badge-status */
.status-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  color: #cbd5e1;
  box-shadow: 0 0 6px currentColor;
}

.status-dot.chip-all      { background: currentColor; color: #f59e0b; }
.status-dot.pending       { background: currentColor; color: #cbd5e1; }
.status-dot.received      { background: currentColor; color: #60a5fa; }
.status-dot.verified      { background: currentColor; color: #c084fc; }
.status-dot.in-grading    { background: currentColor; color: #fbbf24; }
.status-dot.grading-done  { background: currentColor; color: #22d3ee; }
.status-dot.completed     { background: currentColor; color: #34d399; }

/* ---------------------------- ปุ่มเปิดดรอปดาวน์ ---------------------------- */
.status-dropdown-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  background: rgba(9, 13, 22, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.status-dropdown-toggle:hover {
  border-color: var(--accent-cyan);
}

.status-dropdown-current {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dropdown-caret {
  flex: 0 0 auto;
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.18s ease;
}

.status-filter-select-wrap.is-open .status-dropdown-toggle {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}

.status-filter-select-wrap.is-open .status-dropdown-caret {
  transform: rotate(180deg);
}

/* ตัวเลขจำนวนออเดอร์ ใช้ทั้งบนปุ่มและในรายการ */
.status-dropdown-count {
  flex: 0 0 auto;
  min-width: 1.6rem;
  padding: 0.1rem 0.4rem;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-sub);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

/* ------------------------------- ตัวเมนู -------------------------------- */
.status-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% - 0.55rem);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 62vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.35rem;
  background: #0d1520;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.status-filter-select-wrap.is-open .status-dropdown-menu {
  display: block;
}

.status-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.68rem 0.7rem;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.status-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.status-dropdown-item-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ติ๊กถูกโผล่เฉพาะรายการที่เลือกอยู่ แต่กันที่ไว้เสมอ รายการจะได้ไม่ขยับตอนสลับ */
.status-dropdown-check {
  flex: 0 0 auto;
  width: 0.85rem;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  visibility: hidden;
}

.status-dropdown-item.is-active {
  background: rgba(6, 182, 212, 0.1);
  color: var(--text-main);
  font-weight: 600;
}

.status-dropdown-item.is-active .status-dropdown-check {
  visibility: visible;
}

/* จอมือถือ: แถวปุ่มกินที่และเลื่อนหายาก เปลี่ยนเป็นดรอปดาวน์แทน */
@media (max-width: 640px) {
  .status-filter-bar {
    display: none;
  }

  .status-filter-select-wrap {
    display: block;
  }
}

/* Admin Dashboard Table & Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  margin-bottom: 2rem;
}

@media (min-width: 992px) {
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 1.2rem;
  transition: var(--transition-fast);
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

@media (max-width: 1024px) {
  #adminDashboard {
    padding: 0 0.85rem !important;
    margin: 1.2rem auto 3.5rem !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .nav-container {
    padding: 0 0.85rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .brand-logo {
    gap: 0.4rem !important;
  }

  .brand-mark {
    max-width: 135px !important;
    height: auto !important;
  }

  .brand-badge {
    font-size: 0.65rem !important;
    padding: 0.15rem 0.4rem !important;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
    margin-bottom: 0.85rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .stat-card {
    padding: 0.85rem 0.75rem !important;
    gap: 0.5rem !important;
    flex-direction: column !important;
    text-align: left !important;
    align-items: flex-start !important;
    border-radius: var(--radius-sm) !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  .stat-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.1rem !important;
    border-radius: 8px !important;
  }

  .stat-card h2, .stat-card h3 {
    font-size: 1.2rem !important;
    margin-bottom: 0.15rem !important;
    white-space: nowrap !important;
  }

  .stat-card span {
    font-size: 0.72rem !important;
    line-height: 1.35 !important;
    color: var(--text-muted) !important;
    display: block !important;
  }

  .admin-topbar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.85rem !important;
    margin-bottom: 1.2rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .admin-topbar h1 {
    font-size: 1.4rem !important;
    line-height: 1.3 !important;
  }

  .admin-topbar p {
    font-size: 0.82rem !important;
  }

  .admin-search-box {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .admin-chart-row {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .glass-card {
    padding: 1.2rem 1rem !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
}

/* -------------------------------------------------------------------------- */
/*             Universal Responsive Order Cards (Desktop & Mobile)             */
/* -------------------------------------------------------------------------- */

.desktop-only-table {
  display: none !important;
}

.mobile-order-cards {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 1.15rem;
  width: 100%;
  box-sizing: border-box;
}

.mobile-order-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-sizing: border-box;
  transition: var(--transition-fast);
}

.mobile-order-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.035);
}

.mobile-order-header {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  width: 100%;
  box-sizing: border-box;
}

.mobile-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

.mobile-header-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}

.mobile-stage-badge {
  width: 100%;
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.8rem !important;
  padding: 0.4rem 0.75rem !important;
  border-radius: 8px !important;
  box-sizing: border-box;
  cursor: pointer;
  line-height: 1.35;
  /* ใช้ชื่อสถานะแบบสั้น (STAGE_SHORT_LABEL ใน js/admin.js) จึงบังคับให้อยู่บรรทัดเดียวได้
     ถ้าจอแคบมากจนไม่พอจริง ๆ ค่อยตัดท้ายด้วย … แทนการขึ้นบรรทัดใหม่ ชื่อเต็มดูได้จาก tooltip */
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition-fast);
}

.stage-badge-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-stage-badge:hover {
  filter: brightness(1.15);
}

.mobile-order-id-btn {
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.5px;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.mobile-order-id-btn:hover {
  text-decoration: underline;
}

.mobile-order-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.88rem;
}

.mobile-order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.mobile-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.mobile-val {
  color: var(--text-main);
  text-align: right;
  word-break: break-word;
  font-size: 0.88rem;
}

.mobile-order-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-order-actions .btn-secondary,
.mobile-order-actions .btn-primary {
  flex: 1;
  justify-content: center;
  padding: 0.5rem 0.65rem !important;
  font-size: 0.85rem !important;
  height: 38px !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
}

.mobile-order-actions .btn-danger-outline {
  flex: 0 0 38px !important;
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  padding: 0 !important;
  justify-content: center !important;
}

@media (max-width: 640px) {
  .mobile-order-cards {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.9rem 1rem;
  color: var(--text-sub);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  vertical-align: middle;
  white-space: nowrap;
}

.admin-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Modal Window */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem 2rem 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-header {
  position: sticky;
  top: -1.5rem;
  z-index: 50;
  background: rgba(14, 20, 32, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -1.5rem -2rem 1.5rem;
  padding: 1.2rem 2rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-close {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  padding: 0 !important;
  margin: 0 !important;
  transition: all 0.2s ease-in-out;
  flex-shrink: 0;
  line-height: 1 !important;
}

.modal-close i,
.modal-close i.fas,
.modal-close i.fa-xmark {
  font-size: 1.8rem !important;
  width: 1.8rem !important;
  height: 1.8rem !important;
  line-height: 1.8rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: center !important;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.7);
  color: #ef4444;
  transform: scale(1.1);
}

/* Media Viewer */
.media-container {
  text-align: center;
}

.media-container img, .media-container video {
  max-width: 100%;
  max-height: 450px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Responsive Stepper */
@media (max-width: 768px) {
  .stepper-nav {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    gap: 0.25rem;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
  }

  .stepper-nav::before, .stepper-nav-progress {
    display: none;
  }

  .step-item {
    width: auto;
    flex: 1;
    min-width: 55px;
    gap: 0.35rem;
  }

  .step-icon {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }

  .step-title {
    font-size: 0.68rem;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
  }

  .hero-title {
    font-size: 2.2rem;
  }
}

/* ==========================================================================
   Responsive Grid Utilities
   ใช้แทนการเขียน grid-template-columns แบบ inline
   เพื่อให้ยุบเป็นคอลัมน์เดียวได้จริงบนจอเล็ก
   ========================================================================== */
.grid-2,
.grid-3,
.grid-1-2,
.grid-2-1,
.grid-media-qr,
.grid-step-row {
  display: grid;
  gap: 1rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-media-qr { grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: center; }
.grid-step-row { grid-template-columns: 80px 1fr; gap: 1.5rem; align-items: start; }

@media (max-width: 820px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3,
  .grid-1-2,
  .grid-2-1,
  .grid-media-qr,
  .grid-step-row {
    grid-template-columns: 1fr;
  }

  .grid-step-row { gap: 1rem; }
}

/* ทำให้หัวการ์ดติดตามสถานะไม่ล้นบนมือถือ */
.tracking-header-status {
  text-align: right;
}

@media (max-width: 640px) {
  .tracking-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tracking-header-status {
    text-align: left;
    width: 100%;
  }

  .glass-card {
    padding: 1.25rem;
  }

  .modal-content {
    padding: 1rem 1.25rem 1.5rem;
  }

  .modal-header {
    top: -1rem;
    margin: -1rem -1.25rem 1.2rem;
    padding: 0.9rem 1.25rem 0.75rem;
  }
}

/* ==========================================================================
   Admin: Auth Screens
   ========================================================================== */
.auth-screen {
  display: flex;
  min-height: 80vh;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  max-width: 440px;
  width: 100%;
  padding: 2.5rem;
  text-align: center;
}

.auth-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border-width: 2px;
  border-style: solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.2rem;
}

.auth-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  text-align: left;
}

@media (max-width: 480px) {
  .auth-card { padding: 1.75rem 1.25rem; }
}

/* ==========================================================================
   Admin: Dashboard Layout
   ========================================================================== */
#adminDashboard {
  max-width: 1240px;
  margin: 2rem auto 5rem;
  padding: 0 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-search-box {
  position: relative;
  width: 320px;
  max-width: 100%;
}

.admin-search-box i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.admin-search-box .form-input {
  padding-left: 2.6rem;
  font-size: 0.9rem;
}

@media (max-width: 1024px) {
  .admin-search-box { width: 100%; }
}

.admin-chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 2rem;
}

@media (max-width: 900px) {
  .admin-chart-row { grid-template-columns: 1fr; }
}

/* Simple CSS bar chart */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 190px 1fr 90px;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
}

.bar-label {
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 50px;
  transition: width 0.4s ease;
  min-width: 2px;
}

.bar-value {
  text-align: right;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .bar-row {
    grid-template-columns: 1fr 60px;
    grid-template-areas:
      "label value"
      "track track";
    row-gap: 0.35rem;
  }
  .bar-label {
    grid-area: label;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.4;
  }
  .bar-value { grid-area: value; }
  .bar-track { grid-area: track; }
}

/* ==========================================================================
   Admin: Table Actions
   ========================================================================== */
.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.table-actions .btn-xs {
  padding: 0.4rem 0.75rem !important;
  font-size: 0.8rem !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  height: 32px !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
}

.table-actions .btn-danger-outline {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-sm) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #f87171 !important;
}

.table-actions .btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.15) !important;
}

/* ==========================================================================
   Admin: Order Detail Modal
   ========================================================================== */
.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.detail-info-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

/* ช่องที่ข้อความยาว เช่น ที่อยู่จัดส่ง — ให้กินเต็มความกว้างตาราง */
.detail-info-grid > div.is-wide {
  grid-column: 1 / -1;
}

.detail-info-grid span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.detail-info-grid strong {
  font-size: 0.88rem;
  word-break: break-word;
}

/* ที่อยู่ที่ลูกค้ากรอกหลายบรรทัด ให้ขึ้นบรรทัดตามที่พิมพ์มา */
.detail-info-grid > div.is-wide strong {
  white-space: pre-wrap;
  line-height: 1.55;
}

@media (max-width: 700px) {
  .detail-info-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 440px) {
  .detail-info-grid { grid-template-columns: 1fr; }
}

/* กล่องสรุปชื่อ-ที่อยู่ลูกค้าในหน้ารายละเอียดออเดอร์
   ตัวข้อความอยู่ใน <pre class="addr-copy-text"> ปุ่มคัดลอกอ่านจากตรงนั้นโดยตรง */
.addr-copy-card {
  margin-top: 0.9rem;
  border: 1px solid rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.06);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

.addr-copy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.addr-copy-head > span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-emerald, #34d399);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.addr-copy-btn {
  padding: 0.45rem 0.9rem !important;
  font-size: 0.8rem !important;
}

.addr-copy-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ใช้ <pre> เพื่อคงบรรทัดตามที่ลูกค้าพิมพ์มา เวลาคัดลอกจะได้หน้าตาเหมือนที่เห็น */
.addr-copy-text {
  margin: 0;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-user-select: all;
  user-select: all;
}

.addr-copy-warn {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: #f87171;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.detail-section-title {
  margin: 1.5rem 0 0.7rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-thumb-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.detail-thumb {
  width: 84px;
  height: 84px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition-fast);
}

.detail-thumb:hover {
  border-color: var(--primary-gold);
  transform: translateY(-2px);
}

.detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-thumb-video {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--accent-cyan);
  font-size: 1.6rem;
}

.detail-history-item {
  border-left: 2px solid var(--border-glow);
  padding: 0.5rem 0 0.8rem 0.9rem;
  margin-bottom: 0.4rem;
}

.detail-history-item strong {
  display: block;
  font-size: 0.9rem;
}

/* ==========================================================================
   ตารางราคาค่าบริการส่งเกรด
   ========================================================================== */
.price-cards {
  display: grid;
  /* minmax(0, 1fr) = แบ่งความกว้างเท่ากัน 3 ส่วนเสมอ
     ถ้าใช้ 1fr เฉย ๆ การ์ดจะยืดตามความยาวตัวเลข พอราคาเปลี่ยนขนาดการ์ดจะไม่เท่ากัน */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 700px) {
  .price-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

.price-card {
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.3rem 0.8rem 1rem;
  text-align: center;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.price-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.price-card.featured {
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.03) 100%);
  border-color: var(--border-glow);
}

.price-card-tag {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-gold);
  color: #1a1205;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  white-space: nowrap;
}

.price-card-qty {
  display: block;
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 0.3rem;
}

.price-card-amount {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-main);
  /* ห้ามตัดบรรทัด — ถ้ายาวเกินการ์ด js/submit.js จะย่อขนาดตัวอักษรให้เอง */
  white-space: nowrap;
}

.price-card.featured .price-card-amount {
  color: var(--primary-gold);
}

.price-card-amount small {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

.price-card-note {
  margin-top: auto;
  font-size: 0.76rem;
  color: var(--text-muted);
  padding-top: 0.6rem;
  line-height: 1.3;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   การ์ดราคาแบบกดเลือกได้ (ใช้ในฟอร์มส่งเกรด ขั้นตอนที่ 1)
   การ์ดที่เลือกอยู่ = ขอบ/พื้นสีส้ม + ติ๊กถูกมุมบนซ้าย
   การ์ดที่มี class "has-stepper" จะมีปุ่ม + - อยู่ริมขวาไว้เพิ่มจำนวน
   -------------------------------------------------------------------------- */
.price-card.is-selectable {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.price-card.is-selectable:focus-visible {
  outline: 2px solid var(--primary-gold);
  outline-offset: 2px;
}

/* เว้นที่ริมขวาให้ปุ่ม + - ส่วนฝั่งซ้ายเว้นพอประมาณ
   ตัวเลขจะเยื้องซ้ายเล็กน้อยโดยตั้งใจ เพื่อให้สมดุลกับปุ่ม + - ที่อยู่ริมขวา */
.price-card.has-stepper {
  padding-left: 1.4rem;
  padding-right: 3.3rem;
}

.price-card.is-selected {
  border-color: var(--primary-gold);
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.18) 0%, rgba(245, 158, 11, 0.05) 100%);
  box-shadow: 0 0 0 1px var(--primary-gold), 0 8px 22px rgba(245, 158, 11, 0.14);
}

.price-card.is-selected .price-card-amount,
.price-card.is-selected .price-card-qty {
  color: var(--primary-gold);
}

/* ติ๊กถูกบอกว่าการ์ดนี้ถูกเลือกอยู่ */
.price-card-check {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-gold);
  color: #1a1205;
  font-size: 0.62rem;
  opacity: 0;
  transform: scale(0.5);
  transition: var(--transition-fast);
  pointer-events: none;
}

.price-card.is-selected .price-card-check {
  opacity: 1;
  transform: scale(1);
}

/* ปุ่มเพิ่ม/ลดจำนวนริมขวาของการ์ด */
.price-card-stepper {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.price-card-stepper .qty-btn {
  width: 28px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.07);
  border: none;
  border-radius: 6px;
  color: var(--text-main);
  font-size: 0.7rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.price-card-stepper .qty-btn:hover:not(:disabled) {
  background: var(--primary-gold);
  color: #1a1205;
}

.price-card-stepper .qty-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.price-card-stepper .qty-value {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.15rem 0;
  color: var(--text-main);
}

.price-card.is-selected .price-card-stepper .qty-value {
  color: var(--primary-gold);
}

/* ปุ่ม "จำนวนอื่น — สอบถามราคากับทางร้าน" ใต้การ์ดราคา */
.pkg-custom-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin: 0.8rem 0 1.5rem;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-sub);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.pkg-custom-option:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-main);
}

.pkg-custom-option.is-selected {
  border-style: solid;
  border-color: var(--primary-gold);
  background: rgba(245, 158, 11, 0.12);
  color: var(--primary-gold);
}

/* ==========================================================================
   ขั้นตอนที่ 4 — กล่องที่อยู่ส่งพัสดุถึงร้าน และกล่องรหัสออเดอร์
   สองกล่องนี้คือสิ่งที่ลูกค้าต้องเห็นชัดที่สุดในหน้า จึงทำให้เด่นกว่ากล่องอื่น
   ========================================================================== */
.ship-to-card {
  position: relative;
  margin: 0.9rem 0 1.6rem;
  padding: 1.6rem 1.4rem 1.3rem;
  border: 2px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  background:
    linear-gradient(150deg, rgba(6, 182, 212, 0.16) 0%, rgba(6, 182, 212, 0.05) 55%, rgba(9, 13, 22, 0.5) 100%);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.09), 0 14px 34px rgba(0, 0, 0, 0.35);
}

/* ป้ายคาดมุมบนซ้าย บอกว่ากล่องนี้คือที่อยู่ปลายทาง */
.ship-to-badge {
  position: absolute;
  top: -14px;
  left: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.85rem;
  border-radius: 50px;
  background: var(--accent-cyan);
  color: #04222a;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
}

.ship-to-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ship-to-row {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  align-items: start;
  gap: 0.55rem;
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--text-main);
}

.ship-to-row i {
  margin-top: 0.35rem;
  color: var(--accent-cyan);
  font-size: 0.95rem;
  text-align: center;
}

.ship-to-row strong {
  font-weight: 700;
}

.ship-to-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(6, 182, 212, 0.3);
}

/* ปุ่มคัดลอกใช้สีฟ้าให้เข้ากับกล่อง จะได้ไม่ไปแย่งสายตากับปุ่มสีทอง 'ขั้นตอนต่อไป' */
.ship-to-actions .btn-primary {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #04222a;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

.ship-to-hint {
  flex: 1;
  min-width: 220px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-sub);
}

.ship-to-hint i {
  color: var(--primary-gold);
}

/* กล่องรหัสออเดอร์ */
.order-id-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 1.1rem 1.3rem;
  border: 2px solid var(--primary-gold);
  border-radius: var(--radius-md);
  background: linear-gradient(150deg, rgba(245, 158, 11, 0.14) 0%, rgba(9, 13, 22, 0.55) 100%);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.08);
}

.order-id-main {
  flex: 1;
  min-width: 200px;
}

.order-id-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.order-id-value {
  display: block;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: 2px;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .order-id-value { font-size: 1.6rem; }
  .ship-to-row { font-size: 0.96rem; }
}

/* กล่องสรุปค่าบริการในฟอร์ม */
.fee-summary {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  margin-top: 1rem;
}

.fee-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.fee-breakdown {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.fee-breakdown:empty {
  display: none;
}

.fee-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-sub);
}

.fee-breakdown-row strong {
  color: var(--text-main);
  white-space: nowrap;
}

.fee-bonus-hint {
  margin-top: 0.9rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
}

.fee-note {
  margin-top: 0.9rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   แถบโลโก้สถาบันเกรดที่รับส่ง
   วางไฟล์โลโก้ที่ images/logo-card/ แล้วจะขึ้นเอง
   ถ้ายังไม่มีไฟล์ จะแสดงเป็นชื่อสถาบันแบบตัวอักษรแทน (ดู onerror ใน HTML)
   ========================================================================== */
.grader-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
}

.grader-logo {
  position: relative;   /* ให้ป้าย "เร็ว ๆ นี้" เกาะมุมกล่องได้ */
  background: #fff;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.4rem;
  min-width: 132px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.grader-logo:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(245, 158, 11, 0.22);
}

.grader-logo img {
  max-height: 44px;
  max-width: 132px;
  width: auto;
  height: auto;
  display: block;
}

/* ---------------------------------------------------------------------------
   ค่ายที่ยังไม่เปิดให้บริการ (class "is-soon")
   ทำให้ดูจางเหมือนปิดปรับปรุง แต่ยังเห็นว่าเป็นค่ายอะไร
   พอเปิดใช้จริงให้ลบ class "is-soon" กับ <span class="grader-soon-badge"> ของค่ายนั้นออก
--------------------------------------------------------------------------- */
.grader-logo.is-soon {
  background: #e2e6ec;                          /* ขาวหม่นลง ไม่ให้เด่นเท่าค่ายที่เปิดจริง */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  cursor: not-allowed;
}

.grader-logo.is-soon img,
.grader-logo.is-soon .grader-logo-text {
  filter: grayscale(1);
  opacity: 0.4;
}

/* ค่ายที่ยังไม่เปิด ไม่ต้องมีเอฟเฟกต์ลอยตอน hover จะได้ไม่ชวนให้คิดว่ากดได้ */
.grader-logo.is-soon:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.grader-soon-badge {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  color: var(--primary-gold);
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.3px;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

/* โลโก้ทรงจัตุรัส (เช่น BGS) ต้องสูงกว่าเพื่อให้ดูใหญ่พอๆ กับโลโก้แนวนอน */
.grader-logo.is-square img {
  max-height: 60px;
}

/* ข้อความสำรองตอนที่ยังไม่มีไฟล์โลโก้ */
.grader-logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #0f172a;
}

.grader-caption {
  display: block;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ==========================================================================
   แกลเลอรีผลงานการส่งเกรด (หน้าแรก)
   รูปอยู่ในโฟลเดอร์ images/card/ — รายชื่อไฟล์อยู่ใน js/gallery.js
   ========================================================================== */
.works-grid {
  display: grid;
  /* ล็อกไว้แถวละ 4 รูปเสมอบนจอปกติ */
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
}

/* แท็บเล็ต — ยังคงแถวละ 4 แต่บีบระยะห่างลง */
@media (max-width: 992px) {
  .works-grid {
    gap: 0.9rem;
  }
}

/* มือถือ — 4 รูปจะเล็กเกินไป ลดเหลือแถวละ 2 */
@media (max-width: 576px) {
  .works-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

.work-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: 0;
  display: block;
  width: 100%;
  text-align: left;
  transition: var(--transition-fast);
}

.work-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), 0 0 20px rgba(245, 158, 11, 0.12);
}

.work-thumb {
  position: relative;
  /* ต้องตรงกับสัดส่วนไฟล์รูปใน images/card/ (0.69) — ไฟล์ทุกใบถูกตัดขอบว่าง
     แล้วเติมขอบใหม่ให้สแลบสูงเต็มกรอบและอยู่กึ่งกลางเท่ากันหมด
     สัดส่วนตรงกันทำให้สแลบทุกใบขึ้นขนาดเท่ากันและตรงช่องพอดี */
  aspect-ratio: 69 / 100;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.work-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.work-card:hover .work-thumb img {
  transform: scale(1.05);
}

.work-grade {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  border-radius: 50px;
  background: rgba(9, 13, 22, 0.82);
  border: 1px solid var(--border-glow);
  color: var(--primary-gold);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  backdrop-filter: blur(6px);
}

.work-caption {
  padding: 0.7rem 0.85rem;
  border-top: 1px solid var(--border-color);
}

.work-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.work-note {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.work-zoom-hint {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(9, 13, 22, 0.75);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  opacity: 0;
  transition: var(--transition-fast);
}

.work-card:hover .work-zoom-hint {
  opacity: 1;
}

/* ---- ตัวดูรูปขนาดเต็ม ---- */
.lightbox-figure {
  text-align: center;
  position: relative;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: 72vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.lightbox-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.lightbox-nav button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-family: var(--font-family);
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.lightbox-nav button:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--border-glow);
  color: var(--primary-gold);
}

.lightbox-nav button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
/* iPad / Tablet Layout for Grader Strip (5 logos in 1 row) */
@media (max-width: 992px) and (min-width: 577px) {
  .grader-strip {
    gap: 0.75rem;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  .grader-logo {
    flex: 1;
    min-width: 0;
    min-height: 66px;
    padding: 0.75rem 0.8rem;
  }

  .grader-logo img {
    max-height: 38px;
    max-width: 100%;
  }

  .grader-logo.is-square img {
    max-height: 50px;
  }
}

@media (max-width: 576px) {
  .grader-strip {
    /* row-gap เผื่อไว้ให้ป้าย "เร็ว ๆ นี้" ที่ล้นขึ้นไปด้านบน ไม่ไปทับกล่องแถวก่อนหน้า */
    row-gap: 1.4rem;
    column-gap: 0.7rem;
  }

  .grader-logo {
    min-width: 104px;
    min-height: 62px;
    padding: 0.7rem 1rem;
  }

  .grader-logo img {
    max-height: 32px;
    max-width: 96px;
  }

  .grader-logo.is-square img {
    max-height: 44px;
  }

  .grader-logo-text {
    font-size: 1.1rem;
  }
}

/* Page Title Responsive Sizing */
.page-title {
  font-size: 2.2rem;
  white-space: nowrap;
}

@media (max-width: 576px) {
  .page-title {
    font-size: 1.5rem !important;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .page-title {
    font-size: 1.3rem !important;
    white-space: nowrap;
  }
}

/* Subtitle Responsive Nowrap */
@media (max-width: 576px) {
  .sub-title-nowrap {
    font-size: 0.82rem !important;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .sub-title-nowrap {
    font-size: 0.75rem !important;
    white-space: nowrap;
  }
}

/* Prep Tips Grid in steps/index.html */
.prep-tips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.prep-tips-grid > div:last-child {
  grid-column: span 2;
  justify-self: center;
  width: 100%;
  max-width: 480px;
}

@media (min-width: 1024px) {
  .prep-tips-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .prep-tips-grid > div:last-child {
    grid-column: span 1;
    max-width: 100%;
  }
}

@media (max-width: 576px) {
  .prep-tips-grid {
    grid-template-columns: 1fr;
  }

  .prep-tips-grid > div:last-child {
    grid-column: span 1;
    max-width: 100%;
  }
}


/* ==========================================================================
   ปุ่มติดต่อลอย (LINE / Facebook) มุมขวาล่าง — แสดงทุกหน้า
   มาร์กอัปถูกสร้างจาก js/floating-contact.js ไฟล์เดียว แก้ลิงก์ที่นั่นที่เดียวพอ

   z-index 900 ตั้งใจให้ต่ำกว่าเมนูมือถือ (999) และ modal (2000)
   เวลากางเมนูหรือเปิด popup ปุ่มจะถูกบังเอง ไม่ต้องเขียน JS ซ่อน
   ========================================================================== */
.floating-contact {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-end;   /* ขอบขวาปุ่มตรงกันเสมอ พอกางป้ายจะยืดไปทางซ้าย */
  gap: 0.7rem;
}

.fc-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 54px;
  padding: 0 15px;
  border-radius: 27px;
  color: #fff;
  text-decoration: none;
  font-size: 1.4rem;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.fc-btn i {
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* ป้ายข้อความอยู่ก่อนไอคอนใน DOM ปุ่มจะได้กางออกไปทางซ้าย ไม่ดันขอบขวา */
.fc-label {
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.fc-btn:hover .fc-label,
.fc-btn:focus-visible .fc-label,
.floating-contact.is-teasing .fc-label {
  max-width: 170px;
  opacity: 1;
  margin-right: 0.6rem;
}

.fc-btn:hover,
.fc-btn:focus-visible {
  transform: translateY(-2px);
}

.fc-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.fc-btn-line {
  background: #06C755;
  box-shadow: 0 6px 18px rgba(6, 199, 85, 0.45);
}

.fc-btn-line:hover,
.fc-btn-line:focus-visible {
  background: #05b34c;
  box-shadow: 0 10px 24px rgba(6, 199, 85, 0.6);
}

.fc-btn-fb {
  background: #1877F2;
  box-shadow: 0 6px 18px rgba(24, 119, 242, 0.4);
}

.fc-btn-fb:hover,
.fc-btn-fb:focus-visible {
  background: #1265d4;
  box-shadow: 0 10px 24px rgba(24, 119, 242, 0.6);
}

/* วงแหวนกระเพื่อมรอบปุ่ม LINE — ช่องทางหลัก อยากให้สะดุดตาที่สุด
   pointer-events: none กันไม่ให้วงแหวนไปบังการคลิกปุ่ม */
.fc-btn-line::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid #06C755;
  pointer-events: none;
  animation: fcPulse 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes fcPulse {
  0%   { transform: scale(1);    opacity: 0.75; }
  70%  { transform: scale(1.28); opacity: 0; }
  100% { transform: scale(1.28); opacity: 0; }
}

/* ตอนโผล่ครั้งแรก ลอยขึ้นมาจากด้านล่างเบา ๆ */
.floating-contact .fc-btn {
  animation: fcRise 0.45s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.floating-contact .fc-btn:nth-child(1) { animation-delay: 0.15s; }
.floating-contact .fc-btn:nth-child(2) { animation-delay: 0.28s; }

@keyframes fcRise {
  from { opacity: 0; transform: translateY(14px) scale(0.85); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
  .floating-contact {
    right: 0.9rem;
    bottom: 0.9rem;
    gap: 0.6rem;
  }

  .fc-btn {
    height: 50px;
    padding: 0 13px;
    font-size: 1.3rem;
  }

  /* จอเล็กไม่มี hover อยู่แล้ว โชว์เฉพาะไอคอนกลม ๆ จะได้ไม่กินพื้นที่อ่านเนื้อหา */
  .fc-label {
    display: none;
  }
}

/* เคารพการตั้งค่าระบบของผู้ใช้ที่ขอลดการเคลื่อนไหว */
@media (prefers-reduced-motion: reduce) {
  .fc-btn-line::after,
  .floating-contact .fc-btn {
    animation: none;
  }

  .fc-btn,
  .fc-label {
    transition: none;
  }
}


/* ==========================================================================
   ส่วนการรับประกัน (หน้า steps/ — anchor #warranty)
   แถบสีซ้ายมือบอกประเภทของข้อ: เขียว = ร้านรับประกัน, ทอง = หน้าที่ลูกค้า,
   แดง = ไม่อยู่ในความคุ้มครอง ลูกค้าจะได้กวาดตาแล้วรู้ทันทีว่าข้อไหนสำคัญกับตัวเอง
   ========================================================================== */
.warranty-block {
  margin-bottom: 4rem;
  scroll-margin-top: 80px;   /* กันหัวข้อโดน navbar บังตอนกดลิงก์ #warranty */
}

.warranty-heading {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.warranty-heading i {
  color: var(--primary-gold);
}

.warranty-intro {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* กล่องเตือนก่อนส่งพัสดุ — เรื่องที่ลูกค้าต้องทำ "ก่อน" ถึงจะเคลมได้ จึงดันขึ้นมาไว้บนสุด */
.warranty-notice {
  display: flex;
  gap: 1rem;
  background: rgba(6, 182, 212, 0.07);
  border: 1px solid rgba(6, 182, 212, 0.28);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.3rem;
  margin-bottom: 2rem;
}

.warranty-notice > i {
  font-size: 1.6rem;
  color: var(--accent-cyan);
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.warranty-notice strong {
  display: block;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.warranty-notice p {
  color: var(--text-sub);
  font-size: 0.9rem;
  line-height: 1.65;
}

.warranty-notice-sub {
  margin-top: 0.6rem;
  color: var(--accent-emerald) !important;
  font-size: 0.85rem !important;
}

.warranty-subheading {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.warranty-subheading i {
  color: var(--primary-gold);
  font-size: 0.95rem;
}

.warranty-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  counter-reset: warranty;
}

.warranty-item {
  position: relative;
  counter-increment: warranty;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem 1rem 3.1rem;
}

/* เลขข้อวาดด้วย counter แทนการพิมพ์มือ เพิ่ม/ลบข้อแล้วเลขไล่ใหม่เองไม่มีทางเพี้ยน */
.warranty-item::before {
  content: counter(warranty);
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.warranty-item h4 {
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.warranty-item p {
  color: var(--text-sub);
  font-size: 0.9rem;
  line-height: 1.65;
}

.warranty-item.is-covered {
  border-left-color: var(--accent-emerald);
}

.warranty-item.is-covered::before {
  background: rgba(16, 185, 129, 0.18);
  color: var(--accent-emerald);
}

.warranty-item.is-duty {
  border-left-color: var(--primary-gold);
}

.warranty-item.is-duty::before {
  background: rgba(245, 158, 11, 0.18);
  color: var(--primary-gold);
}

.warranty-item.is-excluded {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.warranty-item.is-excluded::before {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

/* ลำดับการแพ็คการ์ดของลูกค้า (ข้อย่อยในข้อ 3) */
.warranty-substeps {
  list-style: none;
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  counter-reset: substep;
}

.warranty-substeps li {
  counter-increment: substep;
  position: relative;
  padding-left: 2rem;
  font-size: 0.87rem;
  color: var(--text-sub);
  line-height: 1.55;
}

.warranty-substeps li::before {
  content: "3." counter(substep);
  position: absolute;
  left: 0;
  top: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-gold);
}

@media (max-width: 640px) {
  .warranty-notice {
    flex-direction: column;
    gap: 0.7rem;
    padding: 1rem;
  }

  .warranty-item {
    padding: 0.9rem 1rem 0.9rem 2.9rem;
  }

  .warranty-substeps {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   กล่องชำระเงินในฟอร์มส่งเกรด (ขั้นตอนที่ 3)
   รูป QR ของธนาคารมีพื้นหลังสว่างมาในตัวอยู่แล้ว จึงไม่ต้องครอบกล่องขาวซ้อนอีกชั้น
   ========================================================================== */
.pay-block {
  margin-bottom: 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 1.2rem;
  border-radius: var(--radius-md);
  align-items: start;
}

.pay-qr-link {
  display: block;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  line-height: 0;
  transition: var(--transition-fast);
}

.pay-qr-link img {
  width: 100%;
  height: auto;
  display: block;
}

.pay-qr-link:hover,
.pay-qr-link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.pay-qr-link:focus-visible {
  outline: 2px solid var(--primary-gold);
  outline-offset: 2px;
}

/* ป้ายบอกว่ากดขยายได้ ทับไว้ที่ขอบล่างของรูป จะได้ไม่กินความสูงเพิ่ม */
.pay-qr-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.45rem 0.5rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.3;
  text-align: center;
}

.pay-account-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pay-bank {
  font-size: 1.1rem;
  color: var(--primary-gold);
  margin: 0.2rem 0 0.6rem;
}

.pay-acc-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.pay-acc-number {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.pay-copy-btn {
  padding: 0.35rem 0.8rem !important;
  font-size: 0.8rem !important;
}

.pay-acc-name {
  font-size: 0.9rem;
  color: var(--text-sub);
  margin-top: 0.5rem;
}

.pay-acc-name strong {
  color: var(--text-main);
}

.pay-total {
  margin-top: 1rem;
  font-size: 1.1rem;
}

@media (max-width: 640px) {
  /* จอเล็กรูป QR เต็มความกว้างจะใหญ่เกินไป บีบให้พออ่าน/สแกนได้แล้วจัดกลางไว้ */
  .pay-qr-link {
    max-width: 260px;
    margin: 0 auto;
  }

  .pay-acc-number {
    font-size: 1.25rem;
  }
}


/* ==========================================================================
   การ์ด LINE ในหน้าติดต่อ — วาง QR ไว้ซ้าย ข้อความอยู่ขวา
   ========================================================================== */
.line-contact-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  border-color: rgba(6, 199, 85, 0.3);
  background: rgba(6, 199, 85, 0.05);
}

.line-qr-link {
  display: block;
  flex-shrink: 0;
  /* QR ตัวนี้โมดูลค่อนข้างถี่ ถ้าย่อเล็กกว่านี้กล้องมือถือจะจับยาก */
  width: 150px;
  background: #fff;
  padding: 8px;
  border-radius: 12px;
  line-height: 0;
  transition: var(--transition-fast);
}

.line-qr-link img {
  width: 100%;
  height: auto;
  display: block;
}

.line-qr-link:hover,
.line-qr-link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(6, 199, 85, 0.35);
}

.line-qr-link:focus-visible {
  outline: 2px solid #06C755;
  outline-offset: 3px;
}

@media (max-width: 640px) {
  /* มือถือสแกน QR ตัวเองไม่ได้ วาง QR ไว้บนแล้วให้กดปุ่มเขียวแทน */
  .line-contact-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .line-qr-link {
    width: 150px;
    align-self: center;
  }
}


/* ==========================================================================
   หน้าแจ้งข้อผิดพลาด 404 / 500 (ไฟล์อยู่ที่ราก /404.html และ /500.html)
   ========================================================================== */
.error-page {
  max-width: 640px;
  margin: 5rem auto;
  padding: 0 1.5rem;
  text-align: center;
}

.error-code {
  display: block;
  font-size: 6rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 500 = ปัญหาฝั่งเซิร์ฟเวอร์ ใช้โทนแดงให้ต่างจาก 404 ที่แค่หาหน้าไม่เจอ */
.error-code.is-500 {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.error-title {
  font-size: 1.6rem;
  margin: 0.6rem 0 0.8rem;
  color: var(--text-main);
}

.error-text {
  color: var(--text-sub);
  line-height: 1.8;
  margin-bottom: 2rem;
}

.error-actions {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.error-help {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.8;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.error-help a {
  color: var(--primary-gold);
}

@media (max-width: 640px) {
  .error-page { margin: 3rem auto; }
  .error-code { font-size: 4.5rem; }
  .error-title { font-size: 1.3rem; }
}

/* ==========================================================================
   แถบเมนูหน้าแอดมิน — ปุ่ม "เปลี่ยนรหัส" กับ "ออกจากระบบ"

   ปัญหาเดิม: ปุ่มทั้งสองตั้ง white-space:nowrap ไว้ พอจอแคบจึงยืดออกจนดัน
   ตัวเองทะลุขอบขวาของจอ เพราะไม่มีอะไรบอกว่าใครควรหดก่อน

   วิธีแก้: ล็อกไม่ให้กล่องปุ่มถูกบีบ (flex-shrink:0) แล้วให้โลโก้เป็นฝ่ายหดแทน
   ถ้าแคบกว่านั้นอีกก็ทยอยซ่อนข้อความในปุ่มทีละตัว เหลือแต่ไอคอน
   ========================================================================== */
.admin-nav-cta {
  gap: 0.5rem;
  flex-shrink: 0;          /* ปุ่มต้องไม่ถูกบีบ ไม่งั้นข้อความ nowrap จะดันตกขอบจอ */
}

.admin-nav-btn {
  font-size: 0.82rem;
  padding: 0.4rem 0.75rem;
  gap: 0.4rem;
  white-space: nowrap;
}

.admin-nav-btn-danger {
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.admin-nav-btn-danger:hover {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.1);
}

/* โลโก้ยอมหดก่อนเสมอ
   ต้องใส่ min-width:0 ด้วย เพราะ flex item ไม่ยอมย่อต่ำกว่าขนาดจริงของรูปถ้าไม่บอก */
.admin-navbar .brand-logo {
  min-width: 0;
  overflow: hidden;
}

.admin-navbar .brand-mark {
  min-width: 0;
  max-width: 100%;
}

/* จอมือถือทั่วไป (~360-576px) — ซ่อนข้อความปุ่มเปลี่ยนรหัสก่อน
   เก็บ "ออกจากระบบ" ไว้เป็นข้อความ เพราะเป็นปุ่มที่คนกดหาบ่อยกว่า */
@media (max-width: 576px) {
  #btnChangePw .admin-nav-btn-label {
    display: none;
  }

  #btnChangePw {
    padding: 0.45rem 0.62rem;
    gap: 0;
  }
}

/* จอเล็กพิเศษ — เหลือไอคอนล้วนทั้งคู่ ชื่อปุ่มอ่านได้จาก title/aria-label */
@media (max-width: 380px) {
  .admin-nav-btn-label {
    display: none;
  }

  .admin-nav-btn {
    padding: 0.45rem 0.62rem;
    gap: 0;
  }

  .admin-nav-cta {
    gap: 0.4rem;
  }
}

/* ---------------- ตัวอย่างไฟล์ที่แนบตอนอัปโหลด (แอดมิน) ----------------
   บังคับให้ทุกช่องเป็นสี่เหลี่ยมจัตุรัสขนาดเท่ากัน ไม่ว่าไฟล์จะสัดส่วนไหน */
.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 0.6rem;
}

.upload-preview-grid .preview-thumb-container {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.upload-preview-grid .preview-thumb-container img,
.upload-preview-grid .preview-thumb-container video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ปุ่มลบต้องลอยอยู่เหนือรูป/วิดีโอเสมอ */
.upload-preview-grid .btn-remove-thumb {
  z-index: 3;
  border: none;
  cursor: pointer;
}

/* คลุมทั้งช่องวิดีโอ กดแล้วเปิดดูเต็มในโมดัล */
.upload-preview-play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.32);
  border: none;
  color: #fff;
  font-size: 1.7rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.upload-preview-play:hover {
  background: rgba(0, 0, 0, 0.14);
}

/* ป้ายบอกว่าเป็นไฟล์วิดีโอ */
.upload-preview-tag {
  position: absolute;
  left: 4px;
  bottom: 4px;
  z-index: 3;
  padding: 0.1rem 0.34rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
}
