/* ========= CI Sixtygram (ตรงกับ influencerlist) ========= */
:root {
  --il-bg: #f3f4f6;
  --il-surface: #ffffff;
  --il-border-subtle: #e5e7eb;
  --il-border-strong: #d1d5db;
  --il-text-main: #111827;
  --il-text-muted: #6b7280;
  --il-accent: #E5B909;
  --il-accent-soft: #FEF9E7;
  --il-accent-strong: #111827;
  --il-danger: #b91c1c;
  --il-radius-lg: 16px;
  --il-radius-md: 12px;
  --il-radius-sm: 10px;
  --il-shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.08);
  --il-shadow-card: 0 8px 32px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
  --il-gradient-warm: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 40%, #FDE68A 70%, #FCD34D 100%);
  --il-gradient-soft: linear-gradient(180deg, rgba(254, 249, 231, 0.6) 0%, rgba(248, 250, 252, 0.4) 50%, rgba(241, 245, 249, 0.8) 100%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  min-height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Sarabun", Arial, sans-serif;
  color: var(--il-text-main);
  background: var(--il-bg);
}

body {
  /* Mobile: ใช้ภาพ auth-brand เป็นพื้นหลังทั้งหน้า */
  background: url("/images/BG-forwebapp-m.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ========= LAYOUT: Split (desktop) / Stack (mobile) ========= */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

@media (min-width: 900px) {
  .auth-wrap {
    flex-direction: row;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
  }
}

.auth-brand {
  display: none;
}

@media (min-width: 900px) {
  .auth-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 44%;
    min-width: 380px;
    min-height: 100vh;
    flex-shrink: 0;
    padding: 3rem 4rem;
    background: url("/images/BG-forwebapp-m.webp");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-right: 1px solid rgba(229, 185, 9, 0.15);
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.04);
    position: relative;
    overflow: hidden;
  }
  /* Desktop: เฟดภาพไปทางฝั่ง auth-main */
  .auth-brand::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(
      90deg,
      rgba(243, 244, 246, 0) 0%,
      rgba(243, 244, 246, 0.08) 18%,
      rgba(243, 244, 246, 0.35) 45%,
      rgba(243, 244, 246, 0.75) 72%,
      rgba(243, 244, 246, 1) 100%
    );
  }
  .auth-brand-logo {
    display: inline-block;
    margin-bottom: 2rem;
    text-decoration: none;
    line-height: 0;
    filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.28)) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.22));
    position: relative;
    z-index: 1;
  }
  .auth-brand-logo:hover {
    opacity: 0.9;
  }
  .auth-brand-logo-img {
    display: block;
    width: 100px;
    height: auto;
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22), 0 6px 16px rgba(0, 0, 0, 0.18);
  }
  .auth-brand-tagline {
    display: none;
  }
  .auth-brand-visual {
    display: none;
  }
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  /* Mobile: ทำให้ฟอร์มอ่านง่ายบนภาพพื้นหลัง */
  background: rgba(243, 244, 246, 0.55);
  backdrop-filter: blur(10px);
}

/* มือถือ: flex:1 ใน column บาง WebKit ทำให้ .auth-main สูงแค่เนื้อหา → การ์ดอยู่ล่าง — ล็อกเต็ม viewport ด้วย fixed + จัดกลางจริง */
@media (max-width: 899px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    min-height: 100svh;
    min-height: 100dvh;
  }
  .auth-wrap {
    /* คงโครง DOM; พื้นที่โต้ตอบหลักอยู่ที่ .auth-main แบบ fixed */
    min-height: 100svh;
    min-height: 100dvh;
  }
  .auth-main {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    box-sizing: border-box;
    width: 100%;
    flex: none;
    max-height: none;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: max(1rem, env(safe-area-inset-top, 0px)) max(1.25rem, env(safe-area-inset-right, 0px))
      max(1rem, env(safe-area-inset-bottom, 0px)) max(1.25rem, env(safe-area-inset-left, 0px));
  }
}

@media (min-width: 900px) {
  .auth-main {
    padding: 2rem;
    overflow: auto;
    /* Desktop: ให้สีพื้น match กับ fade จากฝั่ง auth-brand */
    background: var(--il-bg);
    backdrop-filter: none;
    position: relative;
  }
  /* Desktop: เฟดซ้อนอีกชั้นในฝั่ง auth-main เพื่อกลบรอยต่อให้เนียน */
  .auth-main::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 220px;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(
      90deg,
      rgba(243, 244, 246, 0.85) 0%,
      rgba(243, 244, 246, 0.45) 40%,
      rgba(243, 244, 246, 0) 100%
    );
    z-index: 0;
  }
}

/* กว้างพอเป็น split (≥900px) แต่จอเตี้ย (มือถือแนวนอนรุ่นใหญ่): center แนวตั้งตัดหัวการ์ด — ยึดบน + เลื่อนใน .auth-main */
@media (min-width: 900px) and (max-height: 720px) {
  .auth-wrap {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
  }
  .auth-brand {
    min-height: 0;
    align-self: stretch;
    overflow: hidden;
  }
  .auth-main {
    min-height: 0;
    align-self: stretch;
    align-items: flex-start;
    align-content: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: max(0.75rem, env(safe-area-inset-top, 0px)) 1.5rem max(0.75rem, env(safe-area-inset-bottom, 0px)) 1.5rem;
  }
  .auth-card {
    position: relative;
    z-index: 1;
    margin-top: max(0.25rem, env(safe-area-inset-top, 0px));
    margin-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  }
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
  backdrop-filter: blur(12px);
  border-radius: var(--il-radius-lg);
  box-shadow: var(--il-shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.8);
  padding: 2rem;
  position: relative;
}

/* โหมดเข้าสู่ระบบ: ไม่แสดง step indicator */
.auth-card--login .auth-steps {
  display: none !important;
}

@media (min-width: 480px) {
  .auth-card {
    padding: 2.5rem;
  }
}

/* split + จอเตี้ย: อยู่หลัง min-width:480 ของ .auth-card ไม่ให้ padding 2.5rem ทับ */
@media (min-width: 900px) and (max-height: 520px) {
  .auth-card {
    padding: 1.25rem 1.5rem;
    border-radius: var(--il-radius-md);
  }
  .auth-tabs-row {
    margin-bottom: 1rem;
  }
  .auth-header {
    margin-bottom: 1rem;
  }
}

/* แนวนอน / จอสั้น: ฟอร์มมักสูงกว่าความสูง viewport — จัดจากบน + เลื่อนได้ (ต้องอยู่หลัง min-width:480 ของ .auth-card ไม่ให้ padding ถูกทับ) */
@media (max-width: 899px) and (orientation: landscape),
  (max-width: 899px) and (max-height: 520px) {
  .auth-main {
    align-items: flex-start;
    align-content: flex-start;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
  }
  .auth-card {
    margin-top: max(0.25rem, env(safe-area-inset-top, 0px));
    margin-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    padding: 1.2rem 1.35rem;
    border-radius: var(--il-radius-md);
    max-width: min(420px, calc(100vw - 1.5rem));
  }
  .auth-tabs-row {
    margin-bottom: 1rem;
  }
  .auth-header {
    margin-bottom: 1rem;
  }
}

/* ========= TABS ========= */
.auth-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.auth-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0;
  padding: 5px;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  width: clamp(220px, 45%, 320px);
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.auth-tabs-indicator {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc((100% - 10px - 0.25rem) / 2);
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid rgba(203, 213, 225, 0.9);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  box-sizing: border-box;
  transform: translateX(0);
  transition: transform 260ms cubic-bezier(0.2, 0.9, 0.2, 1);
  z-index: 0;
}

.auth-tabs[data-active="signup"] .auth-tabs-indicator {
  transform: translateX(calc(100% + 0.25rem));
}

.auth-close {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--il-border-subtle);
  background: rgba(255, 255, 255, 0.8);
  color: var(--il-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.auth-close:hover {
  background: #ffffff;
  color: var(--il-text-main);
  border-color: var(--il-border-strong);
}

.auth-close:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--il-accent-soft);
  border-color: var(--il-accent);
}

@media (max-width: 420px) {
  .auth-tabs {
    width: clamp(200px, 70%, 320px);
  }
}

.auth-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  font-size: 0.92em;
  font-weight: 500;
  color: var(--il-text-muted);
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

@media (max-width: 420px) {
  .auth-tab {
    font-size: 0.88em;
    padding: 0.5rem 0.6rem;
  }
}

.auth-tab:hover {
  color: var(--il-text-main);
}

.auth-tab.auth-tab-active {
  color: var(--il-accent-strong);
  background: transparent;
  box-shadow: none;
}

/* ========= HEADER ========= */
.auth-header {
  margin-bottom: 1.5rem;
  transition: opacity 0.2s ease;
}

.auth-header.auth-header--transition {
  opacity: 0;
}

.auth-title {
  font-size: 1.25em;
  font-weight: 700;
  color: var(--il-text-main);
  margin: 0 0 0.25rem 0;
}

.auth-subtitle {
  font-size: 1em;
  color: var(--il-text-muted);
  margin: 0;
}

.auth-subtitle-top {
  margin-bottom: 1.25rem;
}

/* ========= STEP INDICATOR ========= */
.auth-steps {
  display: flex;
  align-items: center;
  justify-content: stretch;
  width: 100%;
  gap: 0;
  margin-bottom: 1.5rem;
}

.auth-steps:not([hidden]) {
  animation: auth-step-in 0.3s ease-out forwards;
}

.auth-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
  color: var(--il-text-muted);
  font-size: 0.875em;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.auth-step-dot.auth-step-done {
  background: linear-gradient(180deg, #f0c014 0%, var(--il-accent) 50%, #d4a506 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(212, 165, 6, 0.3);
}

.auth-step-dot.auth-step-active {
  background: linear-gradient(180deg, #1f2937 0%, var(--il-accent-strong) 100%);
  color: var(--il-surface);
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.25);
}

.auth-step-line {
  flex: 1;
  min-width: 12px;
  height: 2px;
  background: var(--il-border-subtle);
  transition: background 0.25s ease;
}

.auth-step-line.auth-step-line-done {
  background: linear-gradient(90deg, var(--il-accent) 0%, #d4a506 100%);
}

/* ========= FORM ========= */
.auth-step {
  margin-top: 0;
}

.auth-legal {
  margin: 1.25rem 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--il-text-muted);
  text-align: center;
}

/* Step transition: ตั้งทิศทางด้วย data-slide-dir บน .auth-card */
.auth-step:not([hidden]) {
  animation: auth-step-in-up 0.35s ease-out forwards;
}

.auth-card[data-slide-dir="right"] .auth-step:not([hidden]) {
  animation: auth-step-in-right 0.32s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.auth-card[data-slide-dir="left"] .auth-step:not([hidden]) {
  animation: auth-step-in-left 0.32s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

@keyframes auth-step-in-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes auth-step-in-right {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes auth-step-in-left {
  from { opacity: 0; transform: translateX(-14px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Skeleton loading overlay: ใช้ตอนเรียก API */
.auth-card.is-loading {
  pointer-events: none;
}

.auth-card.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.auth-card.is-loading::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.95);
  -webkit-mask-image: url("/icon/refresh.svg");
  mask-image: url("/icon/refresh.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 56px 56px;
  mask-size: 56px 56px;
  animation: auth-spin 0.9s linear infinite;
  z-index: 21;
}

@keyframes auth-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-field-row {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .auth-field-row {
    flex-direction: row;
    gap: 1rem;
  }
  .auth-field-row .auth-field {
    flex: 1;
  }
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.auth-label {
  font-size: 1em;
  font-weight: 500;
  color: var(--il-text-main);
}

.auth-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1em;
  border: 1px solid var(--il-border-subtle);
  border-radius: var(--il-radius-sm);
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  color: var(--il-text-main);
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.auth-input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-leading-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  object-fit: contain;
  pointer-events: none;
  opacity: 0.55;
  filter: grayscale(1) brightness(0.55);
}

.auth-input--leading-icon {
  padding-left: 2.5rem;
}

.auth-input:hover {
  border-color: var(--il-border-strong);
  background: #ffffff;
}

.auth-input:focus {
  outline: none;
  border-color: var(--il-accent);
  box-shadow: 0 0 0 3px var(--il-accent-soft);
  background: #ffffff;
}

.auth-input::placeholder {
  color: var(--il-text-muted);
}

.auth-required {
  color: var(--il-danger);
}

/* Phone +66 prefix */
.auth-phone-wrap {
  display: flex;
  align-items: stretch;
  border: 2px solid var(--il-border-subtle);
  border-radius: var(--il-radius-sm);
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  overflow: hidden;
  position: relative;
}

.auth-phone-wrap:focus-within {
  border-color: var(--il-accent);
  box-shadow: 0 0 0 3px var(--il-accent-soft);
}

.auth-phone-prefix {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem 0 1.25rem;
  margin: 0 0.75rem 0 0;
  border-right: 1px solid var(--il-border-subtle);
  font-size: 1.1em;
  font-weight: 600;
  color: var(--il-text-main);
  white-space: nowrap;
  min-height: 2.5rem;
}

.auth-phone-prefix .auth-phone-flag {
  width: 1.5em;
  height: 1.5em;
  object-fit: contain;
  vertical-align: middle;
}

.auth-phone-wrap .auth-input-with-prefix {
  border: none;
  border-radius: 0;
  padding: 0.5rem 1rem 0.5rem 0.25rem;
  background: transparent;
  flex: 1;
}

.auth-phone-wrap .auth-input-with-prefix:focus {
  box-shadow: none;
}

/* Password wrap + toggle */
.auth-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-password-wrap .auth-input {
  padding-right: 2.75rem;
}

.auth-password-wrap .auth-leading-icon {
  left: 12px;
}

.auth-password-wrap .auth-input--leading-icon {
  padding-left: 2.5rem;
}

.auth-password-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--il-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--il-radius-sm);
}

.auth-password-toggle:hover {
  color: var(--il-text-main);
  background: var(--il-border-subtle);
}

.auth-password-toggle-icon {
  display: block;
  pointer-events: none;
}

/* ========= BUTTONS ========= */
.auth-btn {
  padding: 0.75rem 1.25rem;
  font-size: 1em;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.1s;
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-btn-primary {
  background: var(--il-accent);
  color: #ffffff;
}

.auth-btn-primary:hover:not(:disabled) {
  background: #d4a506;
  color: #ffffff;
}

.auth-btn-ghost {
  background: transparent;
  color: var(--il-text-muted);
}

.auth-btn-ghost:hover:not(:disabled) {
  background: var(--il-border-subtle);
  color: var(--il-text-main);
}

.auth-btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.auth-btn-row .auth-btn-primary {
  flex: 1;
  min-width: 120px;
}

/* ========= OTP ========= */
.auth-phone-display {
  font-size: 1em;
  color: var(--il-text-muted);
  margin: 0 0 1rem 0;
}

.auth-phone-display strong {
  color: var(--il-text-main);
}

.auth-otp-row {
  display: flex;
  gap: 1rem;
  justify-content: stretch;
  width: 100%;
  margin: 0.25rem 0 0;
}

.auth-otp-digit {
  flex: 1;
  min-width: 0;
  height: 6rem;
  text-align: center;
  font-size: 2.5rem;
  font-weight: 600;
  border: 2px solid var(--il-border-subtle);
  border-radius: var(--il-radius-sm);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: var(--il-text-main);
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-otp-digit:hover {
  border-color: var(--il-border-strong);
  background: #ffffff;
}

.auth-otp-digit:focus {
  outline: none;
  border-color: var(--il-accent);
  box-shadow: 0 0 0 3px var(--il-accent-soft);
  background: #ffffff;
}

.auth-otp-digit::placeholder {
  color: var(--il-text-muted);
  font-weight: 400;
}

.auth-otp-resend {
  margin: 1rem 0 0;
  font-size: 0.95em;
}

.auth-otp-resend .auth-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: var(--il-accent-strong);
  text-decoration: none;
}

.auth-otp-resend .auth-link:hover:not(:disabled) {
  text-decoration: underline;
}

.auth-otp-resend .auth-link:disabled {
  cursor: not-allowed;
  color: var(--il-text-muted);
}

/* ========= ERROR ========= */
.auth-error {
  font-size: 1em;
  color: var(--il-danger);
  margin: 0;
}

/* ========= DIVIDER & SWITCH ========= */
.auth-divider {
  font-size: 0.9em;
  color: var(--il-text-muted);
  text-align: center;
  margin: 0.75rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--il-border-subtle) 20%, var(--il-border-strong) 50%, var(--il-border-subtle) 80%, transparent 100%);
}

.auth-switch {
  font-size: 1em;
  color: var(--il-text-muted);
  margin: 0.5rem 0 0;
  text-align: center;
}

.auth-link {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-weight: 600;
  color: var(--il-accent-strong);
  text-decoration: underline;
  cursor: pointer;
}

.auth-link:hover {
  color: var(--il-accent);
}

.auth-link--muted {
  color: var(--il-text-muted);
  text-decoration: none;
  font-weight: 600;
}

.auth-link--muted:hover {
  color: var(--il-text-main);
  text-decoration: underline;
}

.auth-remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: -0.25rem;
}

.auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  user-select: none;
}

.auth-remember-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--il-accent);
}

.auth-remember-label {
  color: var(--il-text-muted);
  font-weight: 600;
}

/* ========= MODAL (OTP error) ========= */
body.auth-modal-open {
  overflow: hidden;
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(4px);
}

.auth-modal-box {
  position: relative;
  width: 100%;
  max-width: 360px;
  border-radius: var(--il-radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--il-shadow-card);
  padding: 1.25rem 1.25rem 1.05rem;
  z-index: 1;
}

.auth-modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--il-border-subtle);
  background: rgba(255, 255, 255, 0.85);
  color: var(--il-text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.auth-modal-close:hover {
  background: #ffffff;
  color: var(--il-text-main);
  border-color: var(--il-border-strong);
}

.auth-modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--il-text-main);
  margin: 0.25rem 0 0.5rem;
}

.auth-modal-desc {
  font-size: 14px;
  color: var(--il-text-muted);
  margin: 0 0 1.25rem;
  line-height: 1.55;
}

.auth-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Modal buttons: เล็กลง + โทนเทา (ลองอีกครั้ง) */
.auth-modal-actions .auth-btn {
  padding: 0.55rem 0.9rem;
  font-size: 0.95em;
  border-radius: 10px;
}

.auth-modal-actions .auth-btn-primary {
  background: #e5e7eb;
  color: #111827;
}

.auth-modal-actions .auth-btn-primary:hover:not(:disabled) {
  background: #d1d5db;
  color: #111827;
}
