/* assets/css/app.css – OmniChat Design System */

/* ── Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Palette: ink-white with indigo accent */
  --c-bg:        #F7F8FA;
  --c-surface:   #FFFFFF;
  --c-surface2:  #F0F2F6;
  --c-border:    #E2E6EF;
  --c-text:      #1A1D27;
  --c-text-2:    #5C637A;
  --c-text-3:    #9BA3B8;
  --c-accent:    #3D5AFE;     /* indigo */
  --c-accent-h:  #2441E8;
  --c-accent-s:  #EEF1FF;    /* accent ghost */
  --c-success:   #10B981;
  --c-warning:   #F59E0B;
  --c-danger:    #EF4444;

  /* Type */
  --f-body:    'IBM Plex Sans Thai', 'IBM Plex Sans', sans-serif;
  --f-mono:    'IBM Plex Mono', monospace;

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* Radius */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.10);

  /* Sidebar */
  --sidebar-w: 240px;
  --topbar-h:  60px;
}

/* Dark mode tokens */
html.dark {
  --c-bg:       #0F1117;
  --c-surface:  #181B25;
  --c-surface2: #1E2130;
  --c-border:   #2A2F42;
  --c-text:     #E8EAF0;
  --c-text-2:   #8B91A8;
  --c-text-3:   #555D7A;
  --c-accent-s: #1A2050;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,.4);
}

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--f-body);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Typography ─────────────────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 600; letter-spacing: -.5px; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.2rem; font-weight: 600; }
h4 { font-size: 1rem;   font-weight: 500; }
.text-sm  { font-size: .875rem; }
.text-xs  { font-size: .75rem; }
.text-muted { color: var(--c-text-2); }
.text-accent { color: var(--c-accent); }

/* ── Layout helpers ──────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--sp-6); }
.flex   { display: flex; }
.flex-1 { flex: 1 1 0%; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.grid  { display: grid; }

/* ── Card ────────────────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: var(--sp-4); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: 10px 20px; border-radius: var(--r-md);
  font-weight: 500; font-size: .9rem;
  cursor: pointer; border: none;
  transition: background .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--c-accent); color: #fff;
  box-shadow: 0 2px 8px rgba(61,90,254,.30);
}
.btn-primary:hover { background: var(--c-accent-h); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--c-border);
  color: var(--c-text);
}
.btn-outline:hover { border-color: var(--c-accent); color: var(--c-accent); }

.btn-danger { background: var(--c-danger); color: #fff; }
.btn-success { background: var(--c-success); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ── Form controls ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-4); }
label { font-size: .85rem; font-weight: 500; color: var(--c-text-2); }
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--c-bg);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(61,90,254,.12);
  background: var(--c-surface);
}
.input-group { display: flex; }
.input-group .input { border-radius: var(--r-md) 0 0 var(--r-md); }
.input-group-addon {
  padding: 0 14px; display: flex; align-items: center;
  background: var(--c-surface2); border: 1.5px solid var(--c-border);
  border-left: none; border-radius: 0 var(--r-md) var(--r-md) 0;
  font-size: .85rem; color: var(--c-text-2);
}
select.input { cursor: pointer; }
.input-phone { display: flex; gap: var(--sp-2); }
.input-phone select { width: 90px; flex-shrink: 0; }

/* checkbox */
.check-row {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3); background: var(--c-accent-s);
  border-radius: var(--r-md); cursor: pointer;
}
.check-row input[type=checkbox] { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; accent-color: var(--c-accent); }
.check-row span { font-size: .875rem; color: var(--c-text-2); }

.form-error { font-size: .8rem; color: var(--c-danger); }
.field-error { border-color: var(--c-danger) !important; }

/* ── Alert ───────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--r-md);
  font-size: .875rem; display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.alert--success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert--error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert--info    { background: var(--c-accent-s); color: var(--c-accent); border: 1px solid #C7D2FE; }
.alert--warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

/* ── Badge ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 99px;
  font-size: .75rem; font-weight: 600;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-info    { background: var(--c-accent-s); color: var(--c-accent); }

/* ── Sidebar layout ──────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-w);
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width .22s cubic-bezier(.4,0,.2,1), transform .25s;
  overflow: hidden;   /* ป้องกัน text ล้นตอน collapse */
}

/* ── Toggle button (Fixed Bug: แสดงเต็มใบ ไม่แหว่งครึ่งตัว) ── */
.sidebar-toggle {
  position: absolute;
  top: 18px; 
  right: -12px; 
  width: 24px; 
  height: 24px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  display: flex; 
  align-items: center; 
  justify-content: center;
  cursor: pointer;
  font-size: .75rem;
  color: var(--c-text-2);
  z-index: 101;
  transition: background .15s, color .15s, transform .2s;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  padding: 0;
}
.sidebar-toggle:hover { background: var(--c-accent); color: #fff; border-color: var(--c-accent); }

/* หมุนลูกศรหลบกลับทิศทางตอนยุบ Sidebar */
.sidebar.collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

/* ── Collapsed state (icon-only rail) ───────────────────────────── */
.sidebar.collapsed {
  width: 56px;
}
/* ซ่อนข้อความสิทธิ์ต่างๆ ให้เหลือแค่ไอคอน */
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-item > :not(.icon),
.sidebar.collapsed .user-info,
.sidebar.collapsed .badge,
.sidebar.collapsed .coming-soon,
.sidebar.collapsed .btn-block span,
.sidebar.collapsed #theme-toggle {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
  display: none !important; /* Force ซ่อนสิทธิ์ส่วนเกินไม่ให้ดัน Element หลัก */
}
.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding: var(--sp-4) 0;
}
.sidebar.collapsed .logo-mark {
  margin: 0 auto;
}
.sidebar.collapsed .sidebar-footer {
  padding: var(--sp-3) var(--sp-2);
}
.sidebar.collapsed .user-pill {
  justify-content: center;
  padding: var(--sp-2) 0;
}

/* Бัคหลัก: สั่งให้อาร์เรย์เมนูเปลี่ยนเป็นจัดกึ่งกลางระนาบเดียวเป๊ะ */
.sidebar.collapsed .nav-item {
  justify-content: center !important;
  padding: 10px 0 !important;
  width: 100%;
}
.sidebar.collapsed .nav-item .icon {
  margin: 0 auto !important;
  width: 100% !important;
  text-align: center;
}

/* เมื่อย่อเมนู ให้ปุ่ม Logout เหลือแต่ไอคอนกลางกล่อง */
.sidebar.collapsed .btn-block {
  padding: 10px 0 !important;
  border: none;
  background: transparent;
  color: var(--c-danger);
  display: flex;
  justify-content: center;
  align-items: center;
}
.sidebar.collapsed .btn-block:hover {
  background: var(--c-accent-s);
  border-radius: var(--r-md);
}

/* Tooltip สำหรับ collapsed mode */
.sidebar.collapsed .nav-item {
  position: relative;
}
.sidebar.collapsed .nav-item:hover::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%; transform: translateY(-50%);
  background: var(--c-text);
  color: var(--c-surface);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: .78rem;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
  opacity: 1;
}

/* ── Logo area ───────────────────────────────────────────────────── */
.sidebar-logo {
  padding: var(--sp-5) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: var(--sp-3);
  position: relative;
  flex-shrink: 0;
  transition: padding .22s;
}
.sidebar-logo .logo-mark {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: var(--c-accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1rem;
  flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-weight: 600; font-size: 1.05rem;
  white-space: nowrap;
  transition: opacity .15s, width .15s;
}

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--sp-4) var(--sp-3); }
.sidebar.collapsed .sidebar-nav { padding: var(--sp-4) var(--sp-2); }

.nav-section-label {
  font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--c-text-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
  white-space: nowrap;
  transition: opacity .15s;
}

/* ── Nav Items & Icons (Fixed Bug: ไอคอน Font Awesome กึ่งกลางพิกเซล) ── */
.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-3); border-radius: var(--r-md);
  color: var(--c-text-2); font-size: .9rem;
  transition: background .12s, color .12s, padding .22s, justify-content .22s;
  text-decoration: none; margin-bottom: 2px;
  white-space: nowrap;
}
.nav-item:hover { background: var(--c-surface2); color: var(--c-text); text-decoration: none; }
.nav-item.active { background: var(--c-accent-s); color: var(--c-accent); font-weight: 500; }

.nav-item .icon {
  width: 20px;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: margin 0.2s;
}

/* ── Sidebar Footer & Controls ── */
.sidebar-footer {
  padding: var(--sp-4) var(--sp-3);
  border-top: 1px solid var(--c-border);
  transition: padding .22s;
}
.user-pill {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md);
  transition: padding .22s;
}
.user-pill .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--c-accent-s); color: var(--c-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .95rem; flex-shrink: 0;
}
.user-pill .user-info { flex: 1; min-width: 0; overflow: hidden; transition: opacity .15s, width .15s; }
.user-pill .user-info .name { font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-pill .user-info .role { font-size: .7rem; color: var(--c-text-3); }

#theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--c-surface2); border: 1px solid var(--c-border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: background .15s;
  padding: 0;
}
#theme-toggle:hover { background: var(--c-border); }

/* ── Main content ────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .22s cubic-bezier(.4,0,.2,1);
}
.main-content.sidebar-collapsed {
  margin-left: 56px;
}

.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
  position: sticky; top: 0; z-index: 90;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; }
.page-content { padding: var(--sp-6) var(--sp-8); flex: 1; }
.page-header { margin-bottom: var(--sp-6); }
.page-header h1 { font-size: 1.6rem; }
.page-header p { color: var(--c-text-2); margin-top: var(--sp-1); font-size: .9rem; }

/* ── Stats row ───────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.stat-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--sp-5); }
.stat-label { font-size: .78rem; font-weight: 500; color: var(--c-text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--sp-2); }
.stat-value { font-size: 1.9rem; font-weight: 600; letter-spacing: -.5px; }
.stat-sub   { font-size: .8rem; color: var(--c-text-2); margin-top: var(--sp-1); }

/* ── Table ───────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  text-align: left; font-size: .75rem; font-weight: 600;
  color: var(--c-text-3); text-transform: uppercase; letter-spacing: .06em;
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--c-border);
}
tbody tr { border-bottom: 1px solid var(--c-border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--c-bg); }
td { padding: var(--sp-3) var(--sp-4); vertical-align: middle; }

/* ── Auth pages ──────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-6);
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(61,90,254,.10) 0%, transparent 70%), var(--c-bg);
}
.auth-box { width: 100%; max-width: 440px; }

/* ปรับตรงนี้: จัดตำแหน่งโลโก้ให้อยู่ตรงกลางของหน้า Auth */
.auth-logo { 
  display: flex; 
  align-items: center; 
  justify-content: center; /* ดันรูปภาพให้อยู่กึ่งกลางกล่อง */
  margin-bottom: var(--sp-8); 
}

/* เพิ่มตรงนี้: ควบคุมขนาดของ favicon ให้ชัดเจนและพอดี */
.auth-logo .logo-img {
  width: 48px;            /* กำหนดความกว้างที่เหมาะสมสำหรับหน้า Login/Register */
  height: 48px;           /* กำหนดความสูงให้เท่ากันเพื่อให้เป็นอัตราส่วน 1:1 */
  object-fit: contain;    /* ป้องกันภาพบิดเบี้ยว */
  image-rendering: -webkit-optimize-contrast; /* ช่วยให้ไฟล์ .ico/.png ขนาดเล็กดูคมชัดขึ้น */
}

.auth-box h1 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-box .subtitle { color: var(--c-text-2); font-size: .9rem; margin-bottom: var(--sp-6); }
.auth-divider { display: flex; align-items: center; gap: var(--sp-4); margin: var(--sp-5) 0; color: var(--c-text-3); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--c-border); }

/* ── Chat UI ─────────────────────────────────────────────────────── */
.chat-shell { display: flex; height: 100vh; overflow: hidden; }
.chat-list-panel { width: 300px; flex-shrink: 0; background: var(--c-surface); border-right: 1px solid var(--c-border); display: flex; flex-direction: column; }
.chat-list-header { padding: var(--sp-4) var(--sp-4) var(--sp-3); border-bottom: 1px solid var(--c-border); }
.chat-list-header h3 { font-size: .95rem; margin-bottom: var(--sp-3); }
.search-input { width: 100%; padding: 8px 12px; background: var(--c-bg); border: 1.5px solid var(--c-border); border-radius: var(--r-md); font-size: .85rem; color: var(--c-text); outline: none; }
.search-input:focus { border-color: var(--c-accent); }
.chat-list-body { flex: 1; overflow-y: auto; }
.chat-item { display: flex; align-items: center; gap: var(--sp-3); padding: 12px var(--sp-4); cursor: pointer; border-bottom: 1px solid var(--c-border); transition: background .1s; }
.chat-item:hover { background: var(--c-bg); }
.chat-item.active { background: var(--c-accent-s); }
.chat-item .ci-avatar { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; background: var(--c-accent-s); color: var(--c-accent); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .95rem; position: relative; }
.platform-badge { position: absolute; bottom: -2px; right: -2px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--c-surface); font-size: 8px; display: flex; align-items: center; justify-content: center; }
.platform-badge.line { background: #00C300; }
.platform-badge.facebook { background: #1877F2; }
.ci-info { flex: 1; min-width: 0; }
.ci-name { font-size: .875rem; font-weight: 500; }
.ci-preview { font-size: .78rem; color: var(--c-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.ci-time { font-size: .72rem; color: var(--c-text-3); }
.ci-badge { background: var(--c-accent); color: #fff; font-size: .65rem; font-weight: 600; padding: 1px 6px; border-radius: 99px; min-width: 18px; text-align: center; }

/* Chat window */
.chat-window { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-window-header { height: var(--topbar-h); background: var(--c-surface); border-bottom: 1px solid var(--c-border); display: flex; align-items: center; padding: 0 var(--sp-5); gap: var(--sp-3); }
.chat-window-header .info { flex: 1; }
.chat-window-header .name { font-weight: 600; font-size: .95rem; }
.chat-window-header .platform { font-size: .78rem; color: var(--c-text-2); }
.messages-area { flex: 1; overflow-y: auto; padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.msg { max-width: 68%; display: flex; flex-direction: column; }
.msg.incoming { align-self: flex-start; }
.msg.outgoing { align-self: flex-end; }
.msg-bubble { padding: 10px 14px; border-radius: var(--r-lg); font-size: .875rem; line-height: 1.5; }
.msg.incoming .msg-bubble { background: var(--c-surface); border: 1px solid var(--c-border); border-bottom-left-radius: var(--r-sm); }
.msg.outgoing .msg-bubble { background: var(--c-accent); color: #fff; border-bottom-right-radius: var(--r-sm); }
.msg-time { font-size: .7rem; color: var(--c-text-3); margin-top: 4px; }
.msg.outgoing .msg-time { text-align: right; }
.chat-input-area { padding: var(--sp-4) var(--sp-5); background: var(--c-surface); border-top: 1px solid var(--c-border); display: flex; gap: var(--sp-3); align-items: flex-end; }
.chat-input-area textarea { flex: 1; padding: 10px 14px; background: var(--c-bg); border: 1.5px solid var(--c-border); border-radius: var(--r-md); color: var(--c-text); resize: none; min-height: 42px; max-height: 140px; outline: none; font-size: .875rem; line-height: 1.5; }
.chat-input-area textarea:focus { border-color: var(--c-accent); }

/* ── Subscribe page ──────────────────────────────────────────────── */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); margin-bottom: var(--sp-6); }
.plan-card { border: 2px solid var(--c-border); border-radius: var(--r-xl); padding: var(--sp-6); cursor: pointer; transition: border-color .15s, box-shadow .15s; position: relative; }
.plan-card:hover { border-color: var(--c-accent); }
.plan-card.selected { border-color: var(--c-accent); box-shadow: 0 0 0 4px rgba(61,90,254,.10); }
.plan-card.popular::before { content: 'แนะนำ'; position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--c-accent); color: #fff; font-size: .72rem; font-weight: 600; padding: 3px 12px; border-radius: 99px; }
.plan-name { font-weight: 600; font-size: 1rem; margin-bottom: var(--sp-2); }
.plan-price { font-size: 2rem; font-weight: 700; letter-spacing: -.5px; }
.plan-price span { font-size: 1rem; font-weight: 400; color: var(--c-text-2); }
.plan-desc { font-size: .82rem; color: var(--c-text-2); margin-top: var(--sp-3); }

/* payment methods */
.payment-methods { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.payment-method-item { border: 1.5px solid var(--c-border); border-radius: var(--r-md); padding: var(--sp-4) var(--sp-4); display: flex; align-items: center; gap: var(--sp-4); cursor: pointer; transition: border-color .12s; }
.payment-method-item.selected { border-color: var(--c-accent); background: var(--c-accent-s); }
.payment-method-item input { accent-color: var(--c-accent); }
.payment-method-info { flex: 1; }
.payment-method-info .pm-name { font-weight: 500; font-size: .9rem; }
.payment-method-info .pm-detail { font-size: .8rem; color: var(--c-text-2); margin-top: 2px; }

/* ── Settings tabs ───────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--c-border); margin-bottom: var(--sp-6); }
.tab-btn { padding: 10px 18px; background: none; border: none; cursor: pointer; font-size: .875rem; color: var(--c-text-2); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .12s; }
.tab-btn:hover { color: var(--c-text); }
.tab-btn.active { color: var(--c-accent); border-bottom-color: var(--c-accent); font-weight: 500; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2); /* ให้ระยะห่างระหว่างไอคอนกับข้อความเท่ากันพอดี */
  padding: 10px 18px; 
  background: none; 
  border: none; 
  cursor: pointer;
  font-size: .875rem; 
  color: var(--c-text-2);
  border-bottom: 2px solid transparent; 
  margin-bottom: -2px;
  transition: color .12s;
}

/* ── Webhook box ─────────────────────────────────────────────────── */
.webhook-box { background: var(--c-bg); border: 1.5px solid var(--c-border); border-radius: var(--r-md); padding: var(--sp-4); font-family: var(--f-mono); font-size: .8rem; display: flex; align-items: center; gap: var(--sp-3); word-break: break-all; }
.webhook-box .url { flex: 1; color: var(--c-accent); }

/* ── Slip upload ─────────────────────────────────────────────────── */
.upload-area { border: 2px dashed var(--c-border); border-radius: var(--r-lg); padding: var(--sp-8); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.upload-area:hover, .upload-area.dragover { border-color: var(--c-accent); background: var(--c-accent-s); }
.upload-area .icon { font-size: 2rem; margin-bottom: var(--sp-2); }
.upload-area p { font-size: .875rem; color: var(--c-text-2); }
.upload-area #slip-preview { max-height: 200px; margin: var(--sp-3) auto 0; border-radius: var(--r-md); }

/* ── Transaction list (admin) ────────────────────────────────────── */
.slip-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: var(--r-sm); cursor: pointer; }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 999; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--c-surface); border-radius: var(--r-xl); padding: var(--sp-6); max-width: 90vw; }
.modal-box img { max-height: 80vh; border-radius: var(--r-md); }

/* ── Hamburger (mobile) ──────────────────────────────────────────── */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: var(--sp-2); color: var(--c-text); }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .hamburger { display: flex; }
  .plan-grid { grid-template-columns: 1fr; }
  .chat-list-panel { width: 100%; display: none; }
  .chat-list-panel.mobile-open { display: flex; position: fixed; inset: 0; z-index: 200; }
  .page-content { padding: var(--sp-4); }
  .sidebar-toggle { display: none; }
}

/* ── Coming soon badge ───────────────────────────────────────────── */
.coming-soon { display: inline-flex; align-items: center; gap: 6px; background: var(--c-surface2); border: 1px solid var(--c-border); color: var(--c-text-3); font-size: .75rem; font-weight: 500; padding: 2px 10px; border-radius: 99px; }

/* ── Divider & Empty state ───────────────────────────────────────── */
.divider { height: 1px; background: var(--c-border); margin: var(--sp-5) 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: var(--sp-10); color: var(--c-text-2); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: var(--sp-4); opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ── Password strength ───────────────────────────────────────────── */
.pw-bar { height: 4px; border-radius: 2px; background: var(--c-border); overflow: hidden; margin-top: 6px; }
.pw-fill { height: 100%; width: 0; transition: width .3s, background .3s; border-radius: 2px; }

/* ── Chat Input Attach Button ────────────────────────────────────── */
.attach-btn {
  background: transparent; border: none; font-size: 1.25rem; color: var(--c-text-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  height: 42px; width: 42px; border-radius: var(--r-md); transition: background .15s, color .15s;
  flex-shrink: 0; margin-bottom: 1px;
}
.attach-btn:hover { color: var(--c-accent); background: var(--c-accent-s); }
.attach-btn:active { transform: scale(0.95); }

/* Status icons */
.status-icon { display: inline-flex; align-items: center; margin-left: var(--sp-1); font-size: 0.75rem; }
.status-icon.pending { color: var(--c-text-3); }
.status-icon.sent { color: rgba(255, 255, 255, 0.8); }
.status-icon.failed { color: var(--c-danger); }

/* ใส่ที่แท็ก body หรือคลาสหลักอย่าง .auth-page */
body, .auth-page {
  -webkit-user-select: none;  /* Safari */
  -moz-user-select: none;     /* Firefox */
  -ms-user-select: none;      /* IE10+ */
  user-select: none;          /* Standard syntax */
}

/* แถม: ล็อกไม่ให้ลากตัวรูปภาพ logo ออกไปเปิดแท็บใหม่ */
img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  -user-drag: none;
}
/* บังคับเปิดให้ลากคลุมและคัดลอกข้อความได้แน่นอน */
.allow-copy-page {
  -webkit-user-select: text !important;  /* Safari */
  -moz-user-select: text !important;     /* Firefox */
  -ms-user-select: text !important;      /* IE10+ */
  user-select: text !important;          /* Standard */
  
  cursor: auto !important;
}

/* หากมีรูปภาพในหน้านี้แล้วอยากให้ลากรูปได้ด้วย (เผื่อเป็นคิวอาร์โค้ดติดต่อ) */
.allow-copy-page img {
  -webkit-user-drag: auto !important;
  -user-drag: auto !important;
}