:root {
  --primary: #1a1f5e;
  --primary-dark: #11164a;
  --purple: #7c3aed;
  --indigo: #4338ca;
  --green: #059669;
  --red: #dc2626;
  --orange: #d97706;

  --bg: #f0f2f8;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;

  --purple-soft: #ede9fe;
  --purple-xsoft: #f5f3ff;
  --green-soft: #d1fae5;
  --red-soft: #fee2e2;
  --orange-soft: #fef3c7;

  --sidebar-w: 240px;
  --header-h: 65px;
  --radius: 12px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(124, 58, 237, 0.12);

  /* Sale — เขียว */
  --sale:        #25A385;
  --sale-hover:  #1D948A;
  --sale-soft:   #E6F7F2;
  --sale-border: #B7E4D8;
  --sale-text:   #0F4F43;
}

/* =========================================================*/
/* BASE                                                     */
/* =========================================================*/
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Noto Sans Thai", sans-serif;
  background: var(--bg);
  color: var(--gray-900);
  font-size: 14px;
  line-height: 1.5;
}
/* ========================================================= */
/* LAYOUT                                                    */
/* ========================================================= */ 


.app {
  display: flex;
  min-height: 100vh;
}

.main-area {
  margin-left: var(--sidebar-w);
  min-width: 0;
  min-height: 100vh;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.content {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
}

/* =========================================================
   SIDEBAR
========================================================= */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 900;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--sale) 0%, var(--sale-hover) 100%);
  box-shadow: 6px 0 20px rgba(17, 24, 39, 0.14);
}

/* LOGO */
.sidebar-logo {
  width: 100%;
  min-height: 120px;
  padding: 28px 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  flex-shrink: 0;
  text-align: center;
}

.sidebar-logo::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
}

.sidebar-logo-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--primary);
  font-weight: 800;
}

.sidebar-logo-circle img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.sidebar-logo-circle img:not([src]),
.sidebar-logo-circle img[style*="display: none"] {
  display: none;
}

.sidebar-brand-title {
  margin-top: 4px;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.sidebar-brand-sub {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

/* MENU */
.nav-section {
  flex: 1;
  padding: 34px 0;
  overflow-y: auto;
}

/* menu item */
.nav-item {
  min-height: 42px;
  margin: 4px 0;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}

/* icon */
.nav-item .material-symbols-outlined,
.nav-item .nav-icon {
  width: 22px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 18px;
  text-align: center;
  transition: color 0.2s ease;
}

/* hover */
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item:hover .material-symbols-outlined,
.nav-item:hover .nav-icon {
  color: #ffffff;
}

/* active menu — แบบในรูปตัวอย่าง */
.nav-item.active {
  background: linear-gradient(
    90deg,
    rgba(221, 254, 255, 0.42),
    rgba(218, 253, 250, 0.18)
  );
  color: #ffffff;
  font-weight: 700;
}

/* white active bar */
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #ffffff;
}

.nav-item.active .material-symbols-outlined,
.nav-item.active .nav-icon {
  color: #ffffff;
}

/* badge */
.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--red);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
}

/* USER */
.sidebar-user {
  margin: 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-user .user-name {
  color: #fff;
}

.sidebar-user .user-role {
  color: rgba(255, 255, 255, 0.62);
}

/* =========================================================
   TOPBAR
========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 800;
  height: var(--header-h);
  padding: 0 24px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--gray-200);
}

.topbar-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar-title {
  margin: 0;
  color: var(--gray-900);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
}

.topbar-subtitle {
  color: var(--gray-500);
  font-size: 12px;
  line-height: 1.2;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-900);
  font-size: 13px;
  font-weight: 700;
}


.notif-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gray-100);
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}

.notif-btn:hover {
  background: var(--purple-soft);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
}

/* =========================================================
   COMMON UI
========================================================= */
.page {
  display: none;
  animation: fadeIn 0.2s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  margin-bottom: 16px;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-head h3 {
  color: var(--gray-900);
  font-size: 14px;
  font-weight: 700;
}

.card-body {
  padding: 20px;
}

.step-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-300);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-role {
  font-size: 11px;
}


/* =========================================================
/*  REQUEST PREVIEW CARD
/* ========================================================= */

.detail-preview-card {
  max-width: 980px;
  margin: 0 auto 22px;
}

.detail-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.request-card {
  background: #fff;
  border-radius: 18px;
  padding: 24px 28px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.request-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.request-top h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.request-body {
  display: grid;
  grid-template-columns:1fr 1fr;
  gap: 36px;
  align-items: start;
}

.group-title {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
}

.info-grid {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
  position: relative;
}

.info-grid .label {
  color: #94a3b8;
  font-size: 13px;
  white-space: nowrap;
}

.info-grid strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  word-break: break-word;
}

.text-red {
  color: #ef4444 !important;
}



/* .timeline-box {
  padding-left: 6px;
   max-width: 260px;
  margin: 0 auto;
}

.timeline-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 28px;
  position: relative;
}

.timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 30px;
  width: 2px;
  height: calc(100% + 2px);
  background: #e5e7eb;
}

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

.timeline-item .dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  z-index: 1;
}

.timeline-item.done .dot {
  background: #10b981;
  color: #fff;
}

.timeline-item.active .dot {
  background: #f59e0b;
  color: #fff;
}

.timeline-item.wait .dot {
  background: #e5e7eb;
  color: #94a3b8;
}

.timeline-item strong {
  display: block;
  font-size: 14px;
  color: #111827;
  margin-bottom: 3px;
}

.timeline-item small {
  font-size: 12px;
  color: #94a3b8;
} */




.approval-progress{
    position:relative;
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    margin-top:24px;
    padding:0 40px;
}

.progress-line{
    position:absolute;
    top:18px;
    left:70px;
    right:70px;
    height:3px;
    background:#e5e7eb;
}

.progress-step{
    position:relative;
    z-index:2;
    text-align:center;
    width:120px;
}

.step-dot{
    width:36px;
    height:36px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    margin:0 auto 10px;
    font-weight:700;
}

.done .step-dot{
    background:#10b981;
    color:#fff;
}

.active .step-dot{
    background:#f59e0b;
    color:#fff;
}

.wait .step-dot{
    background:#e5e7eb;
    color:#94a3b8;
}

.step-label{
    font-size:13px;
    font-weight:700;
}










.request-footer {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px dashed #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.creator {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-mini {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #7c3aed;
  color: #fff;
  font-weight: 800;
}

.creator strong {
  display: block;
  font-size: 14px;
  color: #111827;
}

.creator small {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

/* tablet */
@media (max-width: 900px) {
  .request-body {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .info-grid {
    grid-template-columns: 70px 1fr;
  }
}


/* =========================================================
   APPROVAL FLOW
========================================================= */
.approval-flow-card {
  margin-bottom: 22px;
  padding: 28px 34px;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 14px 35px rgba(17, 24, 39, 0.12);
}

.flow-steps {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  position: relative;
}

.flow-steps::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 16.5%;
  right: 16.5%;
  height: 3px;
  background: var(--gray-300);
  z-index: 0;
}

.flow-step {
  position: relative;
  z-index: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}


.flow-step.done::before,
.flow-step.active::before {
  display: block;
}

.flow-step:first-child::before {
  display: none;
}

.flow-step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  background: var(--gray-100);
  color: var(--gray-400);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
}

.flow-step.active .flow-step-num {
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.15);
}

.flow-step.done .flow-step-num,
.flow-step.active .flow-step-num {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}


.flow-step-sub {
  margin-top: -5px;
  color: var(--gray-400);
  font-size: 14px;
}

.flow-step::before {
  content: "";
  position: absolute;
  top: 15px;
  left: -48%;
  width: 100%;
  height: 3px;
  background: var(--green);
  z-index:-1;
  display: none;
}

/* =========================================================
   FORM
========================================================= */
.form-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.form-full {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--gray-500);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.required {
  color: var(--red);
}

.field-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  outline: none;
  background: var(--white);
  color: var(--gray-900);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.field-input.has-icon {
  padding-right: 36px;
}

select.field-input {
  cursor: pointer;
}

textarea.field-input {
  height: 90px;
  resize: none;
}

.input-wrap,
.amount-input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  color: var(--gray-400);
  font-size: 15px;
  pointer-events: none;
  transform: translateY(-50%);
}

.amount-input-wrap .field-input {
  padding-right: 48px;
  color: var(--gray-900);
  font-size: 15px;
  font-weight: 700;
}

.amount-unit {
  position: absolute;
  right: 12px;
  top: 50%;
  color: var(--gray-400);
  font-size: 13px;
  font-weight: 500;
  transform: translateY(-50%);
}

.char-count {
  margin-top: 3px;
  color: var(--gray-400);
  font-size: 11px;
  text-align: right;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #334155;
  cursor: pointer;
  font-size: 14px;
}

.checkbox-item input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ========================================================= */
/* SIGNATURE                                                 */
/* ========================================================= */
.sig-container {
  overflow: hidden;
  position: relative;
  border: 1.5px dashed var(--gray-300);
  border-radius: 10px;
  background: var(--gray-50);
  transition: border-color 0.15s;
}

.sig-container:hover {
  border-color: var(--purple);
}

.sig-canvas {
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.sig-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  color: var(--gray-300);
  font-size: 13px;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, -50%);
}

.sig-hint.hidden {
  display: none;
}

.sig-info {
  padding: 8px 14px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sig-name-text {
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 500;
}

.sig-date-text {
  color: var(--gray-400);
  font-size: 12px;
}

.note-tip {
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--sale-soft);
  border-radius: 8px;
  background: #f2f5f4;
  color: var(--green);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  font-weight: 500;
}

.topbar-title-wrap{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.topbar-title{
  font-size:22px;
  font-weight:700;
  color:var(--gray-900);
  line-height:1.2;
}

.topbar-subtitle{
  font-size:12px;
  color:var(--gray-500);
  line-height:1;
}



/* ========================================================= */
/* BUTTONS                                                   */
/* ========================================================= */
.btn {
  padding: 9px 20px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--green);
  color: #fff;
}

.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-outline {
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-700);
}

.btn-outline:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.btn-ghost {
  border: 1.5px solid var(--gray-200);
  background: transparent;
  color: var(--gray-500);
}

.btn-ghost:hover {
  border-color: var(--red);
  color: var(--red);
}

.btn-sm {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
}

.btn-row {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
 

.sidebar-user {
  margin: 8px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);

  display: flex;
  align-items: center;
  gap: 10px;
}

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

.user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.user-role {
  color: rgba(255,255,255,.7);
  font-size: 11px;
}

.sidebar-logout {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;

  transition: .2s;
}

.sidebar-logout:hover {
  background: rgba(255,255,255,.22);
  transform: translateX(2px);
}

.sidebar-logout .material-symbols-outlined {
  font-size: 20px;
  color: #fff;
}
/* =========================================================
   MODAL
========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

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

.modal-box {
  width: 500px;
  max-width: 95vw;
  overflow: hidden;
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-overlay.open .modal-box {
  transform: scale(1);
}

.modal-head {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  transition: background 0.15s;
}

.modal-close:hover {
  background: var(--gray-200);
}

.modal-body {
  padding: 20px 24px;
}

.modal-sub {
  margin-bottom: 16px;
  color: var(--gray-500);
  font-size: 13px;
}

.modal-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ========================================================= */
/*   RESPONSIVE                                              */
/* ========================================================= */
@media (max-width: 1100px) {
  :root {
    --sidebar-w: 74px;
  }

  .sidebar-brand-text,
  .nav-item:not(.active) .nav-badge,
  .sidebar-user > div,
  .sidebar-user > span {
    display: none;
  }

  .sidebar-logo {
    justify-content: center;
    padding: 0 10px;
  }

  .nav-section {
    padding: 28px 0;
  }

  .nav-item {
    justify-content: center;
    padding: 10px;
    gap: 0;
  }

  .nav-item .material-symbols-outlined,
  .nav-item .nav-icon {
    width: auto;
    font-size: 18px;
  }

  .nav-item.active .nav-badge {
    position: absolute;
    top: 4px;
    right: 5px;
  }

  .sidebar-user {
    justify-content: center;
    padding: 10px;
  }

  .topbar {
    padding: 0 16px;
  }

  .content {
    padding: 18px;
  }
}

@media (max-width: 760px) {
  .topbar-title span {
    display: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .approval-flow-card {
    padding: 22px 18px;
  }

  .flow-step-sub {
    font-size: 12px;
    text-align: center;
  }
}


.payment-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  background: var(--gray-50);
}

.payment-option {
  min-height: 34px;
  padding: 7px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 999px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .18s ease;
}

.payment-option input {
  display: none;
}

.payment-check {
  width: 15px;
  height: 15px;
  border: 1.8px solid var(--gray-300);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.payment-option:hover {
  border-color: var(--sale);
  color: var(--sale-text);
}

.payment-option:has(input:checked) {
  border-color: var(--sale);
  background: var(--sale-soft);
  color: var(--sale-text);
}

.payment-option:has(input:checked) .payment-check {
  border-color: var(--sale);
  background: var(--sale);
}

.payment-option:has(input:checked) .payment-check::after {
  content: "✓";
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

/* =========================================================
   FINAL RESPONSIVE FIX PATCH
   เพิ่มส่วนนี้ท้ายไฟล์ เพื่อแก้ layout ให้ครบ desktop / tablet / mobile
========================================================= */

.hidden {
  display: none !important;
}

body {
  min-width: 320px;
}

button,
select,
input,
textarea {
  max-width: 100%;
}

.topbar {
  backdrop-filter: blur(10px);
}

.topbar-menu-btn,
.sidebar-backdrop {
  display: none;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 800;
}

.section-badge.purple::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--sale);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--gray-50);
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.warning {
  background: var(--orange-soft);
  color: #92400e;
}

.more-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  color: var(--gray-500);
  cursor: pointer;
}

.more-btn:hover {
  border-color: var(--sale);
  color: var(--sale);
}

.form-section {
  width: 100%;
}

.sig-canvas,
#sigDisplay {
  width: 100% !important;
  max-width: 100%;
  height: auto;
}

.modal-box .sig-canvas {
  height: 160px;
}

/* Desktop กว้างมาก */
@media (min-width: 1280px) {
  .content {
    max-width: 1120px;
  }
}

/* iPad / Tablet landscape */
@media (max-width: 1180px) {
  .content {
    max-width: none;
    padding: 20px;
  }

  .request-card {
    padding: 22px;
  }

  .request-body {
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 24px;
  }
}

/* Tablet แนวตั้งและหน้าจอเล็ก: ย่อ sidebar เป็น icon */
@media (max-width: 1024px) {
  :root {
    --sidebar-w: 76px;
    --header-h: 62px;
  }

  .sidebar-brand-text,
  .nav-item:not(.active) .nav-badge,
  .sidebar-user .user-info {
    display: none;
  }

  .sidebar-logo {
    min-height: 96px;
    padding: 18px 10px 14px;
  }

  .sidebar-logo-circle {
    width: 46px;
    height: 46px;
  }

  .nav-section {
    padding: 20px 0;
  }

  .nav-item {
    justify-content: center;
    padding: 12px 8px;
    gap: 0;
  }

  .nav-item .material-symbols-outlined,
  .nav-item .nav-icon {
    width: auto;
    font-size: 21px;
  }

  .sidebar-user {
    justify-content: center;
    margin: 8px;
    padding: 10px;
  }

  .sidebar-logout {
    display: none;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-title {
    font-size: 20px;
  }

  .request-body {
    grid-template-columns: 1fr;
  }

  .timeline-box {
    padding-left: 0;
  }

  .info-grid {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

/* มือถือ / หน้าจอแคบ: sidebar เป็น drawer */
@media (max-width: 760px) {
  :root {
    --sidebar-w: 250px;
    --header-h: 58px;
  }

  body {
    overflow-x: hidden;
  }

  .app {
    display: block;
  }

  .sidebar {
    width: var(--sidebar-w);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    z-index: 1200;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    border: 0;
    background: rgba(15, 23, 42, 0.42);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .sidebar-brand-text,
  .sidebar-user .user-info {
    display: block;
  }

  .sidebar-logo {
    min-height: 116px;
    padding: 24px 16px 16px;
  }

  .nav-section {
    padding: 18px 0;
  }

  .nav-item {
    justify-content: flex-start;
    padding: 11px 22px;
    gap: 12px;
  }

  .nav-item .material-symbols-outlined,
  .nav-item .nav-icon {
    width: 22px;
    font-size: 20px;
  }

  .sidebar-user {
    justify-content: flex-start;
  }

  .sidebar-logout {
    display: flex;
  }

  .main-area {
    margin-left: 0;
    min-height: 100vh;
  }

  .topbar {
    height: var(--header-h);
    padding: 0 12px;
    gap: 10px;
  }

  .topbar-menu-btn {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: var(--gray-100);
    color: var(--gray-700);
    cursor: pointer;
  }

  .topbar-menu-btn .material-symbols-outlined {
    font-size: 22px;
  }

  .topbar-title {
    font-size: 17px;
  }

  .topbar-subtitle {
    display: none;
  }

  .topbar-user span {
    display: none;
  }

  .notif-btn,
  .topbar-user .user-avatar {
    width: 34px;
    height: 34px;
  }

  .content {
    padding: 14px 12px 24px;
  }

  .detail-preview-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-pill {
    white-space: normal;
  }

  .request-card {
    border-radius: 14px;
    padding: 18px 16px;
  }

  .request-top {
    margin-bottom: 18px;
  }

  .request-top h3 {
    font-size: 16px;
  }

  .request-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .info-grid {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
  }

  .card {
    margin-bottom: 14px;
    border-radius: 12px;
  }

  .card-head {
    padding: 12px 14px;
  }

  .card-body {
    padding: 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .payment-options {
    gap: 7px;
  }

  .payment-option {
    width: 100%;
    justify-content: flex-start;
  }

  .btn-row {
    flex-direction: column;
  }

  .btn-row .btn {
    width: 100%;
    justify-content: center;
  }

  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }

  .modal-box {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
  }

  .modal-head,
  .modal-body,
  .modal-foot {
    padding-left: 16px;
    padding-right: 16px;
  }

  .modal-foot {
    flex-direction: column-reverse;
  }

  .modal-foot .btn {
    width: 100%;
    justify-content: center;
  }

  .modal-box .sig-canvas {
    height: 140px;
  }
}

/* จอเล็กมาก */
@media (max-width: 390px) {
  .content {
    padding-left: 10px;
    padding-right: 10px;
  }

  .topbar-title {
    font-size: 15.5px;
  }

  .card-body {
    padding: 12px;
  }

  .info-grid {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .timeline-item {
    grid-template-columns: 28px 1fr;
    gap: 10px;
  }

  .timeline-item .dot {
    width: 28px;
    height: 28px;
  }

  .timeline-item:not(:last-child)::after {
    left: 13px;
  }
}


@media (max-width:900px){

  .request-body{
      grid-template-columns:1fr;
  }

  .approval-progress{
      padding:0;
  }

  .progress-step{
      width:auto;
      flex:1;
  }

}

/* =========================================================
   3 STEP PREVIEW LAYOUT PATCH
   - บล็อกบน: 2 คอลัมน์ ข้อมูลลูกค้า / สถานะ
   - บล็อกล่าง: Timeline แนวนอน 3 สถานะ
========================================================= */

.detail-preview-card {
  width: 100%;
  max-width: 980px;
}

.request-card {
  position: relative;
}

.request-top {
  width: 100%;
  margin-bottom: 22px;
  padding-bottom: 0;
}

.request-body {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr) !important;
  gap: 32px !important;
  align-items: start;
}

.info-left,
.status-summary-box {
  min-width: 0;
}

.info-grid {
  grid-template-columns: 62px minmax(0, 1fr) !important;
  column-gap: 12px;
  row-gap: 12px;
}

.status-summary-box {
  width: 100%;
  max-width: 320px;
  margin-left: auto;
}

.status-summary-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.status-summary-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 34px;
  width: 2px;
  height: calc(100% + 2px);
  background: #e5e7eb;
}

.status-summary-item:last-child {
  margin-bottom: 0;
}

.status-dot {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
}

.status-summary-item.done .status-dot {
  background: #10b981;
  color: #fff;
}

.status-summary-item.active .status-dot {
  background: #f59e0b;
  color: #fff;
}

.status-summary-item.wait .status-dot {
  background: #e5e7eb;
  color: #94a3b8;
}

.status-summary-item strong {
  display: block;
  color: #111827;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.status-summary-item small {
  display: block;
  margin-top: 3px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.25;
}

.approval-progress {
  position: relative;
  width: 100%;
  margin: 28px 0 8px;
  padding: 0 42px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.progress-line,
.progress-line-fill {
  position: absolute;
  top: 18px;
  left: 82px;
  right: 82px;
  height: 3px;
  border-radius: 999px;
}

.progress-line {
  background: #e5e7eb;
}

.progress-line-fill {
  right: 50%;
  background: #10b981;
}

.progress-step {
  position: relative;
  z-index: 2;
  min-width: 0;
  text-align: center;
}

.step-dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 9px;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 0 0 7px #fff;
}

.progress-step.done .step-dot {
  background: #10b981;
  color: #fff;
}

.progress-step.active .step-dot {
  background: #f59e0b;
  color: #fff;
}

.progress-step.wait .step-dot {
  background: #e5e7eb;
  color: #94a3b8;
}

.step-label {
  display: block;
  color: #111827;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  word-break: keep-all;
}

/* override old timeline classes if cache/html still has old markup */
.timeline-box {
  width: 100%;
  max-width: 320px;
  margin-left: auto;
  padding-left: 0;
}

.timeline-item {
  grid-template-columns: 34px minmax(0, 1fr);
}

.timeline-item .dot {
  width: 34px;
  height: 34px;
}

/* iPad landscape */
@media (max-width: 1180px) {
  .request-card {
    padding: 22px 24px;
  }

  .request-body {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.85fr) !important;
    gap: 28px !important;
  }

  .approval-progress {
    padding-left: 32px;
    padding-right: 32px;
  }

  .progress-line,
  .progress-line-fill {
    left: 70px;
    right: 70px;
  }
}

/* tablet portrait */
@media (max-width: 900px) {
  .request-body {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .status-summary-box,
  .timeline-box {
    max-width: none;
    margin-left: 0;
  }

  .approval-progress {
    padding: 0 18px;
  }

  .progress-line,
  .progress-line-fill {
    left: 50px;
    right: 50px;
  }
}

/* mobile */
@media (max-width: 760px) {
  .request-card {
    padding: 18px 16px;
  }

  .request-body {
    gap: 22px !important;
  }

  .info-grid {
    grid-template-columns: 58px minmax(0, 1fr) !important;
  }

  .approval-progress {
    margin-top: 24px;
    padding: 0 4px;
  }

  .progress-line,
  .progress-line-fill {
    top: 17px;
    left: 38px;
    right: 38px;
  }

  .step-dot {
    width: 34px;
    height: 34px;
    box-shadow: 0 0 0 5px #fff;
  }

  .step-label {
    font-size: 11.5px;
  }

  .status-summary-item {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .status-dot {
    width: 32px;
    height: 32px;
  }

  .status-summary-item:not(:last-child)::after {
    left: 15px;
    top: 32px;
  }
}

@media (max-width: 390px) {
  .approval-progress {
    grid-template-columns: repeat(3, 1fr);
  }

  .step-label {
    font-size: 10.5px;
  }
}


/* =========================================================
   FIX V2: Preview layout
   - ลบช่อง Timeline แนวตั้งด้านขวาออก
   - ข้อมูลลูกค้าเรียง 2 คอลัมน์ด้านบน
   - Timeline แนวนอนอยู่ด้านล่าง และเส้นไม่เกินจุดสุดท้าย
========================================================= */
.request-card {
  position: relative;
}

.request-body {
  display: block !important;
  width: 100%;
}

.info-left {
  width: 100%;
  min-width: 0;
}

.info-grid {
  display: grid !important;
  grid-template-columns: 72px minmax(0, 1fr) 72px minmax(0, 1fr) !important;
  column-gap: 12px !important;
  row-gap: 12px !important;
  align-items: start;
}

.info-grid .label {
  white-space: nowrap;
}

.info-grid strong {
  min-width: 0;
  word-break: break-word;
}

/* ซ่อนกล่องสถานะแนวตั้ง หากยังมี HTML เก่าค้างอยู่ */
.status-summary-box,
.timeline-box {
  display: none !important;
}

.approval-progress {
  position: relative !important;
  width: 100% !important;
  margin: 34px 0 10px !important;
  padding: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  align-items: start !important;
}

.progress-line,
.progress-line-fill {
  position: absolute !important;
  top: 19px !important;
  height: 3px !important;
  border-radius: 999px !important;
  z-index: 0 !important;
}

/* เส้นเริ่มที่จุดที่ 1 และจบที่จุดที่ 3 ไม่ลากเลยออกไปทางขวา */
.progress-line {
  left: 16.666% !important;
  right: 16.666% !important;
  background: #e5e7eb !important;
}

/* สีเขียวถึงจุดกำลังตรวจสอบ */
.progress-line-fill {
  left: 16.666% !important;
  width: 33.333% !important;
  right: auto !important;
  background: #10b981 !important;
}

.progress-step {
  position: relative !important;
  z-index: 2 !important;
  min-width: 0 !important;
  text-align: center !important;
}

.step-dot {
  width: 38px !important;
  height: 38px !important;
  margin: 0 auto 9px !important;
  border-radius: 50% !important;
  display: grid !important;
  place-items: center !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  box-shadow: 0 0 0 7px #fff !important;
}

.progress-step.done .step-dot {
  background: #10b981 !important;
  color: #fff !important;
}

.progress-step.active .step-dot {
  background: #f59e0b !important;
  color: #fff !important;
}

.progress-step.wait .step-dot {
  background: #e5e7eb !important;
  color: #94a3b8 !important;
}

.step-label {
  display: block !important;
  color: #111827 !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
}

@media (max-width: 900px) {
  .info-grid {
    grid-template-columns: 68px minmax(0, 1fr) !important;
  }

  .approval-progress {
    margin-top: 28px !important;
  }

  .progress-line {
    left: 16.666% !important;
    right: 16.666% !important;
  }

  .progress-line-fill {
    left: 16.666% !important;
    width: 33.333% !important;
  }

  .step-label {
    font-size: 12px !important;
  }
}

@media (max-width: 420px) {
  .step-dot {
    width: 34px !important;
    height: 34px !important;
    box-shadow: 0 0 0 5px #fff !important;
  }

  .progress-line,
  .progress-line-fill {
    top: 17px !important;
  }

  .step-label {
    font-size: 11.5px !important;
  }
}

/* =========================================================
   STATUS FLOW DASHBOARD - FINAL PATCH
   คำขอที่กำลังดำเนินการ + ประวัติคำขอ + 3 Step Horizontal Timeline
========================================================= */
.request-dashboard {
  max-width: 980px;
  margin: 0 auto 22px;
}

.request-list {
  display: grid;
  gap: 16px;
}

.request-card-active {
  margin-bottom: 0;
}

.request-subtitle {
  margin-top: 4px;
  color: var(--gray-500);
  font-size: 12px;
  font-weight: 700;
}

.request-body-compact {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 28px !important;
  align-items: start;
}

.info-grid-wide {
  grid-template-columns: 74px minmax(0, 1fr) !important;
}

/* ปิด timeline แนวตั้งเดิม ถ้ายังมี markup เก่าค้างในหน้า */
.timeline-box,
.timeline-item {
  display: none !important;
}

.approval-progress {
  width: 100%;
  position: relative;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  align-items: start;
  margin: 28px 0 4px;
  padding: 0 64px;
}

.progress-line,
.progress-line-fill {
  position: absolute;
  top: 18px;
  left: calc(64px + 18px);
  right: calc(64px + 18px);
  height: 3px;
  border-radius: 999px;
  pointer-events: none;
}

.progress-line {
  background: var(--gray-200);
  z-index: 0;
}

.progress-line-fill {
  width: auto;
  right: auto;
  max-width: calc(100% - 164px);
  background: #10b981;
  z-index: 1;
}

.progress-step {
  position: relative;
  z-index: 2;
  width: auto !important;
  min-width: 0;
  text-align: center;
}

.step-dot {
  width: 36px;
  height: 36px;
  margin: 0 auto 9px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 0 0 6px #fff;
}

.progress-step.done .step-dot {
  background: #10b981;
  color: #fff;
}

.progress-step.active .step-dot {
  background: #f59e0b;
  color: #fff;
}

.progress-step.wait .step-dot {
  background: #e5e7eb;
  color: #94a3b8;
}

.progress-step.rejected .step-dot {
  background: #ef4444;
  color: #fff;
}

.step-label {
  display: block;
  color: var(--gray-900);
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.25;
}

.empty-state {
  padding: 20px;
  border: 1px dashed var(--gray-300);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--gray-500);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.request-history {
  margin-top: 8px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.history-item strong,
.history-item small {
  display: block;
}

.history-item small {
  margin-top: 3px;
  color: var(--gray-500);
  font-size: 12px;
}

.history-right {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill.success {
  background: var(--green-soft);
  color: #047857;
}

.status-pill.danger {
  background: var(--red-soft);
  color: #b91c1c;
}

@media (max-width: 1024px) {
  .request-body-compact {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .approval-progress {
    padding: 0 30px;
  }

  .progress-line,
  .progress-line-fill {
    left: calc(30px + 18px);
    right: calc(30px + 18px);
  }

  .progress-line-fill {
    max-width: calc(100% - 96px);
  }
}

@media (max-width: 760px) {
  .request-dashboard {
    margin-bottom: 16px;
  }

  .request-body-compact {
    grid-template-columns: 1fr !important;
  }

  .info-grid-wide {
    grid-template-columns: 68px minmax(0, 1fr) !important;
  }

  .approval-progress {
    padding: 0 8px;
  }

  .progress-line,
  .progress-line-fill {
    left: 26px;
    right: 26px;
  }

  .progress-line-fill {
    max-width: calc(100% - 52px);
  }

  .step-dot {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .step-label {
    font-size: 11.5px;
  }

  .history-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-right {
    width: 100%;
    justify-content: space-between;
    text-align: left;
  }
}


.customer-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-top:10px;
}

.customer-item{
  background:#f8fafc;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:12px 14px;
}

.customer-item label{
  display:block;
  margin-bottom:4px;
  color:#94a3b8;
  font-size:12px;
  font-weight:600;
}

.customer-item strong{
  display:block;
  color:#0f172a;
  font-size:15px;
  font-weight:700;
}

.customer-item .text-red{
  color:#ef4444;
}


.request-accordion-head {
  width: 100%;
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  text-align: left;
}

.request-accordion-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.expand-icon {
  width: 26px;
  height: 26px;
  margin-top: 2px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-500);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  transition: transform 0.2s ease;
}

.request-accordion-content {
  max-height: 1500px;
  overflow: hidden;
  transition: max-height 0.28s ease, opacity 0.2s ease;
  opacity: 1;
}

.request-card.collapsed .request-accordion-content {
  max-height: 0;
  opacity: 0;
}

.request-card.collapsed .expand-icon {
  transform: rotate(-90deg);
}

.request-card.collapsed .request-accordion-head {
  padding-bottom: 0;
}

.request-card.collapsed {
  padding-bottom: 20px;
}