/* ===========================================================================
   BASE — reset, typography, forms
   =========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* [hidden] ต้องชนะเสมอ — คลาสที่ประกาศ display (เช่น .x { display: flex })
   มี specificity สูงกว่ากฎ [hidden] ของเบราว์เซอร์ ทำให้ element ที่ JS สั่งซ่อน
   ยังโผล่อยู่ · เคยทำให้โมดัลยืนยันบิลขึ้น "กำลังตรวจสอบ..." ค้าง และขึ้นข้อความ
   เรื่องส่งยอดเกินให้เจ้ามือทั้งที่แผนนั้นไม่มีระบบส่งต่อ */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
  max-width: 100vw;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-main);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  margin: 0 0 var(--space-3);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  color: var(--text-main);
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-3xl);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
}

h4 {
  font-size: var(--text-lg);
}

h5 {
  font-size: var(--text-md);
}

h6 {
  font-size: var(--text-base);
}

p {
  margin: 0 0 var(--space-3);
  color: var(--text-body);
}

a {
  color: var(--gold-active);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-ios), text-decoration-color var(--dur-fast) var(--ease-ios);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration: none;
}

a:not([class]):hover {
  color: var(--gold-hover);
}

a:focus-visible {
  outline: 2px solid var(--gold-primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

small {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

code,
pre,
kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

hr {
  border: 0;
  border-top: 1px solid var(--border-soft);
  margin: var(--space-6) 0;
}

img,
svg {
  max-width: 100%;
  display: block;
}

/* Focus reset for interactive elements */
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: var(--shadow-focus);
}

/* Scrollbar (WebKit) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-main);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* Selection */
::selection {
  background: var(--gold-soft);
  color: var(--text-main);
}

/* Utility classes */
.text-main {
  color: var(--text-main);
}
.text-muted {
  color: var(--text-muted);
}

.text-subtle {
  color: var(--text-subtle);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}
.text-gold {
  color: var(--gold-primary);
}

.text-xs {
  font-size: var(--text-xs);
}

.text-sm {
  font-size: var(--text-sm);
}

.text-md {
  font-size: var(--text-md);
}

.text-lg {
  font-size: var(--text-lg);
}

.text-xl {
  font-size: var(--text-xl);
}



.font-semibold {
  font-weight: var(--weight-semibold);
}

.font-bold {
  font-weight: var(--weight-bold);
}

.font-mono {
  font-family: var(--font-mono);
}
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.money {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.mt-1 {
  margin-top: var(--space-1);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-5 {
  margin-top: var(--space-5);
}
.mb-0 {
  margin-bottom: 0;
}

.mb-1 {
  margin-bottom: var(--space-1);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-5 {
  margin-bottom: var(--space-5);
}
.hidden {
  display: none !important;
}

@media (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 768px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Accessibility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  padding: 8px 12px;
  background: var(--gold-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-sm);
  z-index: var(--z-toast);
  transition: top var(--dur-base) var(--ease-ios);
}

.skip-link:focus {
  top: 8px;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}