/* ==========================================================================
   Design tokens
   Refreshed to a modern, friendly SaaS green identity (matches the
   reference UX/UI screenshots in "Booking img UX UI"): soft mint
   background, deep-green top navigation, rounded cards, colorful
   quick-action tiles.
   ========================================================================== */
:root {
  --ink-900: #16241d;
  --ink-800: #23342a;
  --ink-600: #1f6b3d;
  --steel-500: #64748b;
  --steel-300: #b7c2ca;
  --paper-100: #f2fbf5;
  --paper-000: #FFFFFF;
  --line-200: #dfe9e2;
  --accent-500: #16a34a;
  --accent-600: #128a3d;
  --success-500: #15803d;
  --success-100: #dcfce7;
  --danger-500: #dc2626;
  --danger-100: #fee2e2;

  --blue-500: #2563eb;
  --blue-100: #dbeafe;
  --purple-500: #9333ea;
  --purple-100: #f3e8ff;
  --amber-500: #d97706;
  --amber-100: #fef3c7;
  --slate-700: #334155;
  --slate-100: #f1f5f9;

  --brand-grad: linear-gradient(90deg, #145c30 0%, #1ea34a 100%);

  --font-body: 'Noto Sans Thai', 'Sarabun', system-ui, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --shadow-card: 0 1px 2px rgba(16, 60, 35, 0.06), 0 8px 20px rgba(16, 60, 35, 0.07);
}

* { box-sizing: border-box; }

.icon-svg { display: inline-block; vertical-align: -4px; flex-shrink: 0; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  font-size: 16px;
  line-height: 1.55;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1000px 480px at 8% -8%, #e4faec 0%, transparent 60%),
    radial-gradient(900px 460px at 100% 0%, #eafcf1 0%, transparent 55%),
    var(--paper-100);
}

a { color: var(--ink-600); }

h1, h2, h3 { font-weight: 700; color: var(--ink-900); margin: 0 0 .4em; }

/* -------------------------------- Top navbar ------------------------------ */
.navbar {
  background: var(--brand-grad);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 10px rgba(10, 40, 22, 0.15);
}

.navbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  margin-right: 4px;
}
.navbar-brand-icon {
  font-size: 22px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.16);
  border-radius: var(--radius-sm);
}
.navbar-brand-text { font-size: 15px; font-weight: 700; line-height: 1.3; color: #fff; }
.navbar-brand-text small { display: block; font-weight: 400; font-size: 11px; color: rgba(255,255,255,0.78); }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  flex-wrap: wrap;
}

.navbar-nav > a {
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.navbar-nav > a:hover { background: rgba(255,255,255,0.12); }
.navbar-nav > a.active { background: rgba(255,255,255,0.22); font-weight: 700; }

.nav-dropdown { position: relative; }
.nav-dropdown > summary {
  list-style: none;
  cursor: pointer;
  color: rgba(255,255,255,0.92);
  padding: 9px 14px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-dropdown > summary::-webkit-details-marker { display: none; }
.nav-dropdown > summary:hover { background: rgba(255,255,255,0.12); }
.nav-dropdown.is-active > summary { background: rgba(255,255,255,0.22); font-weight: 700; }
.nav-dropdown[open] > summary { background: rgba(255,255,255,0.22); }

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 6px;
  min-width: 210px;
  z-index: 40;
}
.nav-dropdown-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink-800);
  text-decoration: none;
  font-weight: 500;
}
.nav-dropdown-menu a:hover { background: var(--paper-100); }
.nav-dropdown-menu a.active { background: var(--success-100); color: var(--success-500); }

.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.user-chip { text-align: right; line-height: 1.3; }
.user-chip strong { display: block; font-size: 13.5px; color: #fff; }
.user-chip span { font-size: 11.5px; color: rgba(255,255,255,0.78); }

.btn-logout {
  background: var(--danger-500);
  color: #fff;
  border: none;
  padding: 9px 14px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-logout:hover { background: #b91c1c; }

/* --------------------------------- Shell --------------------------------- */
.page-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  flex: 1;
  display: flex;
}

.main {
  flex: 1;
  padding: 28px 0 48px;
  min-width: 0;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.topbar h1 { display: flex; align-items: center; gap: 10px; }

/* -------------------------------- Stat cards ------------------------------ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--paper-000);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stat-label { font-size: 12.5px; color: var(--steel-500); margin-bottom: 4px; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--ink-900); line-height: 1.1; }
.stat-icon {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.blue { background: var(--blue-100); color: var(--blue-500); }
.stat-icon.green { background: var(--success-100); color: var(--success-500); }
.stat-icon.amber { background: var(--amber-100); color: var(--amber-500); }
.stat-icon.purple { background: var(--purple-100); color: var(--purple-500); }

/* -------------------------------- Quick menu ------------------------------ */
.quick-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px 12px;
  border-radius: var(--radius-md);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}
.quick-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,0.14); }
.quick-btn .icon { font-size: 24px; }
.quick-btn.green { background: var(--accent-500); }
.quick-btn.blue { background: var(--blue-500); }
.quick-btn.purple { background: var(--purple-500); }
.quick-btn.slate { background: var(--slate-700); }
.quick-btn.amber { background: var(--amber-500); }
/* รอบที่ 11.29: quick-btn บางปุ่มเปลี่ยนจาก <a> เป็น <button> เพื่อเปิด booking modal
   ต้อง reset สไตล์ default ของ <button> ให้เหมือน <a> เดิมทุกประการ */
button.quick-btn { border: none; width: 100%; font-family: inherit; }

/* ปุ่มที่มีหน้าตาเหมือนลิงก์ข้อความธรรมดา ใช้แทน <a> เมื่อ action คือเปิด modal ไม่ใช่การนำทาง */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent-600);
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: var(--accent-500); }

/* --------------------------------- Cards --------------------------------- */
.card {
  background: var(--paper-000);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 22px 24px;
}

.card + .card { margin-top: 20px; }

/* -------------------------------- Buttons -------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}

.btn-primary { background: var(--accent-500); color: #fff; }
.btn-primary:hover { background: var(--accent-600); }

.btn-secondary { background: var(--paper-000); color: var(--ink-800); border-color: var(--line-200); }
.btn-secondary:hover { border-color: var(--accent-500); color: var(--accent-600); }

.btn-danger { background: var(--paper-000); color: var(--danger-500); border-color: var(--danger-100); }
.btn-danger:hover { background: var(--danger-100); }

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* --------------------------------- Forms ---------------------------------- */
label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-800); margin-bottom: 5px; }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=time], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14.5px;
  background: var(--paper-000);
  color: var(--ink-900);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-500);
  outline-offset: 1px;
  border-color: var(--accent-500);
}

.field { margin-bottom: 16px; }
.field-row { display: flex; gap: 14px; }
.field-row > .field { flex: 1; }

/* Hour/minute spin-box pair (replaces native <input type="time"> to avoid AM/PM) */
.time-spin-group { display: flex; align-items: center; gap: 8px; }
.time-spin-group span { color: var(--steel-500); font-weight: 600; }
.time-spin-group input[type=number].time-spin {
  width: 72px;
  flex: none;
  text-align: center;
}
.hint { font-size: 12.5px; color: var(--steel-500); margin-top: 4px; }
.hint-danger { color: var(--danger-500); font-weight: 600; display: flex; align-items: flex-start; gap: 6px; }
.btn-disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --------------------------------- Alerts --------------------------------- */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error { background: var(--danger-100); color: var(--danger-500); border: 1px solid #f5c2c2; }
.alert-success { background: var(--success-100); color: var(--success-500); border: 1px solid #b7e8c8; }

/* --------------------------------- Tables --------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-200); vertical-align: middle; }
th { color: var(--steel-500); font-weight: 600; font-size: 12.5px; text-transform: none; }
tr:last-child td { border-bottom: none; }

table thead th {
  background: var(--accent-500);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  border-bottom: none;
}
table tbody tr:nth-child(even) { background: rgba(22, 163, 74, 0.03); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}
.badge-admin { background: var(--slate-700); color: #fff; }
.badge-user { background: var(--paper-100); color: var(--ink-800); border: 1px solid var(--line-200); }
.badge-active { background: var(--success-100); color: var(--success-500); }
.badge-inactive { background: var(--paper-100); color: var(--steel-500); }
.badge-pending { background: var(--amber-100); color: var(--amber-500); }

/* -------------------------------- Filter bar ------------------------------ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 20px;
}
.filter-bar .field { margin-bottom: 0; min-width: 160px; }
.filter-bar .field.grow { flex: 1; min-width: 220px; }

/* -------------------------------- Calendar -------------------------------- */
/* รอบที่ 11.26: ออกแบบใหม่ตามภาพต้นแบบที่ผู้ใช้แนบมา (โทนสีเขียวเดิม) — เพิ่มมุมมอง
   วัน/สัปดาห์/เดือน (.controls-row + .view-toggle), จัดป้ายเดือน/วันที่ไว้กึ่งกลาง
   (.cal-nav แบบ grid 1fr/auto/1fr ให้กึ่งกลางจริงไม่ว่าข้อความฝั่งซ้ายจะสั้นแค่ไหน) */
.controls-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.controls-row .field { margin-bottom: 0; min-width: 220px; }

.view-toggle { display: inline-flex; background: var(--paper-100); border: 1px solid var(--line-200); border-radius: 999px; padding: 3px; gap: 2px; }
.view-tab { border: none; background: transparent; padding: 8px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 700; color: var(--steel-500); cursor: pointer; font-family: inherit; text-decoration: none; display: inline-flex; align-items: center; transition: background .15s, color .15s; }
.view-tab:hover { color: var(--ink-800); }
.view-tab.active { background: var(--accent-500); color: #fff; box-shadow: 0 2px 6px rgba(22, 163, 74, .35); }

.cal-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin-bottom: 18px; }
.cal-nav-left { justify-self: start; }
.cal-nav-center { display: flex; align-items: center; gap: 10px; justify-self: center; }
.cal-nav-right { justify-self: end; }
.month-year-label { font-weight: 700; font-size: 22px; color: var(--ink-900); min-width: 170px; text-align: center; }

.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 20px;
  border-radius: 999px;
  border: 1px solid var(--line-200);
  background: var(--paper-000);
  color: var(--ink-900);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn-pill:hover { background: var(--paper-100); border-color: var(--accent-500); }

.btn-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line-200);
  background: var(--paper-000);
  color: var(--ink-900);
  font-size: 17px;
  line-height: 1;
  text-decoration: none;
  transition: background .15s;
}
.btn-circle:hover { background: var(--paper-100); border-color: var(--accent-500); }

.calendar-scroll {
  overflow-x: auto;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
}

.calendar-grid {
  background: var(--paper-000);
  min-width: 760px;
}

.cal-day-header {
  display: grid;
  background: var(--paper-000);
  color: var(--ink-900);
  border-bottom: 1px solid var(--line-200);
  position: sticky;
  top: 0;
  z-index: 2;
}
.cal-day-header.cols-7 { grid-template-columns: 90px repeat(7, 1fr); }
.cal-day-header.cols-1 { grid-template-columns: 90px 1fr; }
.cal-day-header .time-col { display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; }
.cal-day-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 4px 14px;
}
.cal-day-name { font-size: 11px; font-weight: 700; letter-spacing: .03em; color: var(--steel-500); text-transform: uppercase; }
.cal-day-num { font-size: 20px; font-weight: 600; color: var(--ink-900); line-height: 1; }
.cal-day-col.today .cal-day-name { color: var(--accent-600); }
.cal-day-col.today .cal-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-500);
  color: #fff;
}

.cal-body { position: relative; }
.cal-row { display: grid; }
.cal-row.cols-7 { grid-template-columns: 90px repeat(7, 1fr); }
.cal-row.cols-1 { grid-template-columns: 90px 1fr; }
.cal-time {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-900);
  border-top: 1px solid var(--line-200);
}
.cal-cell {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 2px;
  border-top: 1px solid var(--line-200);
  border-right: 1px solid var(--line-200);
  min-height: 56px;
  position: relative;
}
.cal-cell.past-cell { background: rgba(0, 0, 0, 0.03); }

.now-line {
  position: absolute;
  height: 0;
  border-top: 2px solid var(--danger-500);
  z-index: 3;
  pointer-events: none;
}
.now-line::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger-500);
}
.room-cal-block { margin-bottom: 28px; }
.room-cal-block:last-child { margin-bottom: 20px; }
.room-cal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-900);
  background: var(--paper-100);
  border-bottom: 1px solid var(--line-200);
  border-left: 4px solid var(--line-200);
}
.room-cal-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.cal-event {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 4px;
  background: var(--success-500);
  color: #fff;
  font-size: 11px;
  line-height: 1.25;
  padding: 3px 6px;
  overflow: hidden;
}
.cal-event strong { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event span { display: block; font-size: 10px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.continued { opacity: 0.55; }
.cal-add {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--success-500);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.35s ease;
}
.cal-add::before {
  content: '+';
  opacity: 0;
  transition: opacity 0.35s ease;
}
.cal-add:hover { background: var(--success-100); }
.cal-add:hover::before { opacity: 1; }

/* ---- Month grid (มุมมอง "เดือน") ---- */
.month-grid-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--paper-000); border-bottom: 1px solid var(--line-200); }
.month-grid-head div { text-align: center; padding: 10px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; color: var(--steel-500); text-transform: uppercase; }
.month-grid-body { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-cell { min-height: 98px; border-top: 1px solid var(--line-200); border-right: 1px solid var(--line-200); padding: 6px; display: flex; flex-direction: column; gap: 3px; position: relative; }
.month-cell[data-room-id] { cursor: pointer; transition: background-color .2s ease; }
.month-cell[data-room-id]:hover { background: var(--paper-100); }
.month-cell[data-room-id]::after {
  content: '+';
  position: absolute;
  top: 4px;
  right: 8px;
  color: var(--success-500);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  transition: opacity .2s ease;
}
.month-cell[data-room-id]:hover::after { opacity: 1; }
.month-cell.other-month { background: rgba(0, 0, 0, 0.015); color: var(--steel-300); }
.month-cell.other-month .month-date-num { color: var(--steel-300); }
.month-cell.past-cell { background: rgba(0, 0, 0, 0.03); }
.month-date-num { font-size: 13px; font-weight: 600; color: var(--ink-900); align-self: flex-start; }
.month-cell.is-today { background: var(--success-100); }
.month-cell.is-today.other-month { background: rgba(0, 0, 0, 0.015); }
.month-cell.is-today .month-date-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-500); color: #fff; font-size: 12px; }
.month-chip { background: var(--success-500); color: #fff; border-radius: 5px; padding: 2px 6px; font-size: 10.5px; line-height: 1.35; display: flex; align-items: center; gap: 4px; overflow: hidden; }
.month-chip .t { font-weight: 700; flex-shrink: 0; display: inline-flex; align-items: center; gap: 2px; }
.month-chip .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.month-more { font-size: 10px; font-weight: 700; color: var(--accent-600); padding: 1px 2px; }

.room-filter-select { min-width: 220px; width: auto; }

/* -------------------------------- Auth pages ------------------------------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  flex: 1;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper-000);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 32px 30px;
}
.auth-card .brand-mark {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--accent-500); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  margin-bottom: 16px;
}
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card p.subtitle { color: var(--steel-500); font-size: 13.5px; margin: 0 0 22px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--steel-500);
}

/* -------------------------------- Site footer ------------------------------ */
.site-footer {
  margin-top: 40px;
  background: var(--brand-grad);
  color: rgba(255,255,255,0.9);
}
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 24px 24px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
}
.footer-col h3 { color: #fff; font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.footer-col p { font-size: 13.5px; line-height: 1.7; color: rgba(255,255,255,0.82); margin: 0; }
.footer-col a { display: block; color: rgba(255,255,255,0.82); text-decoration: none; font-size: 13.5px; margin-bottom: 8px; }
.footer-col a:hover { color: #fff; text-decoration: underline; }
/* รอบที่ 11.29: ลิงก์ "จองห้องประชุม" ใน footer เปลี่ยนเป็น <button> เพื่อเปิด booking modal
   แทนการไปหน้าใหม่ — reset ให้หน้าตาเหมือน .footer-col a ทุกประการ */
.footer-link-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 8px;
  font-family: inherit;
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-size: 13.5px;
  cursor: pointer;
}
.footer-link-btn:hover { color: #fff; text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.18);
  text-align: center;
  padding: 16px 24px;
  font-size: 12.5px;
  color: rgba(255,255,255,0.75);
}

@media (max-width: 860px) {
  .navbar-inner { padding: 10px 16px; }
  .navbar-nav { order: 3; width: 100%; overflow-x: auto; gap: 4px; }
  .page-wrap { padding: 0 16px; }
  .main { padding: 20px 0 40px; }
  .field-row { flex-direction: column; gap: 0; }
  .footer-inner { grid-template-columns: 1fr; padding: 32px 20px 20px; }
}

@media print {
  .print-hide { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; }
}

/* -------------------------------- Dashboard bits --------------------------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; gap: 20px; margin-bottom: 20px; }
#popular-rooms-card, #recent-activity-card { align-self: start; }
.two-col > .card { display: flex; flex-direction: column; overflow: hidden; margin-top: 0; }
.two-col > .card .mini-list,
.two-col > .card .empty-state { flex: 1; }
.recent-activity-list { overflow-y: auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.card-head h2 { font-size: 15px; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head a { font-size: 13px; font-weight: 600; text-decoration: none; color: var(--accent-600); }

.mini-list { display: flex; flex-direction: column; gap: 10px; }
.mini-list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--paper-100); border-radius: var(--radius-sm); font-size: 13.5px;
}
.mini-list-item .title { font-weight: 600; color: var(--ink-900); }
.mini-list-item .meta { color: var(--steel-500); font-size: 12.5px; }
.mini-list-item .rank-row { display: flex; align-items: center; gap: 4px; }

.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-500); color: #fff; font-size: 11.5px; font-weight: 700; flex-shrink: 0;
}

.dash-greeting { color: var(--steel-500); margin: 0; }

@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ---------------------------------- Modal ----------------------------------- */
dialog.modal {
  border: none;
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 540px;
  width: 92vw;
  box-shadow: var(--shadow-card);
  background: var(--paper-000);
  color: var(--ink-900);
}
dialog.modal::backdrop { background: rgba(15, 35, 25, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 8px; }
.modal-close {
  background: none; border: none; font-size: 18px; line-height: 1;
  cursor: pointer; color: var(--steel-500); padding: 4px;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--danger-500); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.modal-actions-split { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions-split .btn { flex: 1; justify-content: center; }
.readonly-field {
  padding: 9px 11px; border: 1px solid var(--line-200); border-radius: var(--radius-sm);
  background: var(--paper-100); color: var(--steel-500); font-size: 14.5px;
}

/* ------------------------------ Left sidebar shell -------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--brand-grad);
  color: #fff;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 4px 8px 4px;
  margin-bottom: 4px;
}
.sidebar .brand-icon {
  font-size: 19px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.16);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.sidebar .brand-text { font-size: 14px; font-weight: 700; line-height: 1.3; color: #fff; }
.sidebar .brand-text small { display: block; font-weight: 400; font-size: 10.5px; color: rgba(255,255,255,0.78); margin-top: 2px; }

.sidebar .user-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: rgba(255,255,255,0.78);
  text-align: left;
}
.sidebar .user-top-icon {
  width: 28px; height: 28px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.16);
  border-radius: 50%;
}
.sidebar .user-top-text {
  min-width: 0;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar .user-top-text small {
  display: block;
  font-weight: 400;
  font-size: 10.5px;
  color: rgba(255,255,255,0.78);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar nav {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar nav a {
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar nav a:hover { background: rgba(255,255,255,0.1); }
.sidebar nav a.active { background: rgba(255,255,255,0.22); font-weight: 700; }

.sidebar .divider {
  height: 1px;
  background: rgba(255,255,255,0.16);
  margin: 14px 8px;
}
.sidebar .nav-section-label {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  padding: 4px 12px 4px;
}

.sidebar .user-box {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid rgba(255,255,255,0.16);
  font-size: 12.5px;
  color: rgba(255,255,255,0.78);
}
.sidebar .user-box .btn-logout {
  width: 100%;
  justify-content: center;
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar .user-box .btn-logout:hover { background: rgba(255,255,255,0.24); }

.main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.main-col .main {
  flex: 1;
  padding: 28px 36px 40px;
  max-width: 1180px;
  width: 100%;
}
.main-col .site-footer { margin-top: 0; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 12px 16px; overflow-x: auto; }
  .sidebar .brand, .sidebar .user-top, .sidebar .user-box, .sidebar .divider, .sidebar .nav-section-label { display: none; }
  .sidebar nav { flex-direction: row; margin-top: 0; }
  .main-col .main { padding: 20px; }
}
/* ------------------------------ Room cards (admin) --------------------------- */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.room-card {
  background: var(--paper-000);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.room-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.room-card-head h3 { font-size: 16px; margin: 0; display: flex; align-items: center; gap: 7px; }
.room-card-meta { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--steel-500); }
.room-card-meta .row { display: flex; align-items: center; gap: 6px; }
.room-card-stats {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line-200); padding-top: 12px;
  font-size: 12.5px; color: var(--steel-500);
}
.room-card-stats strong { color: var(--ink-900); font-size: 14px; }
.room-card-actions { display: flex; gap: 10px; }
.room-card-actions .btn, .room-card-actions form { flex: 1; }
.room-card-actions .btn { width: 100%; justify-content: center; }

/* ===== Page Fade Transition — Option C: Native View Transitions, scoped เฉพาะเนื้อหา (รอบที่ 11.22) =====
   ใช้ <meta name="view-transition" content="same-origin"> ใน head.ejs เป็นตัวเปิดใช้งานหลัก
   (เบราว์เซอร์จัดการ cross-fade ระหว่างหน้าเดิม/หน้าใหม่ให้เองทั้งหมด ไม่ต้องพึ่ง JS เลย)
   ตั้งใจให้ fade เฉพาะ <main class="main"> (ส่วนเนื้อหา) เท่านั้น — sidebar/ส่วนอื่นของหน้า
   ไม่ fade เลย สลับทันที ไม่กระพริบ ไม่ขยับ
   เบราว์เซอร์ที่ไม่รองรับ (เช่น Firefox, Safari รุ่นเก่า) จะข้ามไปแบบเปลี่ยนหน้าปกติ ไม่มี error */
.main { view-transition-name: main-content; }

@media (prefers-reduced-motion: no-preference) {
  /* ส่วนที่เหลือของหน้า (sidebar, footer ฯลฯ) ยังอยู่ใน root group เดิม แต่ปิด animation
     ให้สลับทันทีไม่มีเอฟเฟกต์ */
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }

  /* ปิด animation ของ "กลุ่ม" (group) ที่ครอบ main-content — กลุ่มนี้เป็นตัวคำนวณ
     ตำแหน่ง/ขนาดยืด-หดระหว่างหน้าเดิมกับหน้าใหม่ตามค่าเริ่มต้นของเบราว์เซอร์ ถ้าปล่อยไว้
     และสองหน้ามีความสูงเนื้อหาต่างกันมาก (เช่น หน้าปฏิทินสูงกว่าหน้าแดชบอร์ดมาก) จะเห็นเป็น
     การซูม/ยืดภาพผิดรูปแทนที่จะเป็นการจางเข้า-จางออกตรง ๆ — ปิดไว้ให้เหลือแค่ครอสเฟดล้วน ๆ
     ที่ตำแหน่งเดิม ลื่นและนิ่งกว่า ไม่มีอาการกระตุก/บิดเบี้ยวเวลาเปลี่ยนไปหน้าที่ความสูงต่างกัน */
  ::view-transition-group(main-content) {
    animation: none;
  }

  ::view-transition-old(main-content),
  ::view-transition-new(main-content) {
    animation-duration: 0.28s;
    animation-timing-function: ease-in-out;
  }
}
