/* ==========================================================================
   ⚙️ PVT WORKFORCE HUB - SYSTEM SETTINGS (การตั้งค่าระบบ)
   ========================================================================== */

/* 🔤 Font Scaling CSS Rules (มีผลครอบคลุมทุกหน้าและทุกองค์ประกอบข้อความ) */
/* ==========================================================================
   ขนาดตัวอักษร (ตั้งค่า > ขนาดตัวอักษร)
   เดิม: ตั้ง font-size: 106% / 114% ให้ p, span, li ... ทุกตัว → คิดจากขนาดกล่องแม่
   ทำให้หัวข้อ/คำอธิบาย/ตัวเลขกลายเป็นขนาดเดียวกันหมด และข้อความซ้อนชั้นถูกขยายซ้ำ
   ตอนนี้: ขยาย "เนื้อหาของหน้า" ทั้งก้อนด้วย zoom → สัดส่วนเดิมทุกอย่าง
   ไม่ขยาย: ส่วนหัว (.pvt-appbar / topbar), แถบล่าง, เมนูข้าง, หน้าต่างตั้งค่า (ขนาดตายตัว)
   ========================================================================== */
html[data-font-size="medium"] .main-content > :not(.pvt-appbar):not(.topbar):not(.approver-topbar):not(.pvt-tabbar),
html[data-font-size="medium"] #page-user-leave > .page {
  zoom: 1.12;
}

html[data-font-size="large"] .main-content > :not(.pvt-appbar):not(.topbar):not(.approver-topbar):not(.pvt-tabbar),
html[data-font-size="large"] #page-user-leave > .page {
  zoom: 1.25;
}

/* Adjust element spacing and elasticity for large font mode */
html[data-font-size="medium"] .nav-item,
html[data-font-size="large"] .nav-item {
  height: auto;
  min-height: 44px;
}

html[data-font-size="medium"] .btn,
html[data-font-size="large"] .btn {
  height: auto;
  min-height: 38px;
}


/* 📱 Modal Backdrop */
.settings-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* 🗂️ Settings Dialog Box */
.settings-modal-box {
  --st-accent: var(--primary, var(--th-p-600, #0d9488));
  --st-accent-soft: var(--primary-soft, var(--th-p-50, #f0fdfa));
  --st-accent-ring: var(--primary-light, var(--th-p-100, #ccfbf1));
  --st-text: #0f172a;
  --st-text-2: #475569;
  --st-line: #e2e8f0;
  --st-bg-soft: #f8fafc;

  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 920px;
  height: min(720px, 90vh);
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(226, 232, 240, 0.8);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  font-family: 'Sarabun', sans-serif;
  color: var(--st-text);
}

.settings-modal-backdrop.active .settings-modal-box {
  transform: scale(1) translateY(0);
}

.settings-modal-box .material-symbols-outlined { line-height: 1; }

/* 🏷️ Modal Header */
.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 16px 24px;
  border-bottom: 1px solid var(--st-line);
  flex-shrink: 0;
}

.settings-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.settings-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--st-accent-soft);
  color: var(--st-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-header-icon .material-symbols-outlined { font-size: 22px; }

.settings-modal-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--st-text);
}

.settings-modal-subtitle {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: #64748b;
}

.settings-modal-close-btn {
  background: transparent;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.settings-modal-close-btn:hover {
  background: #f1f5f9;
  color: var(--st-text);
}

/* 📜 Body = เมนูหมวด + เนื้อหา */
.settings-modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.settings-nav {
  width: 220px;
  flex-shrink: 0;
  padding: 16px 12px;
  background: var(--st-bg-soft);
  border-right: 1px solid var(--st-line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.settings-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--st-text-2);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.settings-nav-btn .material-symbols-outlined { font-size: 21px; }

.settings-nav-btn:hover { background: #eef2f6; color: var(--st-text); }

.settings-nav-btn.active {
  background: #ffffff;
  color: var(--st-accent);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--st-line);
}

.settings-nav-admin { margin-top: auto; color: #7c3aed; }
.settings-nav-admin:hover { background: #f5f3ff; color: #6d28d9; }
.settings-nav-ext { margin-left: auto; font-size: 16px !important; opacity: 0.7; }

.settings-panels {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 20px 28px 28px;
}

.settings-panel { display: flex; flex-direction: column; gap: 14px; }
.settings-panel[hidden] { display: none; }

.settings-panel-title {
  margin: 0 0 2px;
  font-size: 18px;
  font-weight: 700;
  color: var(--st-text);
}

/* 📦 กลุ่มการตั้งค่า */
.setting-card-item {
  background: #ffffff;
  border: 1px solid var(--st-line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setting-section-head h4 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--st-text);
}

.setting-section-head p {
  margin: 2px 0 0 0;
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.45;
}

.setting-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
}
.setting-hint .material-symbols-outlined { font-size: 17px; color: #3b82f6; margin-top: 1px; }

/* ปุ่มเลือก (ใช้ร่วมกัน) — สถานะเลือกอยู่ชัดเจน */
.font-size-btn,
.font-family-btn,
.theme-color-btn,
.lang-pills-btn {
  position: relative;
  border: 1.5px solid var(--st-line);
  background: #ffffff;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--st-text-2);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.font-size-btn:hover,
.font-family-btn:hover,
.theme-color-btn:hover,
.lang-pills-btn:hover {
  border-color: #94a3b8;
}

.font-size-btn.active,
.font-family-btn.active,
.theme-color-btn.active,
.lang-pills-btn.active {
  border-color: var(--st-accent);
  background: var(--st-accent-soft);
  color: var(--st-accent);
  box-shadow: 0 0 0 3px var(--st-accent-ring);
}

.font-size-btn:focus-visible,
.font-family-btn:focus-visible,
.theme-color-btn:focus-visible,
.lang-pills-btn:focus-visible,
.settings-nav-btn:focus-visible,
.setting-switch input:focus-visible + .setting-slider {
  outline: 2px solid var(--st-accent);
  outline-offset: 2px;
}

/* 🔤 ขนาดตัวอักษร */
.font-size-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.font-size-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-height: 72px;
  padding: 10px 8px;
}

.font-size-sample { font-weight: 700; line-height: 1; color: inherit; }
.font-size-label { font-size: 14px; font-weight: 600; }

/* 🅰️ แบบอักษร */
.font-family-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.font-family-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 36px 10px 12px;
  text-align: left;
}

.font-family-sample { font-size: 19px; font-weight: 600; color: var(--st-text); line-height: 1.35; }
.font-family-name { font-size: 13.5px; font-weight: 700; color: inherit; }
.font-family-desc { font-size: 12.5px; color: #64748b; }
.font-family-check { position: absolute; top: 10px; right: 10px; font-size: 20px !important; color: var(--st-accent); }

.font-preview-box {
  background: var(--st-bg-soft);
  border: 1px solid var(--st-line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  color: #334155;
  line-height: 1.6;
}

.font-preview-label {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  vertical-align: 2px;
  font-family: 'Sarabun', sans-serif;
}

/* 🎨 สีของระบบ */
.theme-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.theme-color-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
  text-align: left;
}

.theme-swatch-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.6), 0 1px 3px rgba(0,0,0,0.2);
}

.theme-info-wrap { display: flex; flex-direction: column; min-width: 0; }
.theme-name { font-size: 14px; font-weight: 700; color: var(--st-text); }
.theme-desc { font-size: 12px; color: #64748b; }

/* 🔘 รายการเปิด/ปิด (คลิกได้ทั้งแถว) */
.setting-list { padding: 4px 18px; gap: 0; }

.setting-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  cursor: pointer;
}

.setting-list .setting-toggle-row + .setting-toggle-row { border-top: 1px solid #f1f5f9; }

.setting-toggle-info { flex: 1; min-width: 0; }

.setting-toggle-info h5 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--st-text);
}

.setting-toggle-info p {
  margin: 2px 0 0 0;
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.45;
}

.setting-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11.5px;
  font-weight: 700;
  vertical-align: 2px;
}

/* สวิตช์ */
.setting-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.setting-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.setting-slider {
  position: absolute;
  inset: 0;
  background-color: #cbd5e1;
  transition: background-color .2s;
  border-radius: 999px;
  pointer-events: none;
}

.setting-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background-color: white;
  transition: transform .2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.setting-switch input:checked + .setting-slider { background-color: var(--st-accent); }
.setting-switch input:checked + .setting-slider:before { transform: translateX(20px); }

/* 🌐 ภาษา + ตัวเลือกแบบแถบ */
.lang-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.lang-main-grid { grid-template-columns: repeat(2, 1fr); }

.lang-pills-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
}

.lang-main-grid .lang-pills-btn { justify-content: flex-start; }

.lang-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.lang-pills-btn.active .lang-code { background: var(--st-accent); color: #fff; }

.translate-slot {
  display: flex;
  align-items: center;
  min-height: 44px;
}

/* 💬 LINE */
.line-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 12px 14px;
}

.line-status-banner.is-linked { background: #f0fdf4; border-color: #bbf7d0; }

.line-status-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.line-status-left img { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; }

.line-status-text h5 { margin: 0; font-size: 15px; font-weight: 700; color: #15803d; }
.line-status-text p { margin: 2px 0 0 0; font-size: 13px; color: #166534; }

.btn-line-cta {
  background: #06c755;
  color: #ffffff;
  border: none;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
  font-family: inherit;
}

.btn-line-cta:hover { background: #05b04c; }

.line-advanced summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
  padding: 4px 0;
}

.line-advanced summary:hover { color: var(--st-text); }

.line-manual-box { display: flex; gap: 8px; margin-top: 8px; }

.line-manual-input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 8px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  font-family: ui-monospace, monospace;
}

.line-manual-input:focus { outline: none; border-color: var(--st-accent); box-shadow: 0 0 0 3px var(--st-accent-ring); }

.line-manual-save-btn {
  background: #0f172a;
  color: #ffffff;
  border: none;
  min-height: 42px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.line-manual-save-btn:hover { background: #334155; }

/* 🏷️ Modal Footer */
.settings-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--st-line);
  background: #ffffff;
  flex-shrink: 0;
}

.btn-settings-reset,
.btn-settings-done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14.5px;
  cursor: pointer;
}

.btn-settings-reset .material-symbols-outlined,
.btn-settings-done .material-symbols-outlined { font-size: 19px; }

.btn-settings-reset {
  background: transparent;
  border: 1px solid var(--st-line);
  color: #475569;
  font-weight: 600;
  padding: 8px 14px;
}

.btn-settings-reset:hover { background: #f1f5f9; color: var(--st-text); }

.btn-settings-done {
  background: var(--st-accent);
  color: #ffffff;
  border: none;
  padding: 8px 24px;
  font-weight: 700;
}

.btn-settings-done:hover { filter: brightness(0.93); }

/* 🌙 EYE-CARE WARM FILTER */
html[data-eyecare-mode="true"]::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(245, 158, 11, 0.05) !important;
  pointer-events: none;
  z-index: 999999;
  mix-blend-mode: multiply;
  transition: background-color 0.4s ease;
}

/* Auto-refresh subtle blinking glow for active state */
@keyframes quiet-pulse {
  0% { opacity: 1; }
  50% { opacity: 0.4; }
  100% { opacity: 1; }
}

.live-indicator-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background-color: #22c55e;
  border-radius: 50%;
  margin-right: 5px;
  box-shadow: 0 0 6px #22c55e;
  animation: quiet-pulse 2s infinite ease-in-out;
}

/* 🌓 HIGH CONTRAST ACCESSIBILITY MODE */
html[data-high-contrast="true"] {
  --primary: #000000 !important;
  --primary-soft: #f8fafc !important;
  --primary-hover: #1e293b !important;
}
html[data-high-contrast="true"] body {
  background-color: #ffffff !important;
  color: #000000 !important;
}
html[data-high-contrast="true"] .card, 
html[data-high-contrast="true"] .panel,
html[data-high-contrast="true"] .setting-card-item,
html[data-high-contrast="true"] .sum-card,
html[data-high-contrast="true"] .stat-card,
html[data-high-contrast="true"] .news-card,
html[data-high-contrast="true"] .table-panel {
  border: 2px solid #000000 !important;
  box-shadow: none !important;
  background: #ffffff !important;
}
/* เดิมบังคับ span ทุกตัวเป็นสีดำ → ข้อความสีขาวบนปุ่ม/ป้ายสีกลายเป็นดำบนพื้นเข้ม อ่านไม่ออก
   ตอนนี้: ทำตัวหนาทุกตัว แต่เปลี่ยนเป็นสีดำเฉพาะข้อความทั่วไปที่ไม่ได้อยู่บนปุ่ม/ป้ายสี */
html[data-high-contrast="true"] p,
html[data-high-contrast="true"] span:not(.material-symbols-outlined),
html[data-high-contrast="true"] small,
html[data-high-contrast="true"] th,
html[data-high-contrast="true"] td,
html[data-high-contrast="true"] label {
  font-weight: 700 !important;
}

html[data-high-contrast="true"] p:not(button *):not(a *):not([class*="btn"] *):not([class*="badge"] *):not([class*="tag"] *):not([class*="hero"] *):not([class*="banner"] *):not(.pvt-tabbar *),
html[data-high-contrast="true"] span:not(button *):not(a *):not([class*="btn"] *):not([class*="badge"] *):not([class*="tag"] *):not([class*="hero"] *):not([class*="banner"] *):not(.pvt-tabbar *),
html[data-high-contrast="true"] small:not(button *):not(a *):not([class*="btn"] *):not([class*="badge"] *):not([class*="tag"] *):not([class*="hero"] *):not([class*="banner"] *):not(.pvt-tabbar *),
html[data-high-contrast="true"] th:not(button *):not(a *):not([class*="btn"] *):not([class*="badge"] *):not([class*="tag"] *):not([class*="hero"] *):not([class*="banner"] *):not(.pvt-tabbar *),
html[data-high-contrast="true"] td:not(button *):not(a *):not([class*="btn"] *):not([class*="badge"] *):not([class*="tag"] *):not([class*="hero"] *):not([class*="banner"] *):not(.pvt-tabbar *),
html[data-high-contrast="true"] label:not(button *):not(a *):not([class*="btn"] *):not([class*="badge"] *):not([class*="tag"] *):not([class*="hero"] *):not([class*="banner"] *):not(.pvt-tabbar *) {
  color: #000000 !important;
}

/* สีเทาอ่อนของข้อความรอง → เข้มขึ้น */
html[data-high-contrast="true"] {
  --text-soft: #1e293b;
  --text-muted: #1e293b;
  --muted: #1e293b;
  --pvt-muted: #1e293b;
}

/* ⚡ REDUCED MOTION & BATTERY SAVER MODE */
html[data-reduced-motion="true"] *,
html[data-reduced-motion="true"] *::before,
html[data-reduced-motion="true"] *::after {
  animation-delay: 0s !important;
  animation-duration: 0s !important;
  animation-iteration-count: 1 !important;
  transition-delay: 0s !important;
  transition-duration: 0s !important;
  scroll-behavior: auto !important;
}

/* 🛡️ PRIVACY SHIELD MODE (BLURS SENSITIVE STATS UNTIL HOVER) */
html[data-privacy-shield="true"] .stat-card .stat-number,
html[data-privacy-shield="true"] .stat-card .stat-val,
html[data-privacy-shield="true"] .sum-card .stat-num,
html[data-privacy-shield="true"] .quota-count,
html[data-privacy-shield="true"] .leave-days-count,
html[data-privacy-shield="true"] .emp-salary,
html[data-privacy-shield="true"] .personal-meta-val,
html[data-privacy-shield="true"] .balance-num,
html[data-privacy-shield="true"] .leave-days-badge,
/* ตัวเลขจริงในหน้าพนักงาน: ประวัติลา (.metric-*), หน้าหลัก (.stat-num), ยื่นใบลา (.leave-quota-days) */
html[data-privacy-shield="true"] .metric-big-num,
html[data-privacy-shield="true"] .metric-sub-detail,
html[data-privacy-shield="true"] .stat-num,
html[data-privacy-shield="true"] .leave-quota-days {
  filter: blur(5px) !important;
  transition: filter 0.15s ease !important;
}
html[data-privacy-shield="true"] .stat-card:hover .stat-number,
html[data-privacy-shield="true"] .stat-card:hover .stat-val,
html[data-privacy-shield="true"] .sum-card:hover .stat-num,
html[data-privacy-shield="true"] .quota-count:hover,
html[data-privacy-shield="true"] .leave-days-count:hover,
html[data-privacy-shield="true"] .personal-meta-val:hover,
html[data-privacy-shield="true"] .balance-num:hover,
html[data-privacy-shield="true"] .leave-days-badge:hover,
html[data-privacy-shield="true"] .metric-big-num:hover,
html[data-privacy-shield="true"] .metric-sub-detail:hover,
html[data-privacy-shield="true"] .stat-num:hover,
html[data-privacy-shield="true"] .leave-quota-days:hover,
/* มือถือไม่มี hover → แตะค้างเพื่อดู */
html[data-privacy-shield="true"] .metric-big-num:active,
html[data-privacy-shield="true"] .metric-sub-detail:active,
html[data-privacy-shield="true"] .stat-num:active,
html[data-privacy-shield="true"] .leave-quota-days:active,
html[data-privacy-shield="true"] .quota-count:active,
html[data-privacy-shield="true"] .balance-num:active {
  filter: blur(0px) !important;
}

/* 🪄 GOOGLE MAGIC TRANSLATE WIDGET STYLING */
.goog-te-banner-frame { 
  display: none !important; 
}
body { 
  top: 0px !important; 
}
.goog-te-gadget-simple {
  background: transparent !important;
  border: none !important;
  font-family: 'Sarabun', sans-serif !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
}

/* 🌐 GLOBAL LANGUAGE SWITCHER STYLING */
#globalLangSwitcherContainer .lang-switcher {
  display: flex;
  gap: 2px;
  align-items: center;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 9999px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
  border: 1px solid #cbd5e1;
  z-index: 99;
  position: relative;
}

#globalLangSwitcherContainer .lang-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Sarabun', sans-serif;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
}

#globalLangSwitcherContainer .lang-btn.active {
  background: #ffffff !important;
  color: var(--th-p-600, #0d9488) !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12) !important;
  font-weight: 700 !important;
}

#globalLangSwitcherContainer .lang-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
  color: #0f172a;
}

.goog-te-gadget-icon { 
  display: none !important; 
}
.goog-te-menu-value {
  margin: 0 !important;
  padding: 6px 12px !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  color: #1e293b !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  display: flex !important;
  align-items: center !important;
  flex-direction: row !important;
  gap: 4px !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
}
.goog-te-menu-value:hover {
  border-color: var(--th-b-500, #3b82f6) !important;
  background: var(--th-k-50, #f0f9ff) !important;
  color: var(--th-b-600, #2563eb) !important;
}
.goog-te-menu-value span { 
  color: inherit !important; 
  border: none !important; 
  white-space: nowrap !important;
}
.goog-te-menu-value span[style*="border-left"] {
  display: none !important;
}
.goog-te-menu-value span[style*="color"] {
  font-size: 10px !important;
  margin-left: 4px !important;
  color: #64748b !important;
}
.goog-te-menu-value img {
  display: none !important;
}
.goog-te-combo {
  padding: 8px 32px 8px 12px !important;
  border-radius: 10px !important;
  border: 1.5px solid #cbd5e1 !important;
  background-color: #ffffff !important;
  color: #1e293b !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  outline: none !important;
  cursor: pointer !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  appearance: none !important; /* Hide native arrow to style our own */
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 14px !important;
  display: inline-block !important;
}
.goog-te-combo:hover {
  border-color: var(--th-b-500, #3b82f6) !important;
  box-shadow: 0 4px 12px rgba(var(--th-b-500-rgb, 59, 130, 246), 0.08) !important;
  background-color: #f8fafc !important;
}
.goog-te-combo:focus {
  border-color: var(--th-b-500, #3b82f6) !important;
  box-shadow: 0 0 0 3px rgba(var(--th-b-500-rgb, 59, 130, 246), 0.15) !important;
}
/* Only style skiptranslate inside settings modal or visible element */
#google_translate_element_visible .skiptranslate,
#systemSettingsModal .skiptranslate,
.magic-translate-card .skiptranslate {
  display: inline-block !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
}

/* Hide Google branding and link texts */
.goog-te-gadget {
  font-size: 0 !important;
  color: transparent !important;
  line-height: 0 !important;
  display: block !important;
}
.goog-te-gadget span,
.goog-te-gadget a,
.goog-logo-link {
  display: none !important;
}

/* Ensure completely invisible and zero footprint for top translation banner */
body > .skiptranslate,
body > div.skiptranslate,
body > iframe.skiptranslate,
.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
iframe.goog-te-banner-frame,
iframe.goog-te-banner-frame-escaped,
iframe.skiptranslate,
iframe[src*="translate.google.com"],
iframe[id*="google_translate"],
iframe[id*=":1.container"],
iframe[id*=":2.container"],
iframe[id*=":0.container"],
iframe[class*="goog-te-banner-frame"],
.VIpgJd-ZVi9od-ORHb-OEVmcd,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf,
.VIpgJd-ZVi9od-xl07Ob-OEVmcd,
.goog-te-menu-frame,
iframe.goog-te-menu-frame,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-te-spinner-pos,
div[id*="goog-gt-"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  max-height: 0 !important;
  max-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  pointer-events: none !important;
  position: absolute !important;
  top: -99999px !important;
  left: -99999px !important;
  z-index: -99999 !important;
}

html, body {
  top: 0px !important;
  margin-top: 0px !important;
}

/* ข้อความสั้นสำหรับมือถือ (แสดงเฉพาะในจอแคบ) */
.st-short { display: none; }

/* 📱 มือถือ (2026-10-28): ยังเป็นเมนูซ้ายเหมือนคอม แต่ย่อเป็นแถบไอคอนแคบ (ไอคอน + ชื่อสั้นใต้ไอคอน)
   เพื่อให้เนื้อหาด้านขวากว้างพอ · ไม่ใช่แถบด้านบนแบบเดิมที่ตัดออกเมื่อ 22/10 */
@media (max-width: 720px) {
  .settings-nav {
    width: 78px;
    padding: 10px 6px;
    gap: 4px;
  }
  .settings-nav-btn {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: 64px;
    padding: 8px 2px;
    font-size: 11.5px;
    line-height: 1.25;
    text-align: center;
  }
  .settings-nav-btn .material-symbols-outlined { font-size: 22px; }
  .settings-nav-ext { display: none; }

  .settings-panels { padding: 14px 12px 20px; }
  .settings-panel { gap: 12px; }
  .settings-panel-title { font-size: 17px; }
  .setting-card-item { padding: 14px 12px; border-radius: 12px; }
  .setting-list { padding: 2px 12px; }
  .setting-section-head h4 { font-size: 15px; }
  .setting-section-head p,
  .setting-toggle-info p { font-size: 13px; }
  .setting-toggle-row { gap: 10px; }

  .font-size-options-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .font-size-btn { min-height: 64px; padding: 8px 4px; }
  .font-size-label { font-size: 13px; }
  .lang-options-grid,
  .lang-main-grid { grid-template-columns: minmax(0, 1fr); }

  /* แบบอักษร: แถวละ 1 แบบ ตัวอย่างซ้าย + ชื่อขวา (ตัดคำอธิบาย) */
  .font-family-list { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .font-family-btn { flex-direction: row; align-items: center; gap: 8px; min-height: 44px; padding: 6px 30px 6px 10px; }
  .font-family-sample { font-size: 15px; white-space: nowrap; flex-shrink: 0; }
  .font-family-name { flex: 1; min-width: 0; font-size: 11.5px; line-height: 1.25; text-align: right; color: #64748b; }
  .font-family-btn.active .font-family-name { color: var(--st-accent); }
  .font-family-desc { display: none; }
  .font-family-check { top: 50%; right: 8px; transform: translateY(-50%); font-size: 17px !important; }
  .font-preview-box { font-size: 13.5px; padding: 8px 10px; }

  /* สีของระบบ: 2 คอลัมน์ วงสี + ชื่อ (ตัดคำอธิบาย) */
  .theme-options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .theme-color-btn { min-height: 46px; padding: 8px 10px; gap: 8px; }
  .theme-swatch-circle { width: 20px; height: 20px; }
  .theme-name { font-size: 12.5px; line-height: 1.3; }
  .theme-desc { display: none; }

  /* คำอธิบาย: ตัดที่ยาวออก ใช้ข้อความสั้นแทน */
  .st-long, .st-m-hide { display: none !important; }
  .st-short { display: inline; }
  .settings-modal-subtitle { display: none; }

  .settings-modal-footer { padding: 10px 12px; }
}

/* 📱 จอแคบมาก (≤ 380px เช่น 360px) */
@media (max-width: 380px) {
  .settings-nav { width: 72px; }
  .settings-panels { padding: 12px 10px 18px; }
  .setting-card-item { padding: 12px 10px; }
  .font-family-btn { padding: 6px 26px 6px 8px; gap: 6px; }
  .font-family-sample { font-size: 13.5px; }
  .font-family-name { font-size: 10.5px; }
  .theme-color-btn { padding: 6px 8px; gap: 6px; min-height: 42px; }
  .theme-swatch-circle { width: 16px; height: 16px; }
  .theme-name { font-size: 11.5px; }
}
