/* ==============================
   RESET + BASE
============================== */
* {
  box-sizing: border-box;
  font-family: "Prompt", sans-serif;
}
body {
  margin: 0;
  color: #111827;
  min-height: 100vh;
  background:#f5f5f5
}

/* ==============================
   LAYOUT
============================== */
.container {
  max-width: 1600px;
  margin: 32px auto;
  padding: 28px 32px;

  /* look & feel */
  background: #ffffff;
  border-radius: 18px;

  /* soft depth */
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.05),
    0 2px 6px rgba(0, 0, 0, 0.04);

  /* subtle border */
  border: 1px solid #f1f1f1;
}

.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0,0,0,.06);
  padding: 24px;
}

/* ==============================
   HEADER / NAV
============================== */
.header {
  background: #fb7701;
  color: #fff;
  padding: 16px 24px;
}
.header .brand {
  font-size: 20px;
  font-weight: 600;
}
.nav a {
  color: #fff;
  margin-right: 16px;
  text-decoration: none;
  opacity: 0.9;
}
.nav a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ==============================
   FORM
============================== */
.section-title{
  position: relative;
  margin-bottom: 24px;
}

/* เส้นส้ม */
.section-title::before{
  content:"";
  position:absolute;
  left:0;
  top:50%;
  transform:translateY(-50%);
  width:4px;
  height:20px;
  background:#f97316;
  border-radius:2px;
}

/* ชิดขวา */
.section-title.right{
  display:flex;
  align-items:center;
  padding: 0px 0px 0px 20px;
  justify-content:flex-start;
  gap:10px;              /* ระยะห่างเส้น ↔ ข้อความ */
}

/* หัวข้อ */
.section-title h2{
  margin:0;
  font-size:20px;
  font-weight:600;
  padding: 10px;
  color:#333;
}


h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
}
.row {
  display: flex;
  gap: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.field {
  flex: 1;
  min-width: 260px;
}
label {
  font-weight: 500;
  margin-bottom: 6px;
  display: block;
}
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  margin: 2px 0px 2px 0px;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #fb7701;
  box-shadow: 0 0 0 2px rgba(251,119,1,0.15);
}
textarea { min-height: 120px; }

.radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ==============================
   BUTTON
============================== */
.btn {
  border: none;
  padding: 12px 28px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px;
}
.btn-primary {
  margin: 10px;
  background: #fb7701;
  color: #fff;
}
.btn-primary:hover {
  background: #e96600;
}
.btn-danger {
  background: #dc2626;
  color: #fff;
}

/* ==============================
   TABLE (Manager / Admin)
============================== */
.dashboard {
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 20px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,.05);
}

.card h3 {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.card .number {
  font-size: 34px;
  font-weight: bold;
  margin-top: 10px;
}

.table-box {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,.05);
}
.table {
  width: 100%;
  border-collapse: collapse;
}
thead{
background:#e97816;
}
th {
  padding: 10px;
  text-align: center;
  font-size: 14px;
  color: #ffffff;
  padding-bottom: 10px;
}

td {
  padding: 12px 0;
  text-align: center;
  border-bottom: 1px solid #f1f1f1;
}

.status-box {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

/* ==============================
   SIGNATURE
============================== */
.signature-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 20px;
}

@media (max-width: 1200px) {
  .signature-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .signature-row {
    grid-template-columns: 1fr;
  }
}
/* ==============================
   SIGNATURE (STANDARD)
============================== */

.signature-box {
  border: 1px solid #fde2cf;
  padding: 16px;
  border-radius: 12px;
  background: #fffaf6;
}

.signature-title {
  font-weight: 500;
  margin-bottom: 8px;
  color: #333;
  text-align: center;
}

.signature-preview {
  width: 100%;
  height: 120px;              /* ✅ ขนาดตายตัว */
  border: 1px dashed #fb7701;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  overflow: hidden;
}

.signature-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;        /* ⭐ สำคัญ */
}


/* ==============================
   STATUS
============================== */
.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
}
.badge-wait {
  background: #fff3e6;
  color: #fb7701;
}
.badge-ok {
  background: #dcfce7;
  color: #166534;
}
.badge-doing {
  background: #ffedd5;
  color: #9a3412;
}

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 900px) {
  .signature-row { grid-template-columns: 1fr; }
}

/* LEFT : LOGO */
.navbar-left {
  display: flex;
  align-items: center;
  padding-left: 4px;             /* ขยับโลโก้เข้ามาเล็กน้อย */
}

.navbar-logo {
  height: 34px;                  /* ใกล้ภาพจริง */
  width: auto;
}


/* CENTER : MENU */
.navbar-menu {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);

  display: flex;
  align-items: center;
  gap: 32px;
}

/* RIGHT : LOGIN / USER */
.navbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding-right: 4px;            /* ขยับ login เข้ามา */
}
.navbar-menu a {
  color: #333;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  padding-bottom: 4px;
  transition: color 0.2s ease;
}

/* hover / active */
.navbar-menu a:hover,
.navbar-menu a.active {
  color: #fb7701;
}

/* เส้นใต้แบบ modern */
.navbar-menu a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: #fb7701;
  transition: width 0.25s ease;
}

.navbar-menu a:hover::after,
.navbar-menu a.active::after {
  width: 100%;
}

.navbar-user {
  font-size: 14px;
  color: #333;
}

/* ออกจากระบบ */
.btn-logout {
  font-size: 14px;
  color: #fb7701;
  text-decoration: none;
  font-weight: 500;
}

.btn-logout:hover {
  text-decoration: underline;
}

@media (max-width: 1024px) {
  .navbar-menu {
    position: static;
    transform: none;
    margin: 0 auto;
  }
}
.navbar-menu a.active {
  color: #fb7701;
  font-weight: 600;
}

.navbar-menu a.active::after {
  width: 100%;
}

.navbar-menu a.active {
  text-shadow: 0 0 0.01px currentColor; /* เพิ่มความคม */
}
.navbar-menu a:hover {
  color: #fb7701;
}

.navbar-menu a.active:hover {
  color: #fb7701; /* คงสีเดิม */
}

/* ==============================
   LOGIN (Modern & Friendly)
============================== */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(180deg, #fff7ed, #ffffff);
}

.login-box {
  background: #ffffff;
  width: 100%;
  max-width: 420px;
  padding: 42px 40px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,.08);
  animation: fadeUp .4s ease;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-box h2 {
  text-align: center;
  margin-bottom: 28px;
  color: #fb7701;
  font-size: 26px;
  font-weight: 700;
}

/* INPUT */
.login-box input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 16px;
  font-size: 15px;
  transition: all .2s ease;
  background: #fafafa;
}

.login-box input::placeholder {
  color: #9ca3af;
}

.login-box input:focus {
  outline: none;
  background: #ffffff;
  border-color: #fb7701;
  box-shadow: 0 0 0 3px rgba(251,119,1,.18);
}

/* BUTTON */
.login-box button {
  width: 100%;
  background: linear-gradient(135deg, #fb7701, #ff8c1a);
  color: #ffffff;
  border: none;
  padding: 15px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s ease;
  box-shadow: 0 8px 18px rgba(251,119,1,.35);
}

.login-box button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(251,119,1,.45);
}

.login-box button:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(251,119,1,.3);
}

/* REGISTER LINK */
.login-box .register-link {
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
  color: #6b7280;
}

.login-box .register-link a {
  color: #fb7701;
  font-weight: 600;
  text-decoration: none;
}

.login-box .register-link a:hover {
  text-decoration: underline;
}

/* MOBILE */
@media (max-width: 480px) {
  .login-box {
    padding: 36px 24px;
    border-radius: 16px;
  }

  .login-box h2 {
    font-size: 22px;
  }
}
/* INPUT WITH ICON */
.input-group {
  position: relative;
  margin-bottom: 16px;
}

.input-group input {
  width: 100%;
  padding: 14px 44px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  font-size: 15px;
  background: #fafafa;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: .6;
}

.toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  opacity: .6;
}

.toggle-password:hover {
  opacity: 1;
}

/* BUTTON LOADING */
.login-btn {
  width: 100%;
  margin-top: 6px;
  background: linear-gradient(135deg, #fb7701, #ff8c1a);
  color: #fff;
  border: none;
  padding: 15px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.btn-loading {
  display: none;
}

.login-btn.loading .btn-text {
  display: none;
}

.login-btn.loading .btn-loading {
  display: inline;
}

/* TEXT */
.text-center {
  text-align: center;
}

.register-text {
  margin-top: 18px;
  font-size: 14px;
}

.register-text a {
  color: #fb7701;
  font-weight: 600;
  text-decoration: none;
}

.register-text a:hover {
  text-decoration: underline;
}


.input-group {
  position: relative;
  margin-bottom: 16px;
}

.input-group input {
  width: 100%;
  padding: 14px 44px 14px 44px; /* เว้นที่ให้ icon ซ้าย */
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  font-size: 15px;
  background: #fafafa;
}

.input-group input:focus {
  outline: none;
  background: #ffffff;
  border-color: #fb7701;
  box-shadow: 0 0 0 3px rgba(251,119,1,.18);
}

/* ICON IMAGE */
.input-icon-img {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 64px;
  height: 64px;
}

/* TOGGLE PASSWORD */
.toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 16px;
  opacity: .6;
}
.toggle-password:hover {
  opacity: 1;
}




.error {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 16px;
  text-align: center;
}

.success {
  background: #dcfce7;
  color: #166534;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 16px;
  text-align: center;
}

.register-link {
  text-align: center;
  margin-top: 18px;
  font-size: 14px;
  color: #6b7280;
}

.register-link a {
  color: #fb7701;
  font-weight: 600;
  text-decoration: none;
}

.register-link a:hover {
  text-decoration: underline;
}

.footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: #6b7280;
}

/* ==============================
   REGISTER (OFFICE)
============================== */

/* ใช้โครงเดียวกับ login */
.register-box {
  background: #fff;
  width: 100%;
  max-width: 520px;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

/* ใช้ h2 เดิม แค่ปรับระยะ */
.register-box h2 {
  margin-bottom: 20px;
}

/* tabs ใช้ style เดียวกับระบบ */
.register-tabs {
  display: flex;
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #fde2cf;
}

.register-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  background: #fff;
  color: #9a3412;
}

.register-tab.active {
  background: #fb7701;
  color: #fff;
}

/* tab content */
.register-tab-content {
  display: none;
  margin-top: 12px;
}
.register-tab-content.active {
  display: block;
}

/* canvas ลายเซ็น */
.register-canvas {
  width: 100%;
  height: 160px;
  border: 2px dashed #fb7701;
  border-radius: 8px;
  background: #fff;
}

/* ปุ่มลบลายเซ็น */
.btn-clear-sign {
  margin-top: 10px;
  background: #374151;
  color: #fff;
}
.btn-clear-sign:hover {
  background: #1f2937;
}

/* error */
.register-error {
  color: #dc2626;
  font-size: 13px;
  margin-top: 8px;
}
/* ==============================
   REGISTER SIGNATURE SPACING
============================== */

.register-signature {
  margin-top: 30px;        /* ระยะห่างจากฟิลด์ด้านบน */
}

.register-signature label {
  margin-bottom: 10px;
}

/* ระยะห่างระหว่าง label กับ tabs */
.register-tabs {
  margin-top: 12px;
  margin-bottom: 16px;
}

/* กล่องลายเซ็น */
.register-tab-content {
  padding: 12px;
  background: #fffaf6;
  border: 1px solid #fde2cf;
  border-radius: 12px;
}
/* ===============================
   Manager Action Buttons
================================ */
.action-bar {
  margin-top: 28px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.action-bar form {
  margin: 0;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-success {
  background: linear-gradient(135deg, #28a745, #218838);
  color: #fff;
}

.btn-success:hover {
  background: linear-gradient(135deg, #218838, #1e7e34);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: #fff;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #c82333, #bd2130);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #e9ecef;
  color: #333;
}

.btn-secondary:hover {
  background: #dee2e6;
}

.btn-outline {
  background: transparent;
  border: 1px solid #ccc;
  color: #666;
}

.btn-outline:hover {
  background: #f8f9fa;
}

/* ===== APPROVE BAR ===== */
.approve-bar{
  display:flex;
  gap:16px;
  align-items:center;
  justify-content:flex-start;
  margin:20px 0 30px;
}

.approve-form{
  margin:0;
}

/* ===== PILL BUTTON ===== */
.btn-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 20px;
  border-radius:999px;
  font-size:16px;
  font-weight:600;
  border:none;
  cursor:pointer;
  text-decoration:none;
  transition:all .2s ease;
}

/* APPROVE */
.btn-approve{
  background:#e8f9f0;
  color:#16a34a;
}
.btn-approve:hover{
  background:#16a34a;
  color:#fff;
}

/* REJECT */
.btn-reject{
  background:#feecec;
  color:#dc2626;
}
.btn-reject:hover{
  background:#dc2626;
  color:#fff;
}

/* BACK */
.btn-back{
  background:#f1f1f1;
  color:#6b7280;
}
.btn-back:hover{
  background:#6b7280;
  color:#fff;
}

/* ===== ICON ACTION BAR ===== */
.approve-bar{
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:flex-end;
  margin:20px 0 30px;
}

/* ===== ICON BUTTON ===== */
.icon-btn{
  width:42px;
  height:42px;
  border-radius:50%;
  border:2px solid transparent;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:18px;
  cursor:pointer;
  background:#fff;
  transition:.25s;
  text-decoration:none;
}

/* approve */
.icon-btn.approve{
  border-color:#16a34a;
  color:#16a34a;
}
.icon-btn.approve:hover{
  background:#16a34a;
  color:#fff;
}

/* reject */
.icon-btn.reject{
  border-color:#dc2626;
  color:#dc2626;
}
.icon-btn.reject:hover{
  background:#dc2626;
  color:#fff;
}

/* back */
.icon-btn.back{
  border-color:#ccc;
  color:#555;
}
.icon-btn.back:hover{
  background:#f3f3f3;
}

/* ===== STATUS BOX ===== */
.status-box{
  display:inline-flex;
  flex-direction:column;
  align-items:flex-start;
  padding:6px 14px;
  border-radius:14px;
  font-size:13px;
  line-height:1.3;
  min-width:110px;
}

/* text */
.status-text{
  font-weight:600;
}

/* time */
.status-time{
  font-size:11px;
  opacity:.75;
  margin-top:2px;
}

/* colors */
.status-box.pending{
  background:#fff4e6;
  color:#d97706;
}

.status-box.approved{
  background:#e7f8ef;
  color:#15803d;
}

.status-box.rejected{
  background:#fdecec;
  color:#b91c1c;
}
/* ===== STATUS BOX ===== */
.status-box{
  display:inline-flex;
  padding:6px 14px;
  border-radius:14px;
  font-size:13px;
  font-weight:600;
}
.status-box.pending{background:#fff4e6;color:#d97706;}
.status-box.approved{background:#e7f8ef;color:#15803d;}
.status-box.rejected{background:#fdecec;color:#b91c1c;}

/* ===== SUB ROW ===== */
.sub-row td{
  padding:10px 18px 14px;
  background:#fff;
  border-bottom:1px solid #f1f1f1;
}

/* ===== APPROVED INFO ===== */
.approved-info{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;

  font-size:13px;
  color:#f97316;

  padding-right: 12px;   /* เว้นจากขอบขวา */
}
.calendar-icon img{
  width:40px;
  height:40px;
  display:block;
}
.approved-date{font-weight:500;
color: #333;}
.approved-text{font-weight:600;}

/* popup */
.popup-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.45);
  display:none;
  z-index:9000;
}

.popup-overlay.show{
  display:block;
z-index:800;
}
.popup-box{
  background:#fff;
  padding:20px;
  border-radius:10px;
  width:320px;
  text-align:center;
}
/* ===== ACTION ICON ===== */
.icon-action{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin:0 6px;
}

.icon-action img{
  width:32px;
  height:32px;
  display:block;
  transition:.2s ease;
}

.icon-action:hover img{
  transform: scale(1.1);
  opacity:.85;
}
/* ===== ADMIN ACTION BAR ===== */
.admin-action-bar{
  display:flex;
  align-items:center;
  gap:16px;
  margin:24px 0 32px;
}

/* ===== STATUS SELECT ===== */
.status-select{
  flex:1;
  height:48px;
  padding:0 16px;
  font-size:15px;
  border-radius:14px;

  border:2px solid #fb7701;
  background:#fff;

  appearance:none;
  outline:none;
  transition:.25s;
}

.status-select:focus{
  box-shadow:0 0 0 3px rgba(251,119,1,.15);
}

/* ===== SAVE BUTTON ===== */
.status-select.approved{ border-color:#16a34a; }
.status-select.rejected{ border-color:#dc2626; }
.status-select.submitted{ border-color:#fb7701; }

.btn-save{
  height:48px;
  padding:0 26px;
  border-radius:999px;
  border:none;

  background:#e9f8ef;
  color:#15803d;

  font-size:15px;
  font-weight:600;
  cursor:pointer;
  transition:.25s;
}

.btn-save:hover{
  background:#d1fae5;
}

/* ===== BACK BUTTON ===== */
.btn-back{
  height:30px;
  padding:0 22px;
  border-radius:999px;
  background:#fb7701;
  color:#fff;
  display:flex;
  align-items:center;
  gap:6px;

  text-decoration:none;
  font-size:15px;
  font-weight:500;
  transition:.25s;
}

.btn-back:hover{
    background:#f7a762;

}

.card-section {
  margin-top:20px;
  padding-top:12px;
  border-top:1px solid #eee;
}
.form-inline {
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.info-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:8px;
}
.muted {
  color:#888;
}

/* Mobile */
@media (max-width: 480px) {
  .footer-inner {
    gap: 4px;
  }
}
/* ===== Timeline Wrapper ===== */
.timeline {
  position: relative;
  margin-top: 16px;
  padding-left: 28px;
  border-left: 2px solid #e5e7eb; /* gray-200 */
}

/* ===== Timeline Item ===== */
.timeline-item {
  position: relative;
  margin-bottom: 28px;
  padding-left: 12px;
}

/* ===== Dot ===== */
.timeline-item::before {
  content: '';
  position: absolute;
  left: -36px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d1d5db; /* gray-300 */
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px #e5e7eb;
}

/* ===== Status Colors ===== */
.timeline-item.done::before {
  background: #fb7701;
  box-shadow: 0 0 0 2px #eba569;
}

.timeline-item.current::before {
  background: #3b82f6; /* blue-500 */
  box-shadow: 0 0 0 3px #bfdbfe;
}

.timeline-item.waiting::before {
  background: #9ca3af; /* gray-400 */
}

/* ===== Content ===== */
.timeline-item .content {
  background: #f9fafb;
  border-radius: 8px;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
}

/* ===== Title ===== */
.timeline-item strong {
  display: block;
  font-size: 0.95rem;
  color: #fb7701;
  margin-bottom: 2px;
}

/* ===== Time ===== */
.timeline-item .time {
  font-size: 0.8rem;
  color: #6b7280;
}

/* ===== Description ===== */
.timeline-item .desc {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 2px;
}

/* ===== Muted ===== */
.muted {
  color: #9ca3af;
  font-style: italic;
}
.pagination {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.pagination a {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  color: #374151;
  text-decoration: none;
  font-size: 14px;
  transition: .2s;
}

.pagination a:hover {
  background: #fb7701;
  color: #fff;
  border-color: #fb7701;
}

.pagination a.active {
  background: #fb7701;
  color: #fff;
  border-color: #fb7701;
  font-weight: 600;
}

/* ================= NAVBAR ================= */
.navbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 28px;
  background:#fff;
  border-bottom:1px solid #eee;
  position:sticky;
  top:0;
  z-index:1000;
}
.navbar-left img{height:42px;}
.navbar-menu a{
  margin:0 14px;
  text-decoration:none;
  color:#374151;
  font-weight:500;
}

/* ================= NOTIFICATION ================= */
.noti-wrapper {
  position: relative;
  margin-right: 16px;
}

/* ===== NOTI BUTTON (วงกลมเทา) ===== */
.noti-btn {
  width: 48px;
  height: 48px;
  background: #f3f4f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background .2s ease, box-shadow .2s ease;
}

.noti-btn:hover {
  background: #e5e7eb;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* icon */
.noti-icon {
  width: 32px;
  height: 32px;
  display: block;
  opacity: .85;
}

/* ===== BADGE ===== */
.noti-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ===== POPUP ===== */
/* ================= POPUP BASE ================= */
.popup {
  opacity: 0;
  transform: translateY(-8px) scale(.96);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  position: absolute;
  z-index: 9999;
}

/* เปิด popup */
.popup.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.noti-popup{
  position:absolute;
  top:56px;
  right:0;

  width:360px;
  max-height:420px;

  background:#fff;
  border-radius:16px;
  box-shadow:0 20px 40px rgba(0,0,0,.18);

  overflow:hidden;

  opacity:0;
  transform:translateY(-8px);
  pointer-events:none;
  transition:.18s;

  z-index:9999;
}
.noti-popup.show{
  opacity:1;
  transform:translateY(0);
  pointer-events:auto;
}
.user-popup {
  top: 70px;
  right: 24px;
  width: 300px;
  background: #1f1f1f;
  color: #fff;
  position: fixed;    
   width: 320px;
  background: linear-gradient(180deg, #222 0%, #1b1b1b 100%);
  border-radius: 18px;
  box-shadow: 0 24px 48px rgba(0,0,0,.45);
  overflow: hidden;
  z-index: 9999;          /* 🔒 ล็อกไม่เลื่อน */

}

@keyframes fadeScale {
  from { opacity: 0; transform: translateY(-6px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== HEADER ===== */
.noti-header {
  padding: 14px 16px;
  font-weight: 600;
  border-bottom: 1px solid #eee;
}

/* ===== LIST ===== */
.noti-list {
  max-height: 420px;
  overflow-y: auto;
}

.noti-empty {
  padding: 24px;
  text-align: center;
  color: #9ca3af;
}

/* ===== ITEM ===== */
.noti-item {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: #111;
  border-bottom: 1px solid #f1f1f1;
  transition: background .15s ease;
}

.noti-item:hover {
  background: #f9fafb;
}

/* ยังไม่อ่าน */
.noti-item.unread {
  background: #fff7ed;
  font-weight: 600;
}

/* อ่านแล้ว */
.noti-item.read {
  background: #fff;
  color: #6b7280;
}

/* text */
.noti-title {
  font-weight: 600;
  font-size: 14px;
}

.noti-msg {
  font-size: 13px;
  color: #555;
  margin-top: 2px;
}

.noti-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

/* ================= USER ================= */
.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.avatar {
  width: 40px;
  height: 40px;
  background: #fb7701;
  color: #fff;
  border-radius: 50%;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar.big {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fb7701;
  color: #fff;
  font-weight: 700;
  font-size: 20px;

  display: flex;
  align-items: center;
  justify-content: center;
}
/* ================= POPUP BASE ================= */
.popup {
  opacity: 0;
  transform: translateY(-8px) scale(.96);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.popup.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.user-popup-header {
  display: flex;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-name {
  font-size: 16px;
  font-weight: 600;
  color: #fb7701;
}
.user-popup-menu {
  list-style: none;
  margin: 0;
  padding: 8px;
}
.user-email {
  font-size: 13px;
  color: #cbd5e1;
}
.user-role {
  font-size: 12px;
  color: #9ca3af;
  text-transform: uppercase;
}
.user-department {
  font-size: 12px;
  color: #9ca3af;
  text-transform: uppercase;
}
.user-popup-menu li {
  border-radius: 10px;
}

.user-popup-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: #e5e7eb;
  text-decoration: none;
  font-size: 14px;
  border-radius: 10px;

  transition: background .15s ease, color .15s ease;
}

.user-popup-menu li:hover a {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.user-popup-menu li.danger a {
  color: #f87171;
}

.user-popup-menu li.danger:hover a {
  background: rgba(239,68,68,.15);
}

.profile-page {
  max-width: 900px;
  margin: auto;
}

.profile-page {
  max-width: 900px;
  margin: auto;
}

.profile-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  font-weight: 500;
}

.tab-btn.active {
  background: #fb7701;
  color: #fff;
  border-color: #fb7701;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.card1 {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
}

.signature-preview img {
  max-height: 80px;
  margin-top: 8px;
}

.btn-primary {
  background: #fb7701;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  margin: 10px 0px 0px 0px;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
}

.signature-preview {
  margin-top: 12px;
  min-height: 120px;
  border: 1px dashed #fb7701;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.signature-preview img {
  max-height: 100px;
}

.signature-preview .placeholder {
  color: #9ca3af;
  font-size: 14px;
}

#loadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-box {
    background: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #eee;
    border-top: 5px solid #ff7a00;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.assign-bar {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 16px 0;
}

/* ===== SELECT ===== */

.assign-select {
  width: 260px;
  height: 140px;

  padding: 8px;
  border-radius: 10px;
  border: 1px solid #ddd;

  font-size: 14px;
  background: #fff;
}

/* ===== BUTTON GROUP ===== */

.assign-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== PRIMARY BUTTON ===== */

.btn-assign {
  background: #2e7d32;
  color: #fff;
  border: none;

  padding: 10px 16px;
  border-radius: 8px;

  font-size: 14px;
  font-weight: 600;

  cursor: pointer;
  transition: .2s;
}

.btn-assign:hover {
  background: #1b5e20;
}

/* ===== REJECT BUTTON ===== */

.btn-reject-soft {
  background: #f5f5f5;
  color: #d32f2f;
  border: 1px solid #eee;

  padding: 10px 16px;
  border-radius: 8px;

  font-size: 14px;
  cursor: pointer;
}

.btn-reject-soft:hover {
  background: #fdecea;
}
/* ===== MOBILE ===== */

.hamburger{
  display:none;
  font-size:24px;
  cursor:pointer;
}

/* MOBILE MENU */
@media(max-width:768px){

  .hamburger{display:block}
  .navbar-menu{
    position:fixed;
    top:0;
    left:-260px;
    width:260px;
    height:100%;
    background:#fff;
    flex-direction:column;
    padding:80px 20px;
    gap:18px;
    transition:.3s;
    box-shadow:2px 0 10px rgba(0,0,0,.2);
  }

  .navbar-menu.show{
    left:0;
  }

  .menu-overlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.4);
    display:none;
    z-index:900;
  }

  .menu-overlay.show{
    display:block;
  }
 .avatar{
    width:44px;
    height:44px;
    font-size:20px;
  }

  .user-name{
    font-size:16px;
  }

}
/* ======================================
   TABLE PC (ปกติ)
====================================== */

.request-table{
  width:100%;
  border-collapse:collapse;
}

.request-table th{
  background:#e97813;
  color:#fff;
  padding:14px;
  text-align:left;
}

.request-table td{
  padding:14px;
  border-bottom:1px solid #eee;
}


/* ======================================
   MOBILE → CARD
====================================== */

@media (max-width:768px){

  /* ===== NOTI POPUP ===== */
  .noti-popup{
    position:fixed;
    top:80px;
    left:50%;
    transform:translateX(-50%);
    width:92vw;
    max-width:420px;
  }

  .noti-popup.show{
    transform:translateX(-50%);
  }

  /* ===== TABLE CARD MODE ===== */

  .request-table thead{
    display:none;
  }

  .request-table,
  .request-table tbody,
  .request-table tr,
  .request-table td{
    display:block;
    width:100%;
  }

  /* ===== CARD ===== */
  .request-table tr{
    background:#fff;
    margin-bottom:18px;
    padding:18px;
    border-radius:18px;
    box-shadow:0 8px 22px rgba(0,0,0,.08);
  }

  /* ===== DATA ROW ===== */
  .request-table td{
    border:none;
    padding:10px;
    display:flex;
    justify-content:flex-start;
    align-items:center;
    font-size:16px;
    color:#616161;
  }

  .request-table td::before{
    content:attr(data-label);
    font-weight:600;
    padding-right:10px;
    color:#000;
  }

  /* ===== STATUS ===== */
  .status-box{
    font-size:13px;
  }

  /* ===== ACTION FOOTER ===== */
  .action-cell{
    width:100%;
    display:flex;
    justify-content:flex-end;
    align-items:center;
    gap:10px;
    margin-top:14px;
    padding-top:14px;
    border-top:1px solid #eee;
  }

  .action-cell::before{
    display:none;
  }

  /* ===== ICON BUTTON ===== */
  .icon-action{
    width:46px;
    height:46px;
    border-radius:14px;
    background:#f5f5f5;
    display:flex;
    align-items:center;
    justify-content:center;
  }

  .icon-action img{
    width:22px;
    height:22px;
    opacity:.85;
  }
}
.hip-popup{
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgba(0,0,0,0.5);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.hip-popup-box{
  width:420px;
  background:#fff;
  border-radius:10px;
  box-shadow:0 10px 30px rgba(0,0,0,0.3);
  animation:popupFade .25s ease;
}

.hip-popup-header{
  padding:16px;
  font-size:18px;
  font-weight:600;
  border-bottom:1px solid #eee;
}

.hip-popup-body{
  padding:20px;
  font-size:15px;
  color:#333;
  line-height:1.6;
}

.hip-popup-footer{
  padding:15px;
  text-align:right;
  border-top:1px solid #eee;
}

.hip-popup-footer button{
  background:#0d6efd;
  color:#fff;
  border:none;
  padding:8px 18px;
  border-radius:6px;
  cursor:pointer;
}

.hip-popup-footer button:hover{
  background:#0b5ed7;
}

@keyframes popupFade{
  from{
    transform:scale(.9);
    opacity:0;
  }
  to{
    transform:scale(1);
    opacity:1;
  }
}

