/* =========================================================
   POS ขายของกาด - Styles & Thermal Printer Receipt CSS
   ========================================================= */

:root {
  --brand-50: #ecfdf5;
  --brand-100: #d1fae5;
  --brand-200: #a7f3d0;
  --brand-600: #059669;
  --brand-700: #047857;
  --brand-800: #065f46;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --focus-ring: 0 0 0 3px rgba(5, 150, 105, 0.22);
}

html {
  -webkit-tap-highlight-color: transparent;
}
body {
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
/* ความสูงเต็มจอ: 100dvh สำหรับ Safari รุ่นใหม่ (แถบที่อยู่ไม่บังจอ) และ 100vh สำรองสำหรับรุ่นเก่า */
.app-shell {
  height: 100vh;
  height: 100dvh;
}
.print-wrapper {
  max-height: 62vh;
  max-height: 62dvh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ---------- Icons ---------- */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:focus-visible,
.chip:focus-visible,
.tab-btn:focus-visible,
.seg-btn:focus-visible,
.pos-card:focus-visible,
.numpad button:focus-visible,
.pay-method-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.btn-primary {
  background: var(--brand-700);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-800);
}
.btn-primary:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
}
.btn-dark {
  background: var(--ink);
  color: #ffffff;
}
.btn-dark:hover {
  background: #1e293b;
}
.btn-outline {
  background: #ffffff;
  border-color: var(--line);
  color: #334155;
}
.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.btn-danger {
  background: #ffffff;
  border-color: #fecdd3;
  color: #be123c;
}
.btn-danger:hover {
  background: #fff1f2;
}
.btn-ghost-danger {
  color: #be123c;
}
.btn-ghost-danger:hover {
  background: #fff1f2;
}
.btn-sm {
  min-height: 38px;
  padding: 0 0.75rem;
  border-radius: 10px;
  font-size: 0.8125rem;
}
.btn-lg {
  min-height: 58px;
  border-radius: 14px;
  font-size: 1.125rem;
  font-weight: 700;
}
.btn-icon {
  width: 44px;
  padding: 0;
}
.btn-sm.btn-icon {
  width: 38px;
}

/* ---------- Form fields ---------- */
.field {
  width: 100%;
  min-height: 46px;
  padding: 0 0.875rem;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--ink);
  font-size: 1rem; /* 16px ขึ้นไป iPhone/iPad จะไม่ซูมจอเองตอนแตะช่องกรอก */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input.field {
  -webkit-appearance: none;
  appearance: none;
}
input.field::-webkit-search-cancel-button,
input.field::-webkit-search-decoration,
input.field::-webkit-inner-spin-button,
input.field::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
input[type='number'].field {
  -moz-appearance: textfield;
}
.field::placeholder {
  color: #94a3b8;
}
.field:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: var(--focus-ring);
}
.field-search {
  min-height: 50px;
  padding-left: 2.875rem;
  padding-right: 2.875rem;
  border-radius: 14px;
  font-size: 1rem;
}
.field-cash {
  min-height: 64px;
  font-size: 1.875rem;
  font-weight: 700;
  text-align: right;
}
.field-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
}

/* ---------- Header tabs / segmented controls ---------- */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 14px;
  background: #f1f5f9;
}
.tab-btn,
.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0 0.875rem;
  border-radius: 10px;
  color: #475569;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.seg-btn {
  min-height: 36px;
  font-size: 0.8125rem;
}
.tab-btn:hover,
.seg-btn:hover {
  color: var(--ink);
}
.tab-btn.active,
.seg-btn.active {
  background: #ffffff;
  color: var(--brand-700);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.04);
}

/* ---------- Category / filter chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0 1rem;
  border-radius: 9999px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #475569;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.chip:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.chip-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
}
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}
.chip.active .chip-count {
  color: #cbd5e1;
}

/* ---------- Product touch card ---------- */
.pos-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.pos-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}
.pos-card:active:not(.out-of-stock) {
  transform: scale(0.97);
}
.pos-card.in-cart {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 2px var(--brand-600);
}
.pos-card.out-of-stock {
  cursor: not-allowed;
}
.pos-card.out-of-stock .pos-card-media img,
.pos-card.out-of-stock .pos-card-emoji,
.pos-card.out-of-stock .pos-card-body {
  opacity: 0.45;
  filter: grayscale(0.8);
}
.pos-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f1f5f9;
  overflow: hidden;
  flex-shrink: 0;
}
.pos-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #ffffff;
}
.pos-card-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.75rem;
}
.pos-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem;
}
.pos-card-qty {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  min-width: 34px;
  height: 34px;
  padding: 0 0.5rem;
  border-radius: 9999px;
  background: var(--brand-700);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(4, 120, 87, 0.4);
}
.pos-card-minus {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  background: #ffffff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
  transition: transform 0.08s ease, background-color 0.15s ease;
}
.pos-card-minus:hover {
  background: #f1f5f9;
}
.pos-card-minus:active {
  transform: scale(0.9);
}
.stock-tag {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 1;
  padding: 0.125rem 0.5rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
}
.stock-tag.low {
  background: #fde68a;
  color: #78350f;
}
.stock-tag.out {
  background: #e11d48;
  color: #ffffff;
}

/* ---------- Cart ---------- */
.cart-panel {
  display: flex;
  flex-direction: column;
  background: #ffffff;
}
.stepper {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 12px;
  background: #f1f5f9;
}
.stepper button {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: #ffffff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  touch-action: manipulation;
  transition: transform 0.08s ease;
}
.stepper button:active {
  transform: scale(0.9);
}
.stepper .qty {
  min-width: 36px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.cart-remove {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.cart-remove:hover {
  background: #fff1f2;
  color: #be123c;
}

.mobile-cart-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  min-height: 58px;
  padding: 0 1.25rem;
  border-radius: 16px;
  background: var(--brand-700);
  color: #ffffff;
  font-size: 1.0625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: 0 10px 28px rgba(4, 120, 87, 0.38);
  touch-action: manipulation;
}
.mobile-cart-bar.is-empty {
  display: none;
}
.mobile-cart-count {
  min-width: 28px;
  height: 28px;
  padding: 0 0.4rem;
  border-radius: 9999px;
  background: #ffffff;
  color: var(--brand-800);
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 1024px) {
  .cart-panel {
    width: 400px;
    height: 100%;
    flex-shrink: 0;
    border-left: 1px solid var(--line);
  }
  .cart-backdrop,
  .mobile-cart-bar,
  .cart-sheet-close {
    display: none !important;
  }
}
@media (min-width: 1280px) {
  .cart-panel {
    width: 430px;
  }
}
@media (max-width: 1023.98px) {
  /* บนมือถือ/แท็บเล็ตแนวตั้ง ตะกร้าเป็นแผ่นเลื่อนขึ้นจากด้านล่าง */
  .cart-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    height: min(88vh, 760px);
    height: min(88dvh, 760px);
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    transform: translateY(105%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.22);
  }
  .cart-footer {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }
  .cart-panel.open {
    transform: translateY(0);
  }
  .cart-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .cart-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ---------- Payment ---------- */
.pay-method-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 54px;
  padding: 0 0.75rem;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #ffffff;
  color: #475569;
  font-size: 0.9375rem;
  font-weight: 600;
  touch-action: manipulation;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pay-method-btn.active {
  border-color: var(--brand-600);
  background: var(--brand-50);
  color: var(--brand-800);
  box-shadow: 0 0 0 1px var(--brand-600);
}
.change-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--brand-200);
  background: var(--brand-50);
  color: var(--brand-800);
}
.cash-row {
  display: grid;
  gap: 0.75rem;
}
.change-box.short {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.numpad button,
.quick-cash {
  min-height: 56px;
  border-radius: 14px;
  background: #f1f5f9;
  color: var(--ink);
  font-size: 1.375rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background-color 0.1s ease, transform 0.06s ease;
}
.numpad button:hover,
.quick-cash:hover {
  background: #e2e8f0;
}
.numpad button:active,
.quick-cash:active {
  transform: scale(0.96);
  background: #cbd5e1;
}
.quick-cash {
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  font-size: 0.9375rem;
}
.quick-cash.exact {
  border-color: var(--brand-200);
  background: var(--brand-50);
  color: var(--brand-800);
}
@media (max-height: 760px) {
  .numpad button {
    min-height: 48px;
  }
}
@media (max-width: 767.98px) {
  /* จอเล็ก: ย่อระยะให้พอดีจอ และตรึงปุ่มยืนยันไว้ด้านล่างเสมอ */
  .numpad button {
    min-height: 48px;
  }
  .field-cash {
    min-height: 54px;
    font-size: 1.625rem;
  }
  .modal-head {
    min-height: 56px;
  }
  /* หน้าคิดเงินบนมือถือ: ยอดชำระเหลือแถวเดียว, "รับเงินมา" กับ "เงินทอน" วางคู่กัน */
  #paymentModal .pay-grid {
    gap: 0.75rem;
    padding: 0.75rem;
  }
  #paymentModal .pay-col > * + * {
    margin-top: 0.75rem;
  }
  #paymentModal .pay-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 14px;
  }
  #paymentModal .pay-total p:last-child {
    margin-top: 0;
    font-size: 1.75rem;
    line-height: 1.3;
  }
  #paymentModal .pay-method-btn {
    min-height: 46px;
  }
  #paymentModal .cash-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  #paymentModal .change-box {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    padding: 0.375rem 0.875rem;
  }
  #paymentModal .change-box span:first-child {
    font-size: 0.8125rem;
  }
  #paymentModal .change-box span:last-child {
    font-size: 1.5rem;
    line-height: 1.3;
  }
  #paymentModal .numpad button {
    min-height: 46px;
  }
  #paymentModal .modal-head {
    min-height: 52px;
  }
  .pay-confirm {
    position: sticky;
    bottom: 0.75rem;
    z-index: 1;
    box-shadow: 0 0 0 0.75rem #ffffff;
  }
}

/* ---------- Cards, tables, pills ---------- */
.stat-card {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #ffffff;
}
.stat-label {
  font-size: 0.8125rem;
  color: var(--muted);
}
.stat-value {
  margin-top: 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9375rem;
}
:where(.data-table th) {
  text-align: inherit;
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tbody tr:hover {
  background: #f8fafc;
}
/* จอมือถือและ iPad แนวตั้ง: เปลี่ยนตารางเป็นรายการแบบการ์ด ไม่ต้องเลื่อนซ้ายขวา */
@media (max-width: 1023.98px) {
  .data-table.stack thead {
    display: none;
  }
  .data-table.stack,
  .data-table.stack tbody {
    display: block;
  }
  .data-table.stack tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.625rem 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--line);
  }
  .data-table.stack tbody td {
    padding: 0;
    border: 0;
    text-align: left;
  }
  .data-table.stack tbody td[colspan] {
    grid-column: 1 / -1;
    text-align: center;
  }
  .stack-stock td:nth-child(1) {
    grid-column: 1 / -1;
  }
  .stack-stock td:nth-child(3),
  .stack-stock td:nth-child(5) {
    justify-self: end;
  }
  .stack-history td:nth-child(1) { order: 1; }
  .stack-history td:nth-child(4) { order: 2; justify-self: end; }
  .stack-history td:nth-child(2) { order: 3; grid-column: 1 / -1; min-width: 0; }
  .stack-history td:nth-child(3) { order: 4; }
  .stack-history td:nth-child(5) { order: 5; justify-self: end; }
}
/* iPad แนวตั้ง: จอกว้างพอ จัดสต๊อกเป็น 3 คอลัมน์ ชื่อสินค้าซ้าย ราคา/คงเหลือ/ปุ่มขวา */
@media (min-width: 640px) and (max-width: 1023.98px) {
  .data-table.stack-stock tbody tr {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .stack-stock td:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / span 2;
  }
  .stack-stock td:nth-child(2),
  .stack-stock td:nth-child(4) {
    justify-self: end;
  }
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill-ok {
  background: var(--brand-50);
  color: var(--brand-800);
}
.pill-low {
  background: #fef3c7;
  color: #92400e;
}
.pill-out {
  background: #ffe4e6;
  color: #be123c;
}
.pill-neutral {
  background: #f1f5f9;
  color: #475569;
}

/* Emoji Quick Picker Button */
.emoji-pick {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.emoji-pick:hover {
  background: var(--brand-50);
  border-color: var(--brand-600);
}

/* ---------- Modals & toast ---------- */
.modal-backdrop {
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.modal-card {
  width: 100%;
  max-height: calc(100vh - 1.5rem);
  max-height: calc(100dvh - 1.5rem);
  overflow-y: auto;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  animation: popIn 0.18s ease-out;
}
.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 64px;
  padding: 0 0.75rem 0 1.25rem;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}
.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: min(92vw, 480px);
  padding: 0.75rem 1.125rem;
  border-radius: 14px;
  background: var(--ink);
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  animation: popIn 0.18s ease-out;
}
.toast.success {
  background: var(--brand-700);
}
.toast.error {
  background: #be123c;
}
.toast.warning {
  background: #fde68a;
  color: #78350f;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.animate-pop {
  animation: popIn 0.18s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   THERMAL RECEIPT PAPER STYLING (58mm & 80mm)
   ========================================================= */
.thermal-paper {
  font-family: 'Sarabun', 'Courier Prime', monospace;
  color: #000000;
  background-color: #ffffff;
  line-height: 1.35;
  padding: 12px 10px 18px 10px;
  position: relative;
  box-sizing: border-box;
  transition: width 0.2s ease;
}

/* 58mm small thermal roll (~215px - 230px screen preview, 58mm print) */
.thermal-paper.paper-58mm {
  width: 230px;
  font-size: 11.5px;
}

/* 80mm standard thermal roll (~300px screen preview, 80mm print) */
.thermal-paper.paper-80mm {
  width: 310px;
  font-size: 12.5px;
}

/* Zig-zag torn paper top & bottom effect on screen */
.thermal-paper::before,
.thermal-paper::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background-size: 12px 6px;
}
.thermal-paper::before {
  top: -5px;
  background-image: linear-gradient(135deg, transparent 33.33%, #ffffff 33.33%, #ffffff 66.67%, transparent 66.67%),
                    linear-gradient(45deg, transparent 33.33%, #ffffff 33.33%, #ffffff 66.67%, transparent 66.67%);
}
.thermal-paper::after {
  bottom: -5px;
  background-image: linear-gradient(135deg, #ffffff 33.33%, transparent 33.33%, transparent 66.67%, #ffffff 66.67%),
                    linear-gradient(45deg, #ffffff 33.33%, transparent 33.33%, transparent 66.67%, #ffffff 66.67%);
}

.receipt-dashed-line {
  border-top: 1px dashed #000000;
  margin: 6px 0;
}

.receipt-double-line {
  border-top: 3px double #000000;
  margin: 6px 0;
}

/* =========================================================
   PRINT MEDIA QUERY (สำหรับเครื่องพิมพ์ความร้อน 58mm / 80mm)
   ========================================================= */
@media print {
  @page {
    margin: 0;
  }

  html, body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* ซ่อนทุกส่วนที่ไม่ใช่ใบเสร็จ */
  .no-print {
    display: none !important;
  }

  #receiptModal {
    position: static !important;
    display: block !important;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .print-wrapper {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
  }

  #thermalReceiptPaper {
    box-shadow: none !important;
    margin: 0 !important;
    padding: 2mm 2mm 6mm 2mm !important;
  }

  #thermalReceiptPaper.paper-58mm {
    width: 58mm !important;
    max-width: 58mm !important;
  }

  #thermalReceiptPaper.paper-80mm {
    width: 80mm !important;
    max-width: 80mm !important;
  }

  .thermal-paper::before,
  .thermal-paper::after {
    display: none !important;
  }
}
