/* =============================================================
   style.css — EduBot Unified Stylesheet
   รวม: styles.css, login.css, register.css,
         profile_edit.css, history.css, complaint.css, user_report.css
   ============================================================= */

/* ─── RESET ─────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── BASE BODY ─────────────────────────────────────────────── */
body {
  font-family: 'Tahoma', 'Arial Unicode MS', 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* login / register ใช้ body ต่างออกไป */
body.page-login,
body.page-register {
  height: auto;
  min-height: 100vh;
  overflow: auto;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
}

body.page-register {
  padding: 32px 16px;
}

/* ─── LINK RESET (styles.css) ───────────────────────────────── */
a:link,
a:visited,
a:hover,
a:active {
  text-decoration: none !important;
  color: black !important;
  outline: none !important;
}

/* ============================================================= */
/*  TOPBAR (shared)                                              */
/* ============================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 55px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
  z-index: 10;
}

/* user_report.css มี topbar สีดำ */
.topbar.dark {
  background: #1a1a1a;
  border-bottom: none;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: auto;          /* ปรับความกว้างของช่องตามต้องการ เช่น 40px หรือ 50px */
  height: 50px;         /* ปรับความสูงของช่องตามต้องการ */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;     /* ป้องกันไม่ให้รูปเลยเถิดออกจากช่อง */
  border-radius: 0;     /* มั่นใจว่าไม่เป็นวงกลมแน่นอน (หรือลบบรรทัด border-radius เดิมทิ้ง) */
}

.topbar.dark .logo-icon {
  background: #333;
}

.logo-name {
  font-weight: 700;
  font-size: 16px;
  color: #1a1a1a;
  letter-spacing: -0.3px;
}

.topbar.dark .logo-name {
  color: #fff;
}

.logo-divider {
  width: 1px;
  height: 14px;
  background: #e0e0e0;
  margin: 0 2px;
}

.topbar.dark .logo-divider {
  background: #444;
}

.logo-sub {
  font-size: 12px;
  color: #999;
}

.logo-img {
  width: 220px;        /* เปลี่ยนจาก 20px เป็น 100% เพื่อให้อิงตาม width/height ของ HTML หรือกรอบ */
  height: 50px;       /* เปลี่ยนจาก 20px เป็น 100% */
  object-fit: cover;
   /* หากโลโก้ไม่ใช่ทรงกลม และไม่อยากให้รูปโดนตัด สามารถลบตรรกะนี้ออกได้ครับ */
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #f5f5f5;
  border: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  position: relative;
  transition: background 0.15s;
}

.notif-btn:hover {
  background: #ebebeb;
}

.notif-dot {
  width: 7px;
  height: 7px;
  background: #ef4444;
  border-radius: 50%;
  position: absolute;
  top: 6px;
  right: 6px;
  border: 1.5px solid #fff;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #1a1a1a;
  border-radius: 20px;
  padding: 5px 13px 5px 6px;
  cursor: pointer;
}

.user-badge:hover {
  background: #333;
}


.avatar,
.ub-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

.user-name,
.ub-name {
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  align-items: center;
  display: flex;
}



.bnt-login {
  display: flex;
  align-items: center;
  background: #1a1a1a;
  border-radius: 20px;
  padding: 5px 13px 5px 6px;
  cursor: pointer;

}

.bnt-login:hover {
  background: #333;
}

/* Model chips container */
.model-chips {
  display: flex;
  background: #efefef;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

/* Model chip (styles.css) */
.model-chip {
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  color: #888;
  border: none;
  background: transparent;
  font-family: inherit;
}

.model-chip.active {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  font-weight: 600;
}

.bnt-topbar {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #1a1a1a;
  border-radius: 20px;
  padding: 5px 13px 5px 6px;
  cursor: pointer;
}

/* ============================================================= */
/*  MAIN LAYOUT (shared)                                         */
/* ============================================================= */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ============================================================= */
/*  SIDEBAR (shared)                                             */
/* ============================================================= */
.sidebar {
  width: 232px;
  background: #fff;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* user_report sidebar เลื่อนได้ */
.sidebar.scrollable {
  overflow-y: auto;
  width: 220px;
}

.sidebar.scrollable::-webkit-scrollbar {
  width: 3px;
}

.sidebar.scrollable::-webkit-scrollbar-thumb {
  background: #e0e0e0;
  border-radius: 3px;
}

.sidebar-top {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.new-chat-btn {
  width: 100%;
  padding: 9px 14px;
  background: #f5f5f5;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  color: #1a1a1a;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.new-chat-btn:hover {
  background: #ebebeb;
}

/* user_report new-chat-btn */
.sidebar.scrollable .new-chat-btn {
  margin: 14px 12px 10px;
  width: auto;
  background: #fff;
  border-color: #e4e4e4;
  color: #555;
}

.sidebar.scrollable .new-chat-btn:hover {
  background: #f5f5f5;
}

.sidebar-section {
  padding: 12px 12px 4px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #c0c0c0;
  padding: 0 4px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
  font-size: 13px;
  color: #555;
}

.nav-item:hover {
  background: #f5f5f5;
  color: #1a1a1a;
}

.nav-item.active {
  background: #f0f0f0;
  color: #1a1a1a;
  font-weight: 600;
}

.nav-icon {
  font-size: 18px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-divider,
.divider {
  height: 1px;
  background: #f0f0f0;
  margin: 4px 12px;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 12px;
}

.history-list::-webkit-scrollbar {
  width: 3px;
}

.history-list::-webkit-scrollbar-thumb {
  background: #e0e0e0;
  border-radius: 3px;
}

.history-item {
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s;
}

.history-item:hover {
  background: #f5f5f5;
  color: #1a1a1a;
}

.history-item.active {
  background: #f0f0f0;
  color: #1a1a1a;
}

/* Sidebar footer / quota (styles.css) */
.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid #f0f0f0;
}

.quota-wrap {
  padding: 8px 10px;
  background: #f8f8f8;
  border-radius: 8px;
}

.quota-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #aaa;
  margin-bottom: 5px;
}

.quota-bar {
  height: 3px;
  background: #e8e8e8;
  border-radius: 3px;
  overflow: hidden;
}

.quota-fill {
  height: 100%;
  width: 42%;
  background: #555;
  border-radius: 3px;
}

/* ============================================================= */
/*  SHARED FORM ELEMENTS                                         */
/* ============================================================= */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: #555;
}

.form-input {
  width: 100%;
  /* ลดความสูงลงเล็กน้อยเพื่อให้ดูไม่เทอะทะ */
  padding: 10px 12px 10px 20px;
  /* 40px ด้านซ้ายเผื่อที่ไว้ให้ไอคอน */
  font-size: 14px;
  /* ปรับขนาดตัวอักษรให้เล็กลงนิดหน่อย */
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  outline: none;
  transition: all 0.2s;
}

.form-input.no-icon {
  padding-left: 12px;
}

.form-input:focus {
  border-color: #aaa;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.form-input::placeholder {
  color: #ccc;
}

.form-input:disabled {
  background: #fafafa;
  color: #bbb;
  cursor: not-allowed;
}

.form-select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 32px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  padding: 10px 13px;
  font-family: 'Noto Sans Thai', sans-serif;
  font-size: 13px;
  color: #1a1a1a;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: #aaa;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #ccc;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.readonly-note {
  font-size: 10.5px;
  color: #bbb;
  margin-top: 2px;
  padding-left: 4px;
}

/* Input with icon (login / register) */
.input-wrap {
  display: flex;
  align-items: center;
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  width: 100%;
}

/* เมื่อ input/select ข้างในโฟกัส ให้กรอบนอกไฮไลต์แทน */
.input-wrap:focus-within {
  border-color: #aaa;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  color: #6366f1;
  pointer-events: none;
  display: flex;
  align-items: center;
  line-height: 1;
  flex-shrink: 0;
}

.form-input.has-icon {
  padding-left: 38px;
}

.form-input.no-icon {
  padding-left: 20px;
}

.toggle-pw {
  position: absolute;
  right: 12px;
  font-size: 14px;
  color: #bbb;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.toggle-pw:hover {
  color: #666;
}

/* ─── TOAST (shared) ─────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1a1a1a;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(2rem);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
  z-index: 9999;
  white-space: nowrap;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#toast.success {
  background: #22c55e;
}

#toast.error {
  background: #ef4444;
}

/* ============================================================= */
/*  CHAT (styles.css)                                            */
/* ============================================================= */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8f8f8;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.messages::-webkit-scrollbar {
  width: 4px;
}

.messages::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

.msg-row {
  width: 100%;
  max-width: 680px;
  padding: 0 20px;
}

/* Welcome */
.welcome-wrap {
  text-align: center;
  padding: 4px 0;
}

.welcome-icon {
  width: 52px;
  height: 52px;
  background: #1a1a1a;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 14px;
}

.welcome-wrap h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.welcome-wrap p {
  font-size: 13.5px;
  color: #888;
  line-height: 1.75;
  max-width: 420px;
  margin: 0 auto;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.quick-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.quick-card:hover {
  border-color: #bbb;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.qc-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.qc-text {
  font-size: 12.5px;
  color: #666;
  line-height: 1.5;
}

/* Messages */
.msg {
  display: flex;
  gap: 10px;
  animation: fadeUp 0.22s ease;
}

.msg.user {
  flex-direction: row-reverse;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.msg.bot .msg-avatar {
  background: #1a1a1a;
}

.msg.user .msg-avatar {
  background: #e0e0e0;
}

.msg-bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.75;
}

.msg.bot .msg-bubble {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-top-left-radius: 4px;
  color: #1a1a1a;
}

.msg.user .msg-bubble {
  background: #1a1a1a;
  border-top-right-radius: 4px;
  color: #fff;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 10.5px;
  color: #bbb;
}

.msg.user .msg-meta {
  justify-content: flex-end;
}

.model-tag {
  background: #f0f0f0;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  color: #999;
  font-weight: 500;
}

.info-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.info-chip {
  background: #f5f5f5;
  border: 1px solid #e4e4e4;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11.5px;
  color: #666;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.info-chip:hover {
  background: #ebebeb;
  border-color: #ccc;
  color: #1a1a1a;
}

/* Typing */
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  border-top-left-radius: 4px;
  width: fit-content;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ccc;
  animation: blink 1.2s infinite;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Chat Input */
.input-zone {
  padding: 10px 20px 14px;
  background: #f8f8f8;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.input-wrap.chat-wrap,
.input-wrap {
  width: 100%;
  max-width: 680px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 14px;
  padding: 8px 8px 8px 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrap.chat-wrap:focus-within,
.input-wrap:focus-within {
  border-color: #aaa;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #1a1a1a;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.6;
  padding-top: 3px;
}

.chat-input::placeholder {
  color: #ccc;
}

.input-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

.attach-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f5f5f5;
  border: 1px solid #e8e8e8;
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.15s;
}

.attach-btn:hover {
  background: #ebebeb;
  color: #555;
}

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #1a1a1a;
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}

.send-btn:hover {
  background: #333;
}

.input-bottom {
  width: 100%;
  max-width: 680px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

/* ============================================================= */
/*  LOGIN PAGE (login.css)                                       */
/* ============================================================= */

/* content-area wraps the card */
.content-area {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card-header {
  background: #1a1a1a;
  padding: 32px 28px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

/* subtle noise texture on header */
.card-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.logo-wrap {
  width: 60px;
  height: 60px;
  background: #2e2e2e;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1) inset, 0 8px 20px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 1;
  animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-3px);
  }
}

.card-header h2 {
  font-family: 'Tahoma', 'Arial Unicode MS', 'Segoe UI', sans-serif;
  font-size: 21px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.4px;
  position: relative;
  z-index: 1;
}

.card-header p {
  font-size: 13px;
  color: #888;
  text-align: center;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* ── Form body ── */
.form-body {
  padding: 26px 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Labels ── */
.form-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #888;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

/* ── Input refinements ── */
.login-card .input-wrap {
  border: 1.5px solid #ebebeb;
  border-radius: 12px;
  background: #f8f8f8;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  overflow: hidden;
}

.login-card .input-wrap:focus-within {
  border-color: #1a1a1a;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.07);
}

.login-card .form-input {
  background: transparent;
  border: none;
  color: #1a1a1a;
  border-radius: 0;
  padding: 10px 12px 10px 40px;
  font-size: 14px;
  transition: none;
  box-shadow: none !important;
}

.login-card .form-input::placeholder {
  color: #bfbfbf;
  font-size: 13.5px;
}

.login-card .form-input:focus {
  border-color: none;
  background: transparent;
  box-shadow: none;
}

.login-card .input-icon {
  font-size: 15px;
  color: #c8c8c8;
  transition: color 0.2s;
}

.login-card .input-wrap:focus-within .input-icon {
  color: #888;
}

.login-card .toggle-pw {
  color: #c8c8c8;
  font-size: 15px;
}

.login-card .toggle-pw:hover {
  color: #555;
}

/* ── Options row ── */
.options-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: -4px;
}

.forgot-link {
  font-size: 12px;
  color: #bbb;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
  font-weight: 500;
}

.forgot-link:hover {
  color: #1a1a1a !important;
}

/* ── Login button ── */
.btn-login {
  width: 100%;
  padding: 13px;
  background: #1a1a1a;
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.1px;
  transition: all 0.18s;
  margin-top: 2px;
  position: relative;
  overflow: hidden;
}

.btn-login::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
}

.btn-login:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.btn-login:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ── Divider ── */
.divider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: #f0f0f0;
}

.divider-text {
  font-size: 11.5px;
  color: #ccc;
  white-space: nowrap;
}

/* ── Register row ── */
.register-row {
  text-align: center;
  font-size: 13px;
  color: #999;
  padding-bottom: 4px;
}

.register-row a {
  color: #1a1a1a !important;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none !important;
  transition: opacity 0.15s;
}

.register-row a:hover {
  opacity: 0.6;
}

.card-footer {
  padding: 12px 24px 20px;
  text-align: center;
  font-size: 11px;
  color: #ccc;
  border-top: 1px solid #f5f5f5;
}

.remember-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.remember-wrap input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #1a1a1a;
  cursor: pointer;
}

.remember-label {
  font-size: 12.5px;
  color: #666;
}

.role-wrap {
  display: flex;
  gap: 6px;
}

.role-btn {
  flex: 1;
  padding: 9px;
  background: #f5f5f5;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.role-btn:hover {
  background: #ebebeb;
  color: #555;
}

.role-btn.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

/* ============================================================= */
/*  REGISTER PAGE (register.css)                                 */
/* ============================================================= */
.register-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
}

.register-card .card-header {
  padding: 24px 24px 20px;
  gap: 10px;
}

.register-card .logo-wrap {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  font-size: 26px;
}

.register-card .card-header h2 {
  font-size: 19px;
}

.register-card .card-header p {
  font-size: 12.5px;
}

.register-card select {
  width: 100%;
  max-width: 100%;
  /* ให้ยืดเต็มตามขนาดของ .register-card */
  padding: 10px 12px 10px 40px;
  /* เว้นที่ด้านซ้ายให้ไอคอนเหมือนเดิม */
  font-size: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  outline: none;
  box-sizing: border-box;
  /* สำคัญมาก: เพื่อให้ padding ไม่ทำให้ช่องกว้างเกินการ์ด */
  height: 45px;
  /* กำหนดความสูงให้เท่ากันทุกช่อง */
}

/* ปรับแต่ง Dropdown เพิ่มเติมเพื่อให้หน้าตาเหมือนช่องกรอก */
.register-card select {
  appearance: none;
  /* เอาลูกศรเดิมออกเพื่อแต่งใหม่ (ถ้าต้องการ) */
  background-color: #fff;
  cursor: pointer;
}

/* เลือกทั้ง input และ select ที่อยู่ในหน้า register */
.register-card .form-input,
.register-card select.form-input {
  width: 100%;
  padding: 12px 12px 12px 42px;
  /* ด้านซ้ายเว้น 42px เพื่อไม่ให้ทับไอคอน */
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
  background-color: #fff;
  transition: all 0.3s ease;
  box-sizing: border-box;
  /* สำคัญ: ทำให้ขนาดเท่ากันทุกเบราว์เซอร์ */
  appearance: none;
  /* สำหรับ select เพื่อให้โค้งมนเท่ากัน */
}

/* สำหรับ Select (Dropdown) เพิ่มเติมเพื่อความสวยงาม */
.register-card .form-input:focus,
.register-card select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* จัดระยะห่างของกลุ่ม Input ให้เท่ากัน */
.form-group {
  margin-bottom: 15px;
  width: 100%;
}

/* Step indicator */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  border-bottom: 1px solid #f0f0f0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f0f0f0;
  border: 2px solid #e4e4e4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #bbb;
  transition: all 0.2s;
}

.step.active .step-circle {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

.step.done .step-circle {
  background: #555;
  border-color: #555;
  color: #fff;
}

.step-label {
  font-size: 10.5px;
  color: #bbb;
  font-weight: 500;
  white-space: nowrap;
}

.step.active .step-label {
  color: #1a1a1a;
  font-weight: 600;
}

.step.done .step-label {
  color: #555;
}

.step-line {
  height: 1px;
  flex: 1;
  background: #e8e8e8;
  margin-bottom: 18px;
  max-width: 32px;
}

.step-line.done {
  background: #555;
}

.register-card .form-body {
  padding: 20px 24px;
  gap: 14px;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #bbb;
  margin-bottom: -4px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hint-text {
  font-size: 11px;
  color: #bbb;
  padding-left: 2px;
}

.terms-wrap {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px;
  background: #f8f8f8;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  cursor: pointer;
}

.terms-wrap input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #1a1a1a;
  cursor: pointer;
  margin-top: 1px;
  flex-shrink: 0;
}

.terms-text {
  font-size: 12px;
  color: #777;
  line-height: 1.6;
}

.terms-link {
  color: #1a1a1a;
  font-weight: 600;
  cursor: pointer;
}

.btn-row {
  display: flex;
  gap: 8px;
}

.btn-back {
  padding: 11px 18px;
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-back:hover {
  background: #f5f5f5;
}

.btn-next {
  flex: 1;
  padding: 11px;
  background: #1a1a1a;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-next:hover {
  background: #333;
}

.login-row {
  text-align: center;
  font-size: 12.5px;
  color: #888;
  padding: 4px 0 8px;
}

.login-link {
  color: #1a1a1a;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.login-link:hover {
  opacity: 0.6;
}

/* Page visibility (step pages) */
.page {
  display: none;
}

.page.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Result page */
.result-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f7fa;
}

.result-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.icon-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 1.5rem;
}

.result-card.success .icon-circle {
  background: #EAF3DE;
}

.result-card.danger .icon-circle {
  background: #FCEBEB;
}

.result-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.result-card.success .result-title {
  color: #3B6D11;
}

.result-card.danger .result-title {
  color: #A32D2D;
}

.result-sub {
  font-size: 15px;
  color: #666;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.countdown {
  font-size: 13px;
  color: #999;
  margin-bottom: 1.5rem;
}

.countdown span {
  font-weight: 600;
  color: #555;
}

.btn {
  display: inline-block;
  padding: 11px 28px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-success {
  /* ใช้ Gradient ไล่สีเขียวให้ดูมีมิติ และปรับสีข้อความเป็นสีขาวสะอาด */
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: #ffffff;

  /* เพิ่มความกว้างและระยะห่างให้ปุ่มดูสมส่วน */
  padding: 12px 24px;

  /* ลบขอบขาวหนาๆ ออก แล้วเปลี่ยนเป็นลบมุมให้โค้งมนดูทันสมัย */
  border: none;
  border-radius: 8px;

  /* ปรับแต่งฟอนต์ให้อ่านง่ายขึ้น */
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;

  /* ใส่เงาบางๆ ให้ปุ่มลอยเด่นขึ้นมาจากพื้นหลัง */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);

  /* ตั้งค่าให้เวลาเปลี่ยนสีตอนเมาส์ชี้มีความนุ่มนวล (0.2 วินาที) */
  transition: all 0.2s ease-in-out;
}

.btn-success:hover {
  /* ปรับสีให้เข้มขึ้นเล็กน้อยเมื่อชี้ */
  background: linear-gradient(135deg, #27ae60, #219653);

  /* ทำให้ปุ่มขยายขึ้นจึ๋งนึง และเงาเข้มขึ้น ให้ความรู้สึกเหมือนปุ่มกดได้จริง */
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.btn-success:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.btn-danger {
  /* ใช้ Gradient ไล่เฉดสีแดงโทนโมเดิร์น และปรับตัวอักษรเป็นสีขาวเด่นชัด */
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #ffffff;

  /* เพิ่มความกว้างและระยะห่างให้ปุ่มดูสมส่วน */
  padding: 12px 24px;

  /* ลบขอบขาวหนาๆ ออก แล้วเปลี่ยนเป็นลบมุมให้โค้งมนดูทันสมัย */
  border: none;
  border-radius: 8px;

  /* ปรับแต่งฟอนต์ให้อ่านง่ายขึ้น */
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;

  /* ใส่เงาบางๆ ให้ปุ่มลอยเด่นขึ้นมาจากพื้นหลัง */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);

  /* ตั้งค่าให้เวลาเปลี่ยนสีตอนเมาส์ชี้มีความนุ่มนวล (0.2 วินาที) */
  transition: all 0.2s ease-in-out;
}

.btn-danger:hover {
  /* ปรับสีให้เข้มขึ้นเล็กน้อยเมื่อชี้ */
  background: linear-gradient(135deg, #c0392b, #962d22);

  /* ทำให้ปุ่มขยายขึ้นจึ๋งนึง และเงาเข้มขึ้น ให้ความรู้สึกเหมือนปุ่มกดได้จริง */
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.btn-danger:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* ============================================================= */
/*  PROFILE EDIT PAGE (profile_edit.css)                        */
/* ============================================================= */
.content-area {
  flex: 1;
  overflow-y: auto;
  background: #f5f5f5;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 24px 48px;
  min-height: 0;
}

.content-area::-webkit-scrollbar {
  width: 4px;
}

.content-area::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

.content-area form {
  display: contents;
}

.form-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.form-card .card-header {
  padding: 24px 20px 20px;
  gap: 10px;
}

.header-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  position: relative;
  cursor: pointer;
}

.header-avatar-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

.form-card .card-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.2px;
}

.form-body.card-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.file-input-wrap {
  border: 1px solid #e4e4e4;
  border-radius: 20px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s;
}

.file-input-wrap:hover {
  border-color: #aaa;
}

.file-btn {
  background: #f0f0f0;
  border: none;
  border-radius: 12px;
  padding: 4px 12px;
  font-family: inherit;
  font-size: 12px;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
}

.file-name {
  font-size: 13px;
  color: #bbb;
}

.action-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 4px 24px 24px;
}

.btn-save {
  flex: 1;
  padding: 11px;
  background: #1a1a1a;
  border: none;
  border-radius: 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-save:hover {
  background: #333;
}

.btn-cancel {
  flex: 1;
  padding: 11px;
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-cancel:hover {
  background: #f5f5f5;
}

/* ============================================================= */
/*  HISTORY PAGE (history.css)                                   */
/* ============================================================= */
.content-area.history {
  padding: 28px;
  background: #f8f8f8;
  display: block;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
}

.page-sub {
  font-size: 12.5px;
  color: #999;
  margin-top: 2px;
}

.page-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* Search & filter */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: #bbb;
  pointer-events: none;
}

.search-input {
  width: 100%;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  padding: 9px 12px 9px 36px;
  font-family: inherit;
  font-size: 13px;
  color: #1a1a1a;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
  
}

.search-input:focus {
  border-color: #aaa;
}

.search-input::placeholder {
  color: #ccc;
}

.filter-btn {
  padding: 9px 14px;
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
  white-space: nowrap;
}

.filter-btn:hover {
  background: #f5f5f5;
}

.filter-btn.active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.stat-num {
  font-size: 20px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1;
}

.stat-label {
  font-size: 11.5px;
  color: #999;
  margin-top: 2px;
}

/* History table */
.table-wrap {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.table-header {
  display: grid;
  grid-template-columns: 80px 1fr 150px 180px;
  padding: 10px 16px;
  background: #1a1a1a;
  border-bottom: 1px solid #1a1a1a;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.table-header-report {
  display: grid;
  grid-template-columns: 80px minmax(0,1fr) 150px 180px;
  align-items: center;
}

.table-header-his {
  display: grid;
  grid-template-columns: 80px 1fr 150px 180px 120px;
  padding: 10px 16px;
  background: #1a1a1a;
  border-bottom: 1px solid #1a1a1a;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.history-row {
  display: grid;
  grid-template-columns: 80px 1fr 150px 180px 120px;
  padding: 13px 16px;
  border-bottom: 1px solid #f8f8f8;
  align-items: center;
  cursor: pointer;
  transition: background 0.12s;
}

.history-row:last-child {
  border-bottom: none;
}

.history-row:hover {
  background: #fafafa;
}

.report-row {
  display: grid;
  grid-template-columns: 80px minmax(0,1fr) 150px 180px;
  align-items: center;
  width: 100%;
  padding: 13px 16px;
}

.report-row:last-child {
  border-bottom: none;
}

.report-row:hover {
  background: #fafafa;
}

.row-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-name {
  font-size: 13px;
  font-weight: 500;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-preview {
  font-size: 11.5px;
  color: #bbb;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-model {
  font-size: 12px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 5px;
}

.model-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ddd;
  flex-shrink: 0;
}

.row-date {
  font-size: 12px;
  color: #aaa;
}

.row-actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.action-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  color: #bbb;
  transition: all 0.15s;
}

.action-btn:hover {
  background: #f5f5f5;
  color: #555;
}

.action-btn.del:hover {
  background: #fff0f0;
  color: #d44;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #bbb;
}

.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 13.5px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}

.page-info {
  font-size: 12px;
  color: #aaa;
}

.page-btns {
  display: flex;
  gap: 4px;
}

.page-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid #e8e8e8;
  font-size: 12.5px;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.page-btn:hover {
  background: #f5f5f5;
}

.page-btn.active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

/* ============================================================= */
/*  SHARED MODAL                                                 */
/* ============================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
  transform: translateY(12px);
  transition: transform 0.2s;
  overflow: hidden;
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

/* history modal wider */
.modal.wide {
  max-width: 620px;
  max-height: 80vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.modal-title,
.modal-title-text {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.modal-meta {
  font-size: 11.5px;
  color: #aaa;
  margin-top: 2px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #f5f5f5;
  border: none;
  font-size: 15px;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.modal-close:hover {
  background: #ebebeb;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.modal-body::-webkit-scrollbar {
  width: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

/* history chat body */
.modal-body.chat-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8f8f8;
}

.modal-msg {
  display: flex;
  gap: 10px;
}

.modal-msg.user {
  flex-direction: row-reverse;
}

.modal-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.modal-msg.bot .modal-avatar {
  background: #1a1a1a;
}

.modal-msg.user .modal-avatar {
  background: #e0e0e0;
}

.modal-bubble {
  max-width: 80%;
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.75;
}

.modal-msg.bot .modal-bubble {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-top-left-radius: 4px;
  color: #1a1a1a;
}

.modal-msg.user .modal-bubble {
  background: #1a1a1a;
  border-top-right-radius: 4px;
  color: #fff;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.btn-cancel-modal {
  padding: 9px 18px;
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-cancel-modal:hover {
  background: #f5f5f5;
}

.btn-submit,
.btn-continue {
  padding: 9px 22px;
  background: #1a1a1a;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-submit:hover,
.btn-continue:hover {
  background: #333;
}

/* ============================================================= */
/*  COMPLAINT PAGE (complaint.css)                               */
/* ============================================================= */
.btn-new {
  padding: 9px 18px;
  background: #1a1a1a;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s;
}

.btn-new:hover {
  background: #333;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 4px;
  width: fit-content;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.tab {
  padding: 7px 18px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  transition: all 0.15s;
}

.tab:hover {
  color: #1a1a1a;
}

.tab.active {
  background: #1a1a1a;
  color: #fff;
}

/* Complaint cards */
.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.complaint-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 16px 18px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.complaint-card:hover {
  border-color: #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.card-id {
  font-size: 11px;
  color: #bbb;
  font-weight: 500;
}

.card-type {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  background: #f5f5f5;
  color: #666;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.card-preview {
  font-size: 12.5px;
  color: #999;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.card-date {
  font-size: 11.5px;
  color: #bbb;
}

.card-arrow {
  color: #ddd;
  font-size: 18px;
  margin-top: 2px;
}

.status-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 50px;
  /* ทำให้ขอบโค้งมนเป็นทรงแคปซูล */
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}



/* Complaint detail */
.detail-section {
  margin-bottom: 20px;
}

.detail-section-title {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #bbb;
  margin-bottom: 10px;
}

.detail-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.detail-key {
  color: #999;
  width: 110px;
  flex-shrink: 0;
}

.detail-val {
  color: #1a1a1a;
  font-weight: 500;
}

.detail-body {
  background: #f8f8f8;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: #444;
  line-height: 1.7;
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.tl-dot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e0e0e0;
  border: 2px solid #fff;
  outline: 2px solid #e0e0e0;
  flex-shrink: 0;
}

.tl-dot.done {
  background: #1a1a1a;
  outline-color: #1a1a1a;
}

.tl-dot.active {
  background: #2563eb;
  outline-color: #2563eb;
}

.tl-line {
  flex: 1;
  width: 1px;
  background: #e8e8e8;
  margin-top: 4px;
}

.timeline-item:last-child .tl-line {
  display: none;
}

.tl-content {
  flex: 1;
}

.tl-title {
  font-size: 13px;
  font-weight: 500;
}

.tl-date {
  font-size: 11.5px;
  color: #bbb;
  margin-top: 2px;
}

.tl-note {
  font-size: 12px;
  color: #777;
  margin-top: 5px;
  background: #f8f8f8;
  border-radius: 6px;
  padding: 8px 10px;
  line-height: 1.5;
}

/* ============================================================= */
/*  USER REPORT PAGE (user_report.css)                           */
/* ============================================================= */
.content.report {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  background: #f8f8f8;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.content.report::-webkit-scrollbar {
  width: 4px;
}

.content.report::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

.page-header.report {
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.page-title.report {
  font-size: 20px;
}

.page-sub.report {
  font-size: 13px;
  color: #999;
  margin-top: 3px;
}

.page-detail {
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.period-select {
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  padding: 8px 28px 8px 12px;
  font-family: inherit;
  font-size: 13px;
  color: #1a1a1a;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23bbb' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  outline: none;
  appearance: none;
  cursor: pointer;
}

/* Summary */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.sum-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 18px 20px;
}

.sum-icon {
  font-size: 20px;
  margin-bottom: 10px;
}

.sum-value {
  font-size: 28px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1;
}

.sum-label {
  font-size: 12.5px;
  color: #aaa;
  margin-top: 5px;
}

/* Charts */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.chart-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 20px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.chart-sub {
  font-size: 12px;
  color: #bbb;
  margin-bottom: 18px;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 12px;
  color: #666;
  width: 60px;
  text-align: right;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 10px;
  background: #f0f0f0;
  border-radius: 5px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: #1a1a1a;
  border-radius: 5px;
  transition: width 0.6s ease;
}

.bar-val {
  font-size: 12px;
  color: #aaa;
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
}

.donut {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  flex-shrink: 0;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #555;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Activity */
.activity-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 20px;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #f8f8f8;
}

.activity-item:last-child {
  border-bottom: none;
}

.act-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a1a1a;
  margin-top: 5px;
  flex-shrink: 0;
}

.act-dot.light {
  background: #e0e0e0;
}

.act-body {
  flex: 1;
}

.act-text {
  font-size: 13px;
  color: #333;
  line-height: 1.5;
}

.act-text strong {
  font-weight: 500;
}

.act-time {
  font-size: 11.5px;
  color: #bbb;
  margin-top: 2px;
}

.act-model {
  font-size: 11px;
  background: #f5f5f5;
  color: #888;
  border-radius: 5px;
  padding: 2px 7px;
  display: inline-block;
  margin-top: 4px;
}

/* Report table */
.table-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
}

.table-header-row {
  display: grid;
 
  grid-template-columns: 70px 3fr 1fr 1fr;
  padding: 10px 20px;
  background: #1a1a1a;
  border-bottom: 1px solid #1a1a1a;
  font-size: 18px;
  font-weight: 600;
  color: #aaa;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.table-data-row {
  display: grid;
  
  grid-template-columns: 70px 3fr 1fr 1fr;
  padding: 12px 20px;
  border-bottom: 1px solid #f8f8f8;
  align-items: center;
  cursor: pointer;
  transition: background 0.12s;
}

.table-data-row:last-child {
  border-bottom: none;
}

.table-data-row:hover {
  background: #fafafa;
}

.td-num {
  font-size: 12px;
  color: #bbb;
  font-family: monospace;
}

.td-q {
  font-size: 13px;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.td-model {
  font-size: 12px;
  color: #888;
}

.td-date {
  font-size: 12.5px;
  color: #aaa;
}

/* ============================================================= */
/*  COMPLAINT PAGE — ENHANCED STYLES                             */
/*  เพิ่มความสวยงามให้หน้า complaint.php                         */
/* ============================================================= */

/* ── Content Area: ทำพื้นหลังสวยขึ้น ── */
.content-area {
  background: linear-gradient(135deg, #f7f8fc 0%, #f0f2f8 100%);
}

/* ── Page Header ── */
.page-header {
  background: #fff;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #1a1a1a 0%, #444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.4px;
}

.page-sub {
  font-size: 13px;
  color: #aaa;
  margin-top: 3px;
}

.page-detail {
  background: #fff;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

/* ── ปุ่มยื่นข้อร้องเรียนใหม่ ── */
.btn-new {
  padding: 10px 20px;
  background: linear-gradient(135deg, #1a1a1a 0%, #3a3a3a 100%);
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  letter-spacing: 0.2px;
}

.btn-new:hover {
  background: linear-gradient(135deg, #333 0%, #555 100%);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

.btn-new:active {
  transform: translateY(0);
}

/* ── Tabs ── */
.tabs {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 5px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
  margin-bottom: 18px;
}

.tab {
  padding: 8px 20px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: #999;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.tab:hover {
  color: #333;
  background: #f5f5f5;
}

.tab.active {
  background: linear-gradient(135deg, #1a1a1a 0%, #3a3a3a 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ── Complaint Cards ── */
.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.complaint-card {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 14px;
  padding: 18px 20px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  transition: all 0.22s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

/* เส้นสีซ้ายตามสถานะ */
.complaint-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
  background: #e0e0e0;
  transition: background 0.2s;
}

.complaint-card[data-status="inprogress"]::before {
  background: linear-gradient(180deg, #3b82f6, #60a5fa);
}

.complaint-card[data-status="pending"]::before {
  background: linear-gradient(180deg, #f59e0b, #fbbf24);
}

.complaint-card[data-status="done"]::before {
  background: linear-gradient(180deg, #22c55e, #4ade80);
}

.complaint-card:hover {
  border-color: #d0d0d0;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.09);
  transform: translateY(-2px);
}

/* ── Card Info ── */
.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.card-id {
  font-size: 11px;
  color: #c0c0c0;
  font-weight: 600;
  font-family: monospace;
  letter-spacing: 0.3px;
}

.card-type {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: #f0f0f0;
  color: #666;
  letter-spacing: 0.2px;
}

.card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 5px;
  letter-spacing: -0.2px;
}

.card-preview {
  font-size: 12.5px;
  color: #aaa;
  line-height: 1.55;
  display: -webkit-box;
  /* -webkit-line-clamp: 2; */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.card-date {
  font-size: 11.5px;
  color: #c8c8c8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-arrow {
  color: #d0d0d0;
  font-size: 22px;
  font-weight: 300;
  transition: all 0.2s ease;
  line-height: 1;
}

.complaint-card:hover .card-arrow {
  color: #888;
  transform: translateX(3px);
}

/* ── Status Badges — ปรับให้สวยขึ้น ── */
.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-pending {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-pending::before {
  background: #f59e0b;
}

.status-inprogress {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.status-inprogress::before {
  background: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
  animation: pulse-blue 1.5s infinite;
}

.status-done {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-done::before {
  background: #22c55e;
}

@keyframes pulse-blue {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }

  50% {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0);
  }
}

/* ── Modal — ปรับให้สวยขึ้น ── */
.modal {
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
  background: linear-gradient(135deg, #fafafa, #f5f5f5);
  border-radius: 18px 18px 0 0;
}

.modal-title-text {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.3px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #ececec;
  border: none;
  font-size: 14px;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal-close:hover {
  background: #e0e0e0;
  color: #333;
}

/* Form inputs สวยขึ้น */
.form-label {
  font-weight: 600;
  font-size: 14px;
  color: #4b5563;
  margin-bottom: 4px;
  display: block;
}

.form-input,
.form-select,
.form-textarea {
  border: 1.5px solid #eaeaea;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  transition: all 0.2s ease;
  background: #fafafa;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: #888;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
}

/* ── ปุ่มใน Modal ── */
.btn-submit {
  padding: 10px 24px;
  background: linear-gradient(135deg, #1a1a1a 0%, #3a3a3a 100%);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.btn-submit:hover {
  background: linear-gradient(135deg, #333 0%, #555 100%);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

.btn-cancel-modal {
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-cancel-modal:hover {
  background: #f0f0f0;
}

/* ── Detail Section ── */
.detail-section {
  background: #fafafa;
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.detail-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #bbb;
  margin-bottom: 12px;
}

.detail-row {
  display: flex;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 13px;
  align-items: center;
}

.detail-key {
  color: #bbb;
  width: 110px;
  flex-shrink: 0;
  font-size: 12.5px;
}

.detail-val {
  color: #1a1a1a;
  font-weight: 600;
}

.detail-body {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 13px;
  color: #555;
  line-height: 1.8;
}

/* ── Timeline ── */
.tl-dot.done {
  background: #1a1a1a;
  outline-color: #1a1a1a;
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
}

.tl-dot.active {
  background: #3b82f6;
  outline-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  animation: pulse-tl 1.8s infinite;
}

@keyframes pulse-tl {

  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
  }
}

.tl-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.tl-note {
  background: linear-gradient(135deg, #fafafa, #f5f5f5);
  border: 1px solid #eeeeee;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  color: #777;
  line-height: 1.55;
  margin-top: 6px;
}

/* ── Toast ── */
#toast {
  background: linear-gradient(135deg, #1a1a1a, #333);
  border-radius: 12px;
  padding: 11px 22px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  letter-spacing: 0.2px;
}

/* ── Sidebar active nav-item ── */
.nav-item:has(span.active) {
  background: #f0f0f0;
  color: #1a1a1a;
  font-weight: 600;
}

/* ── Scrollbar ── */
.content-area::-webkit-scrollbar {
  width: 5px;
}

.content-area::-webkit-scrollbar-thumb {
  background: #d8d8d8;
  border-radius: 5px;
}

.content-area::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

#Contenthis {
  width: 100%;
  max-width: 100%;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  margin: 2%;
}

#TxttopHis {
  margin-top: 1%;
  margin-left: 1%;
}

.form-input-TxtHis {
  width: 70%;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  padding: 10px 14px 10px 38px;
  font-family: 'Tahoma', 'Arial Unicode MS', 'Segoe UI', sans-serif;
  font-size: 13.5px;
  color: #1a1a1a;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin: 20px;
}


/* =============================================================
   CHAT PAGE (index.php) — Redesigned Chat UI
   ============================================================= */

/* ── Chat Wrapper (ครอบทั้ง messages + input) ── */
.chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(160deg, #f7f8fc 0%, #eef0f8 100%);
  min-height: 0;
}

/* ── Messages Scroll Area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #d5d8ec;
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #b0b4d8;
}

/* ── Message Rows ── */
.chat-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  animation: chatFadeUp 0.28s ease forwards;
}

.chat-row--user {
  flex-direction: row-reverse;
  animation: chatSlideLeft 0.25s ease forwards;
}

@keyframes chatFadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chatSlideLeft {
  from {
    opacity: 0;
    transform: translateX(16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Chat Bubbles ── */
.chat-bubble {
  padding: 12px 18px;
  font-size: 13.5px;
  line-height: 1.85;
  word-break: break-word;
  font-family: 'Tahoma', 'Arial Unicode MS', 'Segoe UI', sans-serif;
  max-width: 72%;
}

/* User bubble */
.chat-bubble--user {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 18px rgba(79, 70, 229, 0.30);
}

/* AI bubble */
.chat-bubble--ai {
  background: #fff;
  color: #1a1a1a;
  border-radius: 4px 18px 18px 18px;
  border: 1px solid #e4e7f2;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  position: relative;
  padding-left: 22px;
}

.chat-bubble--ai::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  background: linear-gradient(180deg, #4f46e5, #7c3aed);
  border-radius: 0 3px 3px 0;
}

/* ── AI Avatar ── */
.chat-ai-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1a1a1a 0%, #3a3a3a 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
  font-family: 'Tahoma', sans-serif;
}

/* ── Empty / Welcome State ── */
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  padding: 60px 20px;
  text-align: center;
  animation: chatFadeUp 0.4s ease forwards;
}

.chat-empty-icon {
  font-size: 48px;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: linear-gradient(135deg, #f0f1ff, #e8eafe);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.12);
  margin-bottom: 4px;
}

.chat-empty-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.3px;
}

.chat-empty-sub {
  font-size: 13px;
  color: #a0a4bc;
  line-height: 1.6;
  max-width: 300px;
}

/* ── Input Zone ── */
.chat-input-zone {
  padding: 14px 24px 18px;
  background: #fff;
  border-top: 1px solid #eaecf4;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* ── Input Form ── */
.chat-form {
  width: 100%;
  max-width: 760px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f4f5fb;
  border: 1.5px solid #e2e5f0;
  border-radius: 999px;
  padding: 8px 8px 8px 22px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chat-form:focus-within {
  border-color: #a5a8e0;
  background: #fff;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.12);
}

/* ── Text Input ── */
.chat-text-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13.5px;
  color: #1a1a1a;
  font-family: 'Tahoma', 'Arial Unicode MS', 'Segoe UI', sans-serif;
  padding: 5px 0;
  line-height: 1.6;
  min-width: 0;
}

.chat-text-input::placeholder {
  color: #b0b4cc;
}

/* ── Send Button ── */
.chat-send-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  border: none;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(79, 70, 229, 0.38);
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 5px 18px rgba(79, 70, 229, 0.48);
}

.chat-send-btn:active {
  transform: scale(0.94);
}

/* ── Hint Text ── */
.chat-input-hint {
  font-size: 11px;
  color: #c0c4d8;
  text-align: center;
  letter-spacing: 0.1px;
}

/* =============================================================
   CHAT PAGE FIXES & ENHANCEMENTS — index.php
   แก้ไข layout ให้แสดงผลได้ถูกต้องและเพิ่มความสวยงาม
   ============================================================= */

/* ── Fix: ให้ body ใช้ flex column เต็มหน้าจอ ── */
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Fix: .main ต้องกิน space ที่เหลือหลัง topbar ── */
.main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ── Fix: sidebar ความสูงเต็ม ── */
.sidebar {
  height: 100%;
  overflow-y: auto;
}

/* ── Fix: chat-wrapper เต็มพื้นที่ที่เหลือ ── */
.chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  /* พื้นหลังสวยด้วย gradient mesh */
  background:
    radial-gradient(ellipse at 20% 20%, rgba(79, 70, 229, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(124, 58, 237, 0.05) 0%, transparent 50%),
    linear-gradient(160deg, #f7f8fc 0%, #eef0f8 100%);
}

/* ── Fix: chat-messages scroll area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
  min-height: 0;
}

/* ── Enhance: scrollbar ── */
.chat-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #c7caef, #a5a8e0);
  border-radius: 10px;
}

/* ── Enhance: chat-row centered & responsive ── */
.chat-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  animation: chatFadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.chat-row--user {
  flex-direction: row-reverse;
}

/* ── Enhance: user bubble — indigo gradient ── */
.chat-bubble--user {
  background: linear-gradient(135deg, #4f46e5 0%, #6d28d9 100%);
  color: #fff;
  border-radius: 20px 20px 5px 20px;
  box-shadow:
    0 4px 20px rgba(79, 70, 229, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.1) inset;
  padding: 13px 20px;
  font-size: 14px;
  line-height: 1.8;
  max-width: 68%;
  word-break: break-word;
  font-family: 'Tahoma', 'Arial Unicode MS', 'Segoe UI', sans-serif;
  letter-spacing: 0.1px;
}

/* ── Enhance: AI bubble — clean glass card ── */
.chat-bubble--ai {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #1e1e2e;
  border-radius: 5px 20px 20px 20px;
  border: 1px solid rgba(99, 102, 241, 0.15);
  box-shadow:
    0 2px 16px rgba(0, 0, 0, 0.07),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  padding: 14px 20px 14px 24px;
  font-size: 14px;
  line-height: 1.85;
  max-width: 72%;
  word-break: break-word;
  font-family: 'Tahoma', 'Arial Unicode MS', 'Segoe UI', sans-serif;
  position: relative;
  overflow: hidden;
}

/* accent bar ซ้าย */
.chat-bubble--ai::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  background: linear-gradient(180deg, #4f46e5, #a78bfa);
  border-radius: 0 3px 3px 0;
}

/* subtle shimmer top border */
.chat-bubble--ai::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.25), transparent);
}

/* ── Enhance: AI Avatar ── */
.chat-ai-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1e1e2e 0%, #312e81 100%);
  color: #a5b4fc;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 14px rgba(79, 70, 229, 0.3),
    0 0 0 1.5px rgba(165, 180, 252, 0.2) inset;
  font-family: 'Tahoma', sans-serif;
  flex-shrink: 0;
}

/* ── Enhance: Empty state ── */
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 12px;
  padding: 60px 20px;
  text-align: center;
  animation: chatFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.chat-empty-icon {
  font-size: 40px;
  width: 84px;
  height: 84px;
  border-radius: 24px;
  background: linear-gradient(135deg, #eef0ff 0%, #e0e2ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 8px 32px rgba(79, 70, 229, 0.14),
    0 0 0 1px rgba(99, 102, 241, 0.12);
  margin-bottom: 8px;
  position: relative;
}

/* pulse ring */
.chat-empty-icon::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 30px;
  border: 1.5px solid rgba(99, 102, 241, 0.18);
  animation: pulseRing 2.5s ease-in-out infinite;
}

@keyframes pulseRing {

  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }

  50% {
    opacity: 0;
    transform: scale(1.06);
  }
}

.chat-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e1e2e;
  letter-spacing: -0.4px;
}

.chat-empty-sub {
  font-size: 13.5px;
  color: #9ca3c0;
  line-height: 1.65;
  max-width: 280px;
}

/* ── Enhance: Input zone ── */
.chat-input-zone {
  padding: 14px 20px 18px;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid rgba(99, 102, 241, 0.1);
  box-shadow:
    0 -8px 32px rgba(79, 70, 229, 0.05),
    0 -1px 0 rgba(99, 102, 241, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ── Enhance: chat-form pill input ── */
.chat-form {
  width: 100%;
  max-width: 740px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f4f5fb;
  border: 1.5px solid #e2e6f5;
  border-radius: 999px;
  padding: 8px 8px 8px 22px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.06);
}

.chat-form:focus-within {
  border-color: #818cf8;
  background: #fff;
  box-shadow:
    0 0 0 3px rgba(99, 102, 241, 0.12),
    0 4px 20px rgba(79, 70, 229, 0.10);
}

/* ── Enhance: text input ── */
.chat-text-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  color: #1e1e2e;
  font-family: 'Tahoma', 'Arial Unicode MS', 'Segoe UI', sans-serif;
  padding: 5px 0;
  line-height: 1.6;
  min-width: 0;
}

.chat-text-input::placeholder {
  color: #b0b5d0;
}

/* ── Enhance: send button ── */
.chat-send-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  border: none;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 4px 14px rgba(79, 70, 229, 0.40),
    0 1px 0 rgba(255, 255, 255, 0.15) inset;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.50);
}

.chat-send-btn:active {
  transform: scale(0.93);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

/* ── Enhance: hint text ── */
.chat-input-hint {
  font-size: 11px;
  color: #b8bdd8;
  text-align: center;
  letter-spacing: 0.1px;
}

/* ── Enhance: sidebar nav-item active state ── */
.sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
}

.nav-item.active {
  background: linear-gradient(135deg, #eef0ff, #e8eafe);
  color: #4f46e5;
  font-weight: 600;
  border-left: 2.5px solid #4f46e5;
}

.nav-item.active .nav-icon {
  filter: none;
}

/* ── Enhance: new-chat button ── */
.new-chat-btn {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  border: none;
  box-shadow: 0 3px 12px rgba(79, 70, 229, 0.28);
  transition: all 0.2s;
}

.new-chat-btn:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(79, 70, 229, 0.36);
}

/* ── Keyframes ── */
@keyframes chatFadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* เพิ่มต่อท้ายหรือแทนที่ส่วนที่เกี่ยวข้องกับ Messages ใน styles.css */

.msg {
  display: flex;
  gap: 12px;
  animation: fadeUp 0.3s ease;
  margin-bottom: 10px;
}

/* จัดฝั่งผู้ใช้ไว้ทางขวา */
.msg.user {
  flex-direction: row-reverse;
}

/* ตกแต่ง Avatar */
.msg-avatar {
  width: 35px;
  height: 35px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
  flex-shrink: 0;
}

.msg.bot .msg-avatar {
  background: #1a1a1a;
  color: #fff;
}

.msg.user .msg-avatar {
  background: #4f46e5;
  color: #fff;
}

/* สีม่วงน้ำเงินเด่นๆ */

/* ตกแต่ง Bubble ข้อความ */
.msg-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  position: relative;
}

/* กล่องข้อความ AI */
.msg.bot .msg-bubble {
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-top-left-radius: 4px;
  color: #1a1a1a;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

/* กล่องข้อความผู้ใช้ */
.msg.user .msg-bubble {
  background: #4f46e5;
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

/* Animation ตอนข้อความขึ้น */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ปรับปรุงโซนพิมพ์ข้อความ */
.chat-input-zone {
  padding: 20px;
  background: #fff;
  border-top: 1px solid #eee;
}

.chat-form {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  background: #f3f4f6;
  padding: 8px 12px;
  border-radius: 15px;
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  outline: none;
  font-size: 14px;
  resize: none;
}

.send-btn {
  padding: 10px 20px;
  background-color: #1a1a1a;
  /* สีดำตามธีมหน้าเว็บ */
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  /* ป้องกันปุ่มเบี้ยวหรือตัวอักษรตกบรรทัด */
  transition: opacity 0.2s;
}

.send-btn:hover {
  opacity: 0.8;
}

.logtxt a {
  font-size: 18px;
  color: white;
  text-decoration: none;
  /* แถม: เอาเส้นใต้ล่างออกถ้าไม่ต้องการ */
}

.h1-chat {
  /* 1. กำหนดเฉดสีตามไฮไลท์เดิมของคุณ */
    background: linear-gradient(45deg, #3b82f6, #ec4899); 
    
    /* 2. สั่งให้สีพื้นหลังทะลุมาแสดงเฉพาะบนตัวอักษร */
    -webkit-background-clip: text;
    background-clip: text;
    
    /* 3. ทำให้สีเนื้อตัวอักษรเดิมโปร่งใส เพื่อให้สี Gradient ข้างหลังแสดงขึ้นมา */
    -webkit-text-fill-color: transparent;
    color: transparent;
    
    /* ปรับขนาดหรือสไตล์เพิ่มเติมได้ตามต้องการ */
    font-size: 3rem; 
    font-weight: bold;
    margin-bottom: 10px;
}

.h1-his {
  /* 1. กำหนดเฉดสีตามไฮไลท์เดิมของคุณ */
    background: rgba(63, 29, 12); 
    
    /* 2. สั่งให้สีพื้นหลังทะลุมาแสดงเฉพาะบนตัวอักษร */
    -webkit-background-clip: text;
    background-clip: text;
    
    /* 3. ทำให้สีเนื้อตัวอักษรเดิมโปร่งใส เพื่อให้สี Gradient ข้างหลังแสดงขึ้นมา */
    -webkit-text-fill-color: transparent;
    color: transparent;
    
    /* ปรับขนาดหรือสไตล์เพิ่มเติมได้ตามต้องการ */
    font-size: 3rem; 
    font-weight: bold;
    margin-bottom: 10px;
}

.h2-chat {
  color: #555;
  font-weight: 400;
}

.container {
  padding: 12%;
  background-color: #a5a8e0;
  margin: 20%;
}

.table-wrap {
  width: 100%;
  /* ให้ตารางกว้าง 100% ของพื้นที่ */
  max-width: 100%;
  /* border-collapse: separate; */
  /* border-spacing: 0 8px; */
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
}

.table-wrap th,
.table-wrap td {
  text-align: left;
  /* จัดข้อความชิดซ้าย (หรือใช้ center ตามต้องการ) */
  padding: 15px 20px;
  /* เพิ่มระยะห่างขอบด้านในเพื่อให้ตรงกันสวยงาม */
  vertical-align: middle;
  /* จัดให้อยู่กึ่งกลางแนวตั้ง */
}

/* ถ้าต้องการให้บาง Column เช่น ลำดับ หรือ วันที่ อยู่กึ่งกลาง */
.table-wrap th:first-child,
.table-wrap td:first-child {
  text-align: center;
  width: 80px;
}

/* .table-header { */
/* display: grid; */
/* 1. ลำดับ: กว้างคงที่ 80px 
       2. หัวข้อ: ใช้ 1fr (ให้กว้างที่สุดเท่าที่จะทำได้)
       3. โมเดล: กว้างคงที่ 150px
       4. วันที่: กว้างคงที่ 180px
    */
/* grid-template-columns: 80px 1fr 150px 180px; 
    padding: 12px 20px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    font-weight: bold;
    align-items: center; */
/* } */

/* .history-row { */
/* display: grid; */
/* !!! ต้องใช้ค่าเดียวกับ .table-header เพื่อให้คอลัมน์ตรงกันเป๊ะ !!! */
/* grid-template-columns: 80px 1fr 150px 180px;  */
/* padding: 15px 20px;
    border-bottom: 1px solid #f1f3f5;
    align-items: center;
    transition: background 0.2s; */
/* } */

/* จัดให้ข้อความในคอลัมน์ "หัวข้อการสนทนา" ตัดคำสวยๆ ถ้ามันยาวเกินไป */
.history-row td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  /* แสดง ... ถ้าข้อความยาวเกิน */
  white-space: nowrap;
  /* ไม่ให้ขึ้นบรรทัดใหม่ */
  padding-right: 20px;
  /* เว้นระยะห่างก่อนถึงคอลัมน์ถัดไป */
}

/* .history-row:last-child { border-bottom: none; } */
/* .history-row:hover { background: #fafafa; } */

.search-form {
  margin-bottom: 25px;
  display: flex;
  /* ทำให้เนื้อหาในฟอร์มยืดหยุ่น */
}

.search-group {
  display: flex;
  /* จัด input และ button ขนานกัน */
  gap: 8px;
  /* ระยะห่างระหว่างช่องกับปุ่ม */
  width: 100%;
  max-width: 800px;
  /* !!! ปรับตรงนี้เพื่อกำหนดความสั้น-ยาวของช่องค้นหา !!! */
}

.search-input {
  flex: 1;
  /* ให้ช่อง input ขยายเต็มพื้นที่ของ 400px ที่เราตั้งไว้ */
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  /* ขอบมน */
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.search-input:focus {
  border-color: #3498db;
  /* เปลี่ยนสีขอบเมื่อคลิกพิมพ์ */
}


.model-badge {
  background-color: #e8f4fd;
  color: #3498db;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  display: inline-block;
}

/* ตกแต่งวันที่ให้ดูจางลงเล็กน้อย */
.date-text {
  color: #95a5a6;
  font-size: 13px;
}

.content-areahis {
  flex: 1;
  /* สำคัญ: สั่งให้ส่วนนี้ยืดจนสุดหน้าจอ */
  padding: 40px;
  /* เว้นระยะห่างจากขอบให้สวยงาม */
  background: linear-gradient(160deg, #f7f8fc 0%, #eef0f8 100%);
  /* สีพื้นหลังอ่อนๆ ให้สบายตา */
  /* min-height: 100vh; */
  box-sizing: border-box;
}

.content-areahis h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  color: #2c3e50;
  margin-bottom: 20px;
  font-weight: 600;
}

.content-areahistory {
  flex: 1;                 /* 👈 บังคับให้ยืดเต็มพื้นที่ที่เหลืออยู่ฝั่งขวา */
  width: 100%;             /* 👈 ยืดให้เต็มขอบ */
  padding: 30px;
  background-color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  margin: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;        /* ป้องกันตัวตารางดันกล่องขาวทะลุหน้าจอ */
}
.content-areahistory h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  color: #2c3e50;
  margin-bottom: 20px;
  font-weight: 600;
}

/* ส่วนควบคุมการแบ่งหน้า */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding: 15px 0;
}

.pagination-info {
  color: #95a5a6;
  font-size: 14px;
}

.pagination-buttons {
  display: flex;
  gap: 5px;
}

.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 35px;
  height: 35px;
  padding: 0 8px;
  border: 1px solid #e0e6ed;
  border-radius: 8px;
  background-color: #fff;
  color: #34495e;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}

.page-btn:hover:not(.disabled) {
  background-color: #f8f9fa;
  border-color: #3498db;
  color: #3498db;
}

.page-btn.active {
  background-color: #888;
  /* สีดำตามรูปตัวอย่าง */
  color: #fff;
  border-color: #888;
}

.page-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.form-input2 {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 48px;
  padding: 0 12px 0 42px;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

/* select ต้องมีพื้นที่ด้านขวาสำหรับลูกศร dropdown */
select.form-input2 {
  padding-right: 36px;
  /* background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); */
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

/* ช่องที่ไม่มีไอคอน */
.form-input2.no-icon {
  padding-left: 14px;
}

.form-input2::placeholder {
  color: #ccc;
}

.form-input2:disabled {
  background: #fafafa;
  color: #bbb;
  cursor: not-allowed;
}

.btn-print {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(29, 78, 216, 0.2);
}

.btn-print:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(29, 78, 216, 0.3);
  background: linear-gradient(135deg, #2563eb, #1e40af);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  color: #444444;
  border: 1px solid #ddd;
  padding: 10px;
  width: 100%;
  border-radius: 4px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  margin-top: 15px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.btn-google:hover {
  background-color: #f7f7f7;
}

.btn-google img {
  width: 20px;
  margin-right: 10px;
}

/* 🟢 สไตล์เพิ่มเติมสำหรับจุดสามจุดกำลังโหลดข้อมูล (Typing Indicator) */
.dot-flashing {
  display: inline-block;
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 5px;
  background-color: #888;
  color: #888;
  animation: dot-flashing 1s infinite linear alternate;
  animation-delay: .5s;
}
.dot-flashing::before, .dot-flashing::after {
  content: '';
  display: inline-block;
  position: absolute;
  top: 0;
}
.dot-flashing::before {
  left: -12px;
  width: 6px;
  height: 6px;
  border-radius: 5px;
  background-color: #888;
  color: #888;
  animation: dot-flashing 1s infinite linear alternate;
  animation-delay: 0s;
}
.dot-flashing::after {
  left: 12px;
  width: 6px;
  height: 6px;
  border-radius: 5px;
  background-color: #888;
  color: #888;
  animation: dot-flashing 1s infinite linear alternate;
  animation-delay: 1s;
}
@keyframes dot-flashing {
  0% { background-color: #888; }
  50%, 100% { background-color: #ddd; }
}
.loading-container {
  display: flex;
  align-items: center;
  padding: 10px 15px;
}

.alert-error{
  background:#fee2e2; color:#b91c1c; border:1px solid #fca5a5;
  border-radius:8px; padding:10px 14px; margin:10px;
  font-size:0.9rem; text-align:center;
}

/* 🟢 สไตล์สำหรับดีไซน์โครงสร้าง Card Layout */
.card-grid-cp {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
  margin-bottom: 20px;
}

.complaint-card-cp {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  border: 1px solid #eef2f5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.complaint-card-cp::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(to bottom, #8b5cf6, #3b82f6);
  }

.complaint-card-cp:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0,0,0,0.08);
}
.card-top-cp {
  display: flex;
  justify-content: flex-start; /* 💡 ปรับให้องค์ประกอบทั้งหมดมาเรียงชิดเริ่มจากฝั่งซ้าย */
  align-items: flex-start;
  margin-bottom: 15px;
}
/* .card-index-cp {
  font-size: 0.85rem;
  font-weight: bold;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;

  margin-right: 12px; 
} */

.card-index-cp {
  background: #f3e8ff;
  color: #6b21a8;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: inline-block;
}
.card-body-cp {
  font-size: 1rem;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 20px;
  word-break: break-word;
  flex-grow: 1;
  text-align: center;
}
.card-footer-cp {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
  font-size: 0.85rem;
  color: #64748b;
}
.card-date-cp {
  display: flex;
  align-items: center;
  gap: 5px;
}
/* คลาสตกแต่งป้ายสถานะเพิ่มเติมเพื่อให้เข้ากับรูปทรงแบบการ์ด */
.status-badge-cp {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.status-pending { background: #fef3c7; color: #d97706; }
.status-inprogress { background: #dbeafe; color: #2563eb; }
.status-done { background: #dcfce7; color: #16a34a; }
/* 💡 เพิ่มสไตล์ขอบสีหนาด้านซ้ายแยกตามสถานะข้อร้องเรียน */
/* 1. สำหรับการ์ดที่อยู่สถานะ รอดำเนินการ (Pending) */
.complaint-card-cp[data-status="pending"] {
    border-left: 6px solid #845300; /* สีส้ม/เหลือง */
}
/* 2. สำหรับการ์ดที่อยู่สถานะ กำลังดำเนินการ (In Progress) */
.complaint-card-cp[data-status="inprogress"] {
    border-left: 6px solid #00245e; /* สีน้ำเงิน */
}
/* 3. สำหรับการ์ดที่อยู่สถานะ เสร็จสิ้น (Done) */
.complaint-card-cp[data-status="done"] {
    border-left: 6px solid #15803d; /* สีเขียว */
}
.no-data-card-cp {
  grid-column: 1 / -1;
  background: #fff;
  text-align: center;
  padding: 40px;
  border-radius: 12px;
  color: #64748b;
  border: 1px dashed #cbd5e1;
}

.delete-btn{cursor: pointer; background-color: #ff4d4d; color: white; border: none; padding: 5px 10px; border-radius: 4px;}

.delete-btn-action {
    background-color: #ffe6e6;
    color: #e63946;
    border: 1px solid #ffccd5;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
}

.delete-btn-action:hover {
    background-color: #e63946;
    color: #ffffff;
    border-color: #e63946;
    box-shadow: 0 2px 5px rgba(230, 57, 70, 0.2);
}

.model-selector-zone {
      width: 100%;
      max-width: 760px;       /* 👈 บังคับให้กว้างเท่ากับ .chat-form เสมอเพื่อจัดแนวขอบ */
      margin-bottom: 8px;     /* เว้นระยะห่างด้านล่างก่อนถึงแถวกล่องข้อความ */
      text-align: left;       /* สั่งให้ Dropdown ชิดซ้ายของพื้นที่ */
}
.model-select {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background-color: #fff;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
.model-select:focus {
    border-color: #7d70e5; /* สีไฮไลต์ตอนคลิกเลือกโมเดล */
}

.not-data{
  text-align:center; padding: 40px; color: #a0aec0;
}

.table-container-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 15px;
}

.table-container-responsive table {
  width: 100%;
  min-width: 800px; /* 👈 กำหนดความกว้างขั้นต่ำของตารางไว้ เพื่อให้เวลามือถือหรือจอเล็กเปิด จะเกิดแถบเลื่อนขึ้นเฉพาะที่ตาราง */
  border-collapse: collapse;
}

/* ตกแต่งปุ่มชื่อผู้ใช้ให้เหมือนในรูปภาพ */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none; /* ป้องกันการคลุมดำตัวอักษรตอนรัวคลิก */
}

.dropdown-btn:hover {
    background-color: #333333;
}

.arrow-down {
    font-size: 10px;
    color: #ffb703;
    transition: transform 0.2s; /* เพิ่มแอนิเมชันตอนหมุนลูกศร */
}

/* ส่วนของเมนูที่จะลิสต์ลงมา */
.dropdown-content {
    display: none; /* ซ่อนไว้เป็นค่าเริ่มต้น */
    position: absolute;
    right: 0;
    background-color: #ffffff;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    border-radius: 8px;
    z-index: 1000;
    margin-top: 5px;
    overflow: hidden;
}

/* ลิงก์ภายในเมนู */
.dropdown-content a {
    color: #333333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.dropdown-content a.logout-link:hover {
    background-color: #ffe5e5;
    color: #d90429;
}

/* Class พิเศษที่จะถูกสั่งเปิดปิดด้วย JavaScript */
.dropdown-content.show {
    display: block;
}

/* หมุนลูกศรชี้ขึ้นเมื่อเมนูกางออก */
.user-dropdown.active .arrow-down {
    transform: rotate(180deg);
}

/* คลาสที่ใช้สั่งให้แสดงผลเมื่อมีการคลิก */
.user-dropdown .dropdown-content.show {
    display: block !important; 
    opacity: 1;
    visibility: visible;
}

.content-complaint {
  display:flex; 
  align-items:center; 
  gap:16px; 
  flex-wrap:wrap; 
  margin-bottom:8px;
}
.cm-detail {
  color: #475569; font-size: 13px; line-height: 1.5; width: 100%; text-align: center;margin-top: 5px;
}
.modal-content {
  background: #fff; 
  padding: 25px; 
  border-radius: 15px; 
  width: 500px; 
  margin: 10% auto; 
  position: relative; 
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.close-btn{
  position: absolute; right: 20px; top: 15px; cursor: pointer; font-size: 24px; color: #666;
}

.badge-model {
      padding: 4px 12px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: bold;
      text-transform: lowercase;
      display: inline-block;
      background-color: #e0f2fe;
      color: #0284c7;
}
.liked-answer-card{
  background-color:  rgba(255, 255, 255, 0.92);
  border:1px solid #e0e0e0; 
  border-radius:12px; 
  padding:14px 16px; 
  margin-bottom:14px; 
}

.flike{
  font-size:13px; color:#888; margin-bottom:20px;
}

.chat-actions{
  margin-top:6px; display:flex; justify-content:space-between; align-items:center;
}

.like-btn{height:25px;width: 25px;background: none; border: none; cursor: pointer;}
.img-heart{height : 20px; width: 20px;}
