/* ============================================================
   pr-service — Blue Pastel Theme
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&family=IBM+Plex+Sans+Thai:wght@300;400;500;600&display=swap');

:root {
  --primary:      #4A90D9;
  --primary-light:#EBF4FF;
  --primary-dark: #2563EB;
  --secondary:    #7EC8E3;
  --accent:       #A8D8F0;

  --bg:           #F0F7FF;
  --bg-card:      #FFFFFF;
  --bg-sidebar:   #E8F3FC;

  --text-main:    #1A3A5C;
  --text-sub:     #5B7FA6;
  --text-muted:   #94B8D4;

  --border:       #C8DFF0;
  --border-light: #E0EFFA;

  --green:  #34C17B; --green-light:  #EDFAF3;
  --amber:  #F59E0B; --amber-light:  #FEF9EC;
  --red:    #EF4444; --red-light:    #FEF2F2;
  --purple: #8B5CF6; --purple-light: #F5F3FF;
  --teal:   #14B8A6; --teal-light:   #F0FDFA;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 2px 12px rgba(74,144,217,.12);
  --shadow-md: 0 4px 24px rgba(74,144,217,.18);

  --font: 'Sarabun', 'IBM Plex Sans Thai', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text-main); font-size: 15px; line-height: 1.6; }

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  /* สูงเท่าจอที่มองเห็นจริง — iPhone/iPad Safari นับ 100vh รวมพื้นที่ใต้แถบเครื่องมือ
     ส่วนล่าง (ชื่อผู้ใช้ + ออกจากระบบ) จึงจมหายใต้แถบ ใช้ dvh ถ้าเบราว์เซอร์รองรับ */
  width: 240px; height: 100vh; height: 100dvh;
  background: var(--bg-card);
  border-right: 1px solid var(--border-light);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  box-shadow: 2px 0 12px rgba(74,144,217,.08);
  z-index: 100;
}
.sidebar-brand {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: .6rem;
}
.sidebar-brand .brand-text { min-width: 0; }
.sidebar-brand .brand-name {
  font-size: 1.1rem; font-weight: 700; color: var(--primary-dark);
  letter-spacing: -.3px;
}
.sidebar-brand .brand-sub { font-size: .75rem; color: var(--text-muted); margin-top: .1rem; }
.sidebar-logo { font-size: 1.7rem; line-height: 1; flex-shrink: 0; }

/* min-height:0 ให้เมนูหดแล้วเลื่อนในตัวเองได้ — ไม่ดันส่วนชื่อผู้ใช้ตกขอบจอ */
.sidebar-nav { flex: 1; min-height: 0; padding: .75rem 0; overflow-y: auto;
               -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.nav-section-label {
  font-size: .7rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em;
  padding: .75rem 1.25rem .3rem;
}
.nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem 1.25rem; margin: .1rem .5rem;
  border-radius: var(--radius-sm);
  color: var(--text-sub); font-size: .9rem; font-weight: 500;
  text-decoration: none; transition: all .15s;
  cursor: pointer;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary-dark); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: .7rem; font-weight: 700; border-radius: 999px;
  padding: .1rem .45rem; min-width: 1.2rem; text-align: center;
}

.sidebar-user {
  flex-shrink: 0;
  padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-light);
  background: var(--bg-sidebar);
}
.user-name { font-size: .875rem; font-weight: 600; color: var(--text-main); }
.user-role { font-size: .75rem; color: var(--text-muted); }
.user-avatar {
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Main Content ── */
.main { margin-left: 240px; flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: 56px; background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 4px rgba(74,144,217,.06);
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text-main); }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }

.content { padding: 1.5rem; flex: 1; min-width: 0; max-width: 100%; box-sizing: border-box; }

/* ── Cards ── */
.card {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border-light); box-shadow: var(--shadow);
  padding: 1.25rem; width: 100%; max-width: 100%; box-sizing: border-box;
  min-width: 0; overflow-wrap: break-word;
}
.card-title { font-size: .9rem; font-weight: 600; color: var(--text-sub); margin-bottom: 1rem; text-transform: uppercase; letter-spacing: .04em; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border-light); padding: 1.25rem;
  display: flex; flex-direction: column; gap: .3rem;
}
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--primary-dark); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.stat-icon { font-size: 1.5rem; margin-bottom: .25rem; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-light); }
select.form-control { position: relative; z-index: 10; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead { background: var(--bg-sidebar); }
th { padding: .75rem 1rem; text-align: left; font-weight: 600; color: var(--text-sub); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; border-bottom: 1px solid var(--border); }
td { padding: .75rem 1rem; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--primary-light); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--primary); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500; cursor: pointer;
  border: none; transition: all .15s; text-decoration: none;
  white-space: nowrap;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-sidebar); color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger  { background: var(--red); color: #fff; }
.btn-warning { background: var(--amber); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-sm  { padding: .35rem .75rem; font-size: .8rem; }
.btn-xs  { padding: .25rem .5rem;  font-size: .75rem; }
.btn-wide { width: 100%; justify-content: center; padding: .65rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-sub); margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .04em; }
.form-control {
  width: 100%; padding: .55rem .875rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .9rem; font-family: var(--font); color: var(--text-main);
  background: var(--bg-card); transition: border .15s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,144,217,.12); }
/* ช่องกรอก 1 บรรทัดสูงเท่ากันทุกชนิด — Safari (Mac/iPhone/iPad) วาด <select> แบบเครื่องและไม่สนใจ padding
   dropdown จึงเตี้ยกว่าช่องข้อความ ตั้งความสูงและวาดลูกศรเอง ให้ทุกเบราว์เซอร์ออกมาเหมือนกัน */
input.form-control, select.form-control { height: 2.65rem; line-height: 1.4; }
select.form-control {
  -webkit-appearance: none; appearance: none;
  padding-right: 2.2rem;
  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='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; background-size: 12px;
}
select.form-control[multiple], select.form-control[size] { height: auto; background-image: none; padding-right: .875rem; }
input.form-control[type=checkbox], input.form-control[type=radio], input.form-control[type=file] { height: auto; }
.form-control.auto-width { width: auto !important; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }
.req { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
/* ช่องที่กินพื้นที่ตั้งแต่คอลัมน์ 2 ถึงท้ายแถว — บนมือถือกินเต็มแถวแทน */
.grid-span-rest { grid-column: 2 / -1; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-pending   { background: var(--amber-light); color: #B45309; }
.badge-approved  { background: var(--green-light);  color: #065F46; }
.badge-confirmed { background: var(--primary-light); color: var(--primary-dark); }
.badge-rejected  { background: var(--red-light);    color: #991B1B; }
.badge-cancelled { background: #F3F4F6; color: #6B7280; }
.badge-failed    { background: #FEE2E2; color: #991B1B; }
.badge-closed    { background: var(--purple-light);  color: #5B21B6; }
.badge-room      { background: var(--teal-light);    color: #0F766E; }
.badge-service   { background: var(--purple-light);  color: #5B21B6; }
.badge-admin     { background: var(--red-light);     color: #991B1B; }
.badge-manager   { background: var(--amber-light);   color: #B45309; }
.badge-staff     { background: var(--primary-light); color: var(--primary-dark); }
.badge-viewer    { background: var(--teal-light);    color: #0F766E; }
.badge-user      { background: #F3F4F6; color: #374151; }

/* ── Alerts ── */
.alert { padding: .875rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .875rem; }
.alert-success { background: var(--green-light);  color: #065F46; border-left: 3px solid var(--green); }
.alert-error   { background: var(--red-light);    color: #991B1B; border-left: 3px solid var(--red); }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border-left: 3px solid var(--primary); }
.alert-warning { background: var(--amber-light);  color: #B45309; border-left: 3px solid var(--amber); }

/* ── Modal ── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(26,58,92,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none; transition: opacity .2s;
  backdrop-filter: blur(2px);
}
.modal-bg.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-md); width: 90%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(8px); transition: transform .2s;
}
.modal-bg.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-light);
}
.modal-header h2 { font-size: 1rem; font-weight: 600; }
.modal-close-btn { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text-muted); padding: .25rem; border-radius: 4px; }
.modal-close-btn:hover { background: var(--bg-sidebar); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-light); display: flex; gap: .75rem; justify-content: flex-end; }

/* ── Tabs ── */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border-light); margin-bottom: 1.5rem; }
.tab {
  padding: .6rem 1rem; font-size: .875rem; font-weight: 500;
  color: var(--text-sub); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; text-decoration: none; transition: all .15s;
  white-space: nowrap;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }

/* ── Service/Equipment Cards ── */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(140px,1fr)); gap: .75rem; }
.service-card {
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: .875rem .75rem; text-align: center; cursor: pointer;
  transition: all .15s; background: var(--bg-card);
}
.service-card:hover { border-color: var(--primary); background: var(--primary-light); }
.service-card.selected { border-color: var(--primary); background: var(--primary-light); }
.service-card .sc-icon { font-size: 1.5rem; margin-bottom: .35rem; }
.service-card .sc-name { font-size: .8rem; font-weight: 500; color: var(--text-main); }

.equip-card {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .875rem; background: var(--bg-card);
  display: flex; flex-direction: column; gap: .5rem;
}
.equip-card .ec-header { display: flex; align-items: center; gap: .5rem; }
.equip-card .ec-icon { font-size: 1.2rem; }
.equip-card .ec-name { font-size: .85rem; font-weight: 600; }
.equip-card .ec-max { font-size: .7rem; color: var(--text-muted); }
.qty-control { display: flex; align-items: center; justify-content: center; gap: .5rem; }
.qty-btn { width: 1.75rem; height: 1.75rem; border-radius: 50%; border: 1.5px solid var(--border); background: var(--bg-card); cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: all .15s; color: var(--text-main); }
.qty-btn:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.qty-num { font-size: .9rem; font-weight: 600; min-width: 1.5rem; text-align: center; }

/* ── Calendar ── */
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.cal-header { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; margin-bottom: .5rem; }
.cal-day-name { text-align: center; font-size: .75rem; font-weight: 600; color: var(--text-muted); padding: .4rem 0; }
.cal-day {
  min-height: 80px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1.5px solid var(--border-light);
  padding: .4rem; cursor: pointer; transition: all .15s;
  display: flex; flex-direction: column;
}
.cal-day:hover { border-color: var(--primary); background: var(--primary-light); }
.cal-day.today { border-color: var(--primary); background: var(--primary-light); }
.cal-day.other-month { background: var(--bg); opacity: .5; }
.cal-day.has-event { border-color: var(--secondary); }
.cal-date { font-size: .8rem; font-weight: 600; color: var(--text-main); margin-bottom: .25rem; }
.cal-date.today-num { width: 1.5rem; height: 1.5rem; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; }
.cal-event { font-size: .65rem; background: var(--primary-light); color: var(--primary-dark); border-radius: 4px; padding: .1rem .35rem; margin-bottom: .15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.svc  { background: var(--purple-light); color: var(--purple); }
.cal-event.both { background: #CCFBF1; color: #0F766E; }

/* ── Postage ── */
.postage-bar { height: 8px; border-radius: 4px; background: var(--border-light); overflow: hidden; margin: .4rem 0; }
.postage-fill { height: 100%; border-radius: 4px; background: var(--primary); transition: width .3s; }
.postage-fill.warn { background: var(--amber); }
.postage-fill.danger { background: var(--red); }

/* ── Bid chip ── */
.bid-chip {
  display: inline-flex; align-items: center;
  background: var(--primary-light); color: var(--primary-dark);
  border-radius: var(--radius-sm); padding: .15rem .5rem;
  font-size: .8rem; font-weight: 600; font-family: var(--font-mono);
  border: 1px solid var(--border);
}
/* แยกสีตามองค์ประกอบของงาน — ใช้ชุดเดียวกับปฏิทิน
   ไม่มี class = จองห้องอย่างเดียว (น้ำเงิน)
   .svc        = บริการ/อุปกรณ์อย่างเดียว (ม่วง)
   .both       = ห้อง + บริการเสริม (เขียวน้ำทะเล) */
.bid-chip.svc  { background: var(--purple-light); color: var(--purple); border-color: #DDD6FE; }
.bid-chip.both { background: #CCFBF1; color: #0F766E; border-color: #99F6E4; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { font-size: .9rem; }

/* ── Flex utils ── */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } .mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; }
.w-full { width: 100%; }
.text-sm { font-size: .8rem; } .text-xs { font-size: .75rem; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }

/* ── Responsive ── */
/* ── Hamburger ── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  margin-right: .5rem;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: all .2s;
}

/* ── Sidebar overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 199;
}
.sidebar-overlay.open { display: block; }

/* ── มือถือ + iPad: ซ่อน sidebar ใช้ hamburger แทน ──
   iPad แนวตั้ง (820px) เหลือพื้นที่แค่ 580px หลังหัก sidebar 240px
   ทำให้ปฏิทิน 7 คอลัมน์แคบเกินไป จึงคืนพื้นที่ให้เนื้อหา          */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 16px rgba(0,0,0,.15);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }

  /* ส่วนชื่อผู้ใช้ท้ายเมนู — บางลงและจัดกลาง บน iPhone/iPad */
  .sidebar-user {
    padding: .5rem .9rem calc(.5rem + env(safe-area-inset-bottom, 0px));
  }
  .sidebar-user > .flex { justify-content: center; text-align: left; }
  .sidebar-user .user-avatar { width: 1.75rem; height: 1.75rem; font-size: .78rem; }
  .sidebar-user .user-name { font-size: .82rem; line-height: 1.3; }
  .sidebar-user .user-role { line-height: 1.3; }
  .hamburger { display: flex; }

  /* ปฏิทิน — กันช่องวันดันตัวเองออกนอกจอ */
  .cal-day   { min-width: 0; overflow: hidden; }
  .cal-event { min-width: 0; }
}

/* ── iPad เท่านั้น (769–1024px) ── */
@media (min-width: 769px) and (max-width: 1024px) {
  .cal-day   { min-height: 92px; padding: .35rem; }
  .cal-event { font-size: .62rem; padding: .1rem .3rem; }
  .cal-date  { font-size: .78rem; }
}

/* ── มือถือเท่านั้น ── */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-span-rest { grid-column: 1 / -1; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .topbar { padding: .6rem 1rem; }
  .content { padding: 1rem; }
}

/* ── Login page ── */
.login-wrap { min-height: 100vh; background: linear-gradient(135deg,#EBF4FF 0%,#DAEEFF 50%,#C5E3F7 100%); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { background: #fff; border-radius: 20px; box-shadow: var(--shadow-md); padding: 2.5rem; width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo .logo-icon { font-size: 3rem; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--primary-dark); margin-top: .5rem; }
.login-logo p { font-size: .85rem; color: var(--text-muted); }

/* ── Step indicator ── */
.steps { display: flex; align-items: center; margin-bottom: 1.5rem; }
.step { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--text-muted); }
.step.active { color: var(--primary-dark); font-weight: 600; }
.step-num { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--border); background: var(--bg-card); display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; }
.step.active .step-num { border-color: var(--primary); background: var(--primary); color: #fff; }
.step.done .step-num { border-color: var(--green); background: var(--green); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--border); margin: 0 .4rem; }
.step-line.done { background: var(--green); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Availability badges ── */
.avail-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .03em;
  margin-top: .15rem;
  min-height: 1.2em;
}
.badge-free  { background: #D1FAE5; color: #065F46; }
.badge-busy  { background: #FEE2E2; color: #991B1B; }

.service-card.busy {
  opacity: .55;
  cursor: not-allowed;
  border-color: #FCA5A5 !important;
  background: #FFF5F5 !important;
}

/* ── Room opt (label-based) ── */
.room-opt.selected {
  border-color: var(--primary) !important;
  background: #EFF6FF !important;
}
.room-opt.unavailable {
  opacity: .55;
  cursor: not-allowed !important;
  border-color: #FCA5A5 !important;
  background: #FFF5F5 !important;
}

/* ── Service opt (label-based) ── */
.svc-opt.selected {
  border-color: var(--primary) !important;
  background: #EFF6FF !important;
}
.svc-opt.unavailable {
  opacity: .55;
  cursor: not-allowed !important;
  border-color: #FCA5A5 !important;
  background: #FFF5F5 !important;
}

/* ── ป้องกัน child elements รับ click แทน label ── */
.svc-opt * { pointer-events: none; }
.skill-radio-label { pointer-events: auto !important; cursor: pointer !important; }
.room-opt * { pointer-events: none; }

/* ── ซ่อนจากงานพิมพ์ ── */
/* เดิมแต่ละหน้าที่พิมพ์เอกสารนิยาม .no-print เองใน @media print ของตัวเอง
   หน้าที่ไม่มีบล็อกนั้นจึงพิมพ์เมนูและปุ่มติดไปด้วย ประกาศไว้ตรงนี้ให้ใช้ได้ทุกหน้า */
@media print {
  .no-print, .sidebar, .topbar { display: none !important; }
  .content { padding: 0 !important; }
}

/* ── แถบขั้นตอน + ประวัติการดำเนินงาน (render_timeline_html) ── */
.tl-hint { background: var(--primary-light); color: var(--primary-dark); border-radius: var(--radius-sm);
           padding: .55rem .8rem; font-size: .85rem; font-weight: 600; margin-bottom: .8rem; }
.tl-steps { display: flex; overflow-x: auto; padding: .45rem 0 .5rem; margin-bottom: .6rem;   /* บนเผื่อเงาวงแหวนไม่ให้ถูกตัด */
            -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tl-steps::-webkit-scrollbar { display: none; }
.tl-step { flex: 1 0 44px; text-align: center; position: relative; min-width: 44px; }   /* 7 ขั้นพอดีในหน้าต่างบนมือถือ */
/* เส้นเชื่อมระหว่างขั้น — ทอดจากกลางวงกลมนี้ไปกลางวงกลมถัดไป */
.tl-step:not(:last-child)::after { content: ''; position: absolute; top: 13px; left: 50%; width: 100%;
                                   height: 2px; background: var(--border); z-index: 0; }
.tl-step.done:not(:last-child)::after { background: var(--green); }
.tl-dot { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; margin: 0 auto .3rem;
          display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700;
          background: var(--bg-card); border: 2px solid var(--border); color: var(--text-muted); }
.tl-step.done .tl-dot    { background: var(--green); border-color: var(--green); color: #fff; }
.tl-step.bad .tl-dot     { background: var(--red);   border-color: var(--red);   color: #fff; }
.tl-step.current .tl-dot { border-color: var(--primary); background: var(--primary-light);
                           box-shadow: 0 0 0 4px rgba(74,144,217,.18); }
.tl-step.current .tl-dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.tl-lb { font-size: .7rem; color: var(--text-muted); line-height: 1.25; }
.tl-step.done .tl-lb, .tl-step.current .tl-lb { color: var(--text-main); font-weight: 600; }
.tl-step.bad .tl-lb { color: var(--red); font-weight: 600; }
.tl-tm { font-size: .63rem; color: var(--text-muted); min-height: .9rem; margin-top: .1rem; line-height: 1.25; }
.tl-hd { font-size: .78rem; font-weight: 600; color: var(--text-muted); margin: .4rem 0 .4rem; }
.tl-ev { list-style: none; margin: 0 0 .9rem; padding: 0 0 0 .2rem; border-left: 2px solid var(--border-light); }
.tl-ev li { position: relative; padding: 0 0 .7rem 1rem; }
.tl-ev li::before { content: ''; position: absolute; left: -6px; top: .3rem; width: 10px; height: 10px;
                    border-radius: 50%; background: var(--primary); border: 2px solid var(--bg-card); }
.tl-when { font-size: .72rem; color: var(--text-muted); }
.tl-what { font-size: .85rem; line-height: 1.4; }
.tl-who { color: var(--text-muted); font-size: .8rem; }
.tl-det { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }
