@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
  --ink: #20233b;
  --muted: #777b96;
  --line: #e9eaf4;
  --surface: #ffffff;
  --surface-soft: #f8f8fd;
  --purple: #6c5ce7;
  --purple-dark: #5644d9;
  --cyan: #24b8d8;
  --coral: #ff727d;
  --green: #39b980;
  --orange: #f5a146;
  --shadow: 0 18px 50px rgba(47, 43, 91, 0.09);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #f6f6fb; }

body,
button,
input,
select {
  font-family: 'IBM Plex Sans Thai', 'Segoe UI', Tahoma, sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 7%, rgba(108, 92, 231, 0.1), transparent 23rem),
    radial-gradient(circle at 18% 92%, rgba(36, 184, 216, 0.09), transparent 24rem),
    #f7f7fc;
  overflow-x: hidden;
}

button,
select,
input { font-size: 14px; }

button { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(3px);
  pointer-events: none;
  animation: floatAmbient 10s ease-in-out infinite;
}

.ambient-one {
  width: 170px;
  height: 170px;
  top: -76px;
  right: 14%;
  background: linear-gradient(135deg, rgba(255, 114, 125, 0.16), rgba(108, 92, 231, 0.16));
}

.ambient-two {
  width: 110px;
  height: 110px;
  bottom: 3%;
  left: 22%;
  background: rgba(36, 184, 216, 0.12);
  animation-delay: -4s;
}

@keyframes floatAmbient {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, 18px, 0); }
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px 22px;
  background: rgba(255, 255, 255, 0.9);
  border-right: 1px solid rgba(229, 230, 241, 0.95);
  box-shadow: 10px 0 40px rgba(53, 48, 94, 0.035);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 7px 5px;
}

.brand-logo {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 76px;
  width: 76px;
  height: 55px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid rgba(42, 76, 142, .15);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(237,244,255,.94));
  box-shadow: 0 10px 24px rgba(20, 59, 125, .18), inset 0 1px 0 #fff;
  animation: companyLogoFloat 4.2s ease-in-out infinite;
}

.brand-logo::before {
  position: absolute;
  content: "";
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(48, 119, 220, .18), transparent 68%);
  animation: companyLogoPulse 2.8s ease-in-out infinite;
}

.brand-logo::after {
  position: absolute;
  content: "";
  inset: -35% auto -35% -45%;
  width: 22px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.9), transparent);
  transform: rotate(18deg);
  animation: companyLogoShine 4.8s ease-in-out infinite;
}

.brand-logo img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 5px rgba(15, 57, 130, .2));
  transition: transform 220ms ease, filter 220ms ease;
}

.brand:hover .brand-logo img { transform: scale(1.08); filter: drop-shadow(0 5px 8px rgba(15, 57, 130, .3)); }

@keyframes companyLogoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes companyLogoPulse {
  0%, 100% { opacity: .55; transform: scale(.86); }
  50% { opacity: 1; transform: scale(1.12); }
}

@keyframes companyLogoShine {
  0%, 68% { left: -45%; opacity: 0; }
  74% { opacity: .9; }
  92%, 100% { left: 125%; opacity: 0; }
}

.brand strong {
  display: block;
  font-family: 'Manrope', sans-serif;
  font-size: 19px;
  letter-spacing: -0.5px;
}

.brand small,
.profile-chip small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.primary-action,
.save-button {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #7a69ef, #5d4bdc);
  box-shadow: 0 12px 25px rgba(108, 92, 231, 0.28);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.primary-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 700;
}

.primary-action:hover,
.save-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(108, 92, 231, 0.35);
  filter: saturate(1.08);
}

.primary-action:active,
.save-button:active { transform: translateY(0) scale(0.985); }

.button-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 20px;
  line-height: 1;
}

.sidebar-section {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.75);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 700;
}

.section-heading small { color: var(--muted); font-weight: 500; }

.status-dot {
  width: 8px;
  height: 8px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #3ecf8e;
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.16);
}

#nav {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 12px;
}

#nav > div {
  max-width: 100% !important;
  margin-inline: auto;
}

.room-legend ul {
  display: grid;
  gap: 10px;
  padding: 2px;
  margin: 0;
  list-style: none;
}
.room-legend li { display: flex; align-items: center; gap: 10px; color: #575b73; font-size: 13px; }

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 4px;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent);
}

.legend-dot.purple { color: var(--purple); background: var(--purple); }
.legend-dot.blue { color: var(--cyan); background: var(--cyan); }
.legend-dot.green { color: var(--green); background: var(--green); }
.legend-dot.orange { color: var(--orange); background: var(--orange); }

.legend-label {
  min-width: 0;
  line-height: 1.35;
  white-space: normal;
}

.sidebar-tip {
  display: flex;
  gap: 11px;
  margin-top: auto;
  padding: 15px;
  border-radius: 17px;
  color: #5d4dcc;
  background: linear-gradient(135deg, #f1eeff, #eefaff);
}

.tip-icon {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: #fff;
  background: var(--purple);
}

.sidebar-tip strong { font-size: 12px; }
.sidebar-tip p { margin: 3px 0 0; color: #74708d; font-size: 11px; line-height: 1.55; }

.sidebar-footer {
  display: block;
  margin-top: 11px;
  padding: 0 7px;
  color: #8b879e;
  line-height: 1.55;
}

.sidebar-footer strong,
.sidebar-footer span { display: block; }
.sidebar-footer strong { color: #625d78; font-size: 9px; font-weight: 700; }
.sidebar-footer span { margin-top: 2px; font-size: 9px; }

.main-content { min-width: 0; padding: 34px 40px 44px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 26px;
}

.eyebrow,
.modal-kicker {
  margin: 0 0 7px;
  color: var(--purple);
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.7px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.8px;
}

.welcome-text { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

.topbar-actions { display: flex; align-items: center; gap: 13px; }

.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #ddd9f8;
  border-radius: 12px;
  color: #6154bd;
  background: #f3f0ff;
  text-decoration: none;
  font-size: 9px;
  font-weight: 600;
  transition: transform 150ms ease, background 150ms ease;
}

.admin-link:hover { background: #ebe7ff; transform: translateY(-1px); }

.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 999px;
  color: #298a64;
  background: #eafaf3;
  font-size: 11px;
  font-weight: 700;
}

.live-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #39bf86;
  box-shadow: 0 0 0 4px rgba(57, 191, 134, 0.13);
  animation: livePulse 2s infinite;
}

@keyframes livePulse { 50% { box-shadow: 0 0 0 7px rgba(57, 191, 134, 0); } }

.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 7px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.8);
}

.profile-chip strong { display: block; font-size: 12px; }

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #22b8d4, #5e6fea);
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 112px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(231, 231, 243, 0.8);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 30px rgba(45, 42, 85, 0.045);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.stat-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  font-size: 22px;
}

.stat-purple .stat-icon { color: #6654e2; background: #eeeafe; }
.stat-cyan .stat-icon { color: #159bb8; background: #e5f9fc; }
.stat-coral .stat-icon { color: #e95967; background: #ffeaed; }

.stat-card > div:nth-child(2) { position: relative; z-index: 1; min-width: 0; }
.stat-card span:not(.stat-spark) { display: block; color: var(--muted); font-size: 11px; }
.stat-card strong { display: inline-block; margin: 3px 7px 0 0; font-family: 'Manrope', sans-serif; font-size: 25px; line-height: 1; }
.stat-card small { color: #8b8fa3; font-size: 10px; }

.stat-spark {
  position: absolute;
  width: 96px;
  height: 96px;
  right: -30px;
  bottom: -48px;
  border: 18px solid rgba(108, 92, 231, 0.06);
  border-radius: 50%;
}

.stat-cyan .stat-spark { border-color: rgba(36, 184, 216, 0.07); }
.stat-coral .stat-spark { border-color: rgba(255, 114, 125, 0.07); }

.calendar-panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid rgba(231, 231, 242, 0.85);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.91);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 19px;
}

.calendar-title-group,
.date-navigation,
.calendar-tools { display: flex; align-items: center; }

.calendar-title-group { gap: 15px; }
.date-navigation { gap: 5px; }

.icon-button,
.today-button,
.secondary-button,
.delete-button {
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  color: #696d83;
  font-family: Arial, sans-serif;
  font-size: 24px;
}

.today-button {
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--purple);
  font-size: 11px;
  font-weight: 700;
}

.icon-button:hover,
.today-button:hover,
.secondary-button:hover { border-color: #cfc9fa; background: #f7f5ff; transform: translateY(-1px); }

.calendar-title-group h2 { margin: 0; font-size: 16px; }
.calendar-title-group p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }

.calendar-tools { justify-content: flex-end; gap: 9px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 210px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #989bb0;
  background: #fafafd;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-box:focus-within { border-color: #bdb5f8; box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.08); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; }

.room-filter select {
  height: 38px;
  max-width: 150px;
  padding: 0 30px 0 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  color: #60647b;
  background: #fafafd;
  font-size: 11px;
}

.view-switcher {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: #f0f0f7;
}

.view-switcher button {
  min-width: 54px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  color: #7d8094;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 160ms ease;
}

.view-switcher button:hover { color: var(--purple); }
.view-switcher button.selected { color: #fff; background: var(--purple); box-shadow: 0 5px 12px rgba(108, 92, 231, 0.22); }

.calendar-stage { min-width: 0; overflow: hidden; border: 1px solid #eeeef5; border-radius: 18px; }

/* DayPilot skin refinements */
.month_default_main,
.calendar_default_main,
.navigator_default_main { border: 0 !important; font-family: 'IBM Plex Sans Thai', sans-serif !important; }

.month_default_header_inner,
.calendar_default_colheader_inner {
  color: #777b91 !important;
  background: #f8f8fc !important;
  border-color: #eeeeF5 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}

.month_default_cell_inner,
.calendar_default_cell_inner { border-color: #f0f0f6 !important; background: #fff !important; }

.sunday-holiday .month_default_cell_inner,
.sunday-holiday .calendar_default_cell_inner,
.month_default_cell_inner:has(.holiday-cell-label) {
  background: repeating-linear-gradient(135deg, #fff1f3, #fff1f3 8px, #ffeaee 8px, #ffeaee 16px) !important;
}

.sunday-holiday .month_default_cell_header { color: #d45568 !important; }

.holiday-cell-label {
  margin-left: 6px;
  padding: 2px 5px;
  border-radius: 999px;
  color: #c74459;
  background: #ffdce2;
  font-size: 7px;
  font-weight: 700;
}

.month_default_cell_header { padding: 8px 10px !important; color: #7c7f94 !important; font-size: 11px !important; }

.month_default_event_inner,
.calendar_default_event_inner {
  position: relative;
  isolation: isolate;
  padding: 6px 8px !important;
  border: 0 !important;
  border-radius: 8px !important;
  box-shadow: 0 5px 12px rgba(45, 42, 82, 0.16) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  overflow: hidden !important;
  animation: eventCardReveal 380ms cubic-bezier(.2,.75,.25,1) both;
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease !important;
}

.month_default_event,
.calendar_default_event { transition: z-index 0s 180ms; }

.month_default_event:hover,
.calendar_default_event:hover { z-index: 30 !important; transition-delay: 0s; }

.month_default_event_inner::after,
.calendar_default_event_inner::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.28) 46%, transparent 72%);
  transform: translateX(-130%);
  pointer-events: none;
}

.month_default_event:hover .month_default_event_inner,
.calendar_default_event:hover .calendar_default_event_inner {
  filter: saturate(1.12) brightness(1.06);
  transform: translateY(-2px) scale(1.018);
  box-shadow: 0 10px 22px rgba(45, 42, 82, 0.27) !important;
}

.month_default_event:hover .month_default_event_inner::after,
.calendar_default_event:hover .calendar_default_event_inner::after { animation: eventCardShine 720ms ease-out; }

.event-card-content {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: #fff;
  line-height: 1.28;
  text-rendering: optimizeLegibility;
}

.event-card-content strong,
.event-card-content small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-card-content strong { font-size: 10.5px; font-weight: 800; letter-spacing: .05px; text-shadow: 0 1px 2px rgba(30, 25, 60, .24); }
.event-card-content small { color: rgba(255, 255, 255, 0.96); font-size: 8.5px; font-weight: 650; text-shadow: 0 1px 2px rgba(30, 25, 60, .18); }

.event-card-content strong span {
  display: inline-block;
  margin-right: 5px;
  padding: 1px 4px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, 0.24);
  font-family: 'Manrope', sans-serif;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

@keyframes eventCardReveal {
  from { opacity: 0; transform: translateY(7px) scale(.975); filter: saturate(.75); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: saturate(1); }
}

@keyframes eventCardShine {
  from { transform: translateX(-130%); }
  to { transform: translateX(130%); }
}

.navigator_default_title,
.navigator_default_titleleft,
.navigator_default_titleright {
  color: #52566c !important;
  background: transparent !important;
  border: 0 !important;
  font-size: 11px !important;
}

.navigator_default_dayheader {
  color: #9a9daf !important;
  background: transparent !important;
  border: 0 !important;
  font-size: 8px !important;
}

.navigator_default_cell,
.navigator_default_cell_inner {
  border: 0 !important;
  background: transparent !important;
}

.navigator_default_cell_box {
  display: grid !important;
  place-items: center;
  width: 24px !important;
  height: 24px !important;
  margin: 1px auto !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  font-size: 9px !important;
  line-height: 24px !important;
}

.navigator_default_cell:hover .navigator_default_cell_box {
  color: var(--purple) !important;
  background: #f0edff !important;
}

.navigator_default_select .navigator_default_cell_box {
  color: #fff !important;
  background: var(--purple) !important;
  box-shadow: 0 5px 12px rgba(108, 92, 231, 0.24);
}

.navigator-sunday .navigator_default_cell_box {
  color: #d45568 !important;
  background: #fff0f2 !important;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 190ms ease, visibility 190ms ease;
}

.modal-layer.is-open { visibility: visible; opacity: 1; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 26, 53, 0.52);
  backdrop-filter: blur(8px);
}

.app-modal {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 27px;
  background: #fff;
  box-shadow: 0 35px 90px rgba(23, 20, 57, 0.28);
  transform: translateY(18px) scale(0.975);
  transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
}

.modal-layer.is-open .app-modal { transform: translateY(0) scale(1); }
.modal-open { overflow: hidden; }

.modal-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 148px;
  padding: 25px 68px 25px 27px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 84% 24%, rgba(255, 255, 255, 0.2), transparent 8rem),
    linear-gradient(125deg, #6955e5, #7766ed 55%, #3ab8d5);
}

.modal-hero h2 { margin: 2px 0 4px; font-size: 25px; }
.modal-hero p { margin: 0; color: rgba(255, 255, 255, 0.78); font-size: 12px; }
.modal-hero .modal-kicker { margin: 0; color: #c9fbff; }

.modal-hero-art {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 86px;
  width: 86px;
  height: 86px;
}

.hero-calendar {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 22px rgba(255, 255, 255, 0.08);
  font-size: 28px;
  backdrop-filter: blur(8px);
  transform: rotate(-4deg);
}

.hero-orbit { position: absolute; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 50%; animation: orbitSpin 8s linear infinite; }
.orbit-one { width: 82px; height: 82px; }
.orbit-two { width: 104px; height: 48px; transform: rotate(35deg); animation-direction: reverse; }
@keyframes orbitSpin { to { rotate: 360deg; } }

.modal-close {
  position: absolute;
  z-index: 3;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 11px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  font: 22px/1 Arial, sans-serif;
  transition: transform 150ms ease, background 150ms ease;
}

.modal-close:hover { transform: rotate(7deg); background: rgba(255, 255, 255, 0.22); }

.modal-body { padding: 25px 28px; }

.form-section-title {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 17px;
}

.form-section-title.second { margin-top: 22px; }
.form-section-title > span { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 10px; color: #fff; background: var(--purple); font-size: 11px; font-weight: 700; box-shadow: 0 6px 13px rgba(108, 92, 231, 0.23); }
.form-section-title strong,
.form-section-title small { display: block; }
.form-section-title strong { font-size: 13px; }
.form-section-title small { margin-top: 1px; color: #999caf; font-size: 10px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }

.field { min-width: 0; }
.field > span { display: block; margin: 0 0 7px 3px; color: #555970; font-size: 11px; font-weight: 600; }
.field b { color: var(--coral); }

.input-shell {
  display: flex;
  align-items: center;
  min-height: 44px;
  border: 1px solid #e4e5ef;
  border-radius: 13px;
  background: #fafafd;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.input-shell:focus-within { border-color: #bdb5f8; background: #fff; box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.08); }
.field.has-error .input-shell { border-color: #ff929b; background: #fff8f8; box-shadow: 0 0 0 4px rgba(255, 114, 125, 0.08); }
.field.has-error .date-trigger,
.field.has-error .time-select-shell { border-color: #ff929b; background: #fff8f8; box-shadow: 0 0 0 4px rgba(255, 114, 125, 0.08); }

.input-shell i {
  display: grid;
  place-items: center;
  flex: 0 0 39px;
  align-self: stretch;
  color: #918aa8;
  font-style: normal;
  font-size: 14px;
}

.input-shell input,
.input-shell select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px 0 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
}

.field-error { display: block; min-height: 14px; padding: 3px 3px 0; color: #e75a67; font-size: 9px; }

.date-time-control {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(102px, .75fr);
  gap: 8px;
}

.date-trigger,
.time-select-shell {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 44px;
  margin: 0;
  border: 1px solid #e4e5ef;
  border-radius: 13px;
  color: var(--ink);
  background: #fafafd;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.date-trigger {
  gap: 9px;
  padding: 0 11px;
  text-align: left;
  cursor: pointer;
}

.date-trigger:hover,
.date-trigger:focus,
.time-select-shell:focus-within {
  border-color: #bdb5f8;
  outline: 0;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.08);
}

.date-trigger i,
.time-select-shell i {
  color: var(--purple);
  font-style: normal;
}

.date-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.time-select-shell { padding-left: 10px; }
.time-select-shell select {
  width: 100%;
  height: 42px;
  padding: 0 7px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-family: 'Manrope', 'IBM Plex Sans Thai', sans-serif;
  font-size: 11px;
  font-weight: 700;
}

.thai-date-picker {
  position: fixed;
  z-index: 25;
  top: 50%;
  left: 50%;
  width: min(330px, calc(100% - 28px));
  padding: 18px;
  border: 1px solid #e4e1f8;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(30, 26, 67, 0.28);
  transform: translate(-50%, -50%);
  animation: calendarPop 180ms ease;
}

.thai-date-picker[hidden] { display: none; }

@keyframes calendarPop {
  from { opacity: 0; transform: translate(-50%, -47%) scale(.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.date-picker-header {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.date-picker-header strong { text-align: center; font-size: 14px; }
.date-picker-header button,
.date-picker-footer button {
  border: 1px solid #e8e7f1;
  border-radius: 11px;
  color: #686c82;
  background: #f8f8fc;
  cursor: pointer;
}

.date-picker-header button { width: 36px; height: 36px; font: 22px/1 Arial, sans-serif; }
.date-picker-header button:hover,
.date-picker-footer button:hover { color: var(--purple); border-color: #cfc9fa; background: #f2efff; }

.date-picker-weekdays,
.date-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.date-picker-weekdays { margin-bottom: 5px; }
.date-picker-weekdays span { padding: 4px 0; color: #9a9daf; text-align: center; font-size: 9px; font-weight: 600; }

.date-picker-day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 11px;
  color: #4f5369;
  background: transparent;
  cursor: pointer;
  font-family: 'Manrope', 'IBM Plex Sans Thai', sans-serif;
  font-size: 10px;
  transition: color 130ms ease, background 130ms ease, transform 130ms ease;
}

.date-picker-day:hover { color: var(--purple); background: #f0edff; transform: translateY(-1px); }
.date-picker-day.is-other { color: #c0c2ce; }
.date-picker-day.is-today { color: var(--purple); box-shadow: inset 0 0 0 1px #bfb8f7; }
.date-picker-day.is-selected { color: #fff; background: linear-gradient(135deg, #7766ed, #5b48db); box-shadow: 0 7px 14px rgba(108, 92, 231, 0.25); }
.date-picker-day.is-sunday,
.date-picker-day.is-sunday:hover {
  color: #d45568;
  background: #fff0f2;
  box-shadow: inset 0 0 0 1px #ffd6dd;
  cursor: not-allowed;
  opacity: 0.82;
  transform: none;
}

.date-picker-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid #efeff5;
}

.date-picker-footer button { min-height: 34px; padding: 0 13px; font-size: 10px; font-weight: 700; }
.date-picker-footer button:first-child { color: var(--purple); background: #f1eeff; }

.duration-summary {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 17px;
  padding: 13px 15px;
  border: 1px solid #dedafa;
  border-radius: 14px;
  color: #5f53bd;
  background: linear-gradient(90deg, #f5f2ff, #f3fbfd);
}

.conflict-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 17px;
  padding: 14px 15px;
  border: 1px solid #ffc9ce;
  border-radius: 14px;
  color: #b63f4b;
  background: linear-gradient(90deg, #fff3f4, #fff8f6);
  animation: conflictIn 220ms ease;
}

.conflict-alert[hidden] { display: none; }

.conflict-icon {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: #fff;
  background: #e85d69;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
}

.conflict-alert strong { display: block; font-size: 11px; }
.conflict-alert p { margin: 3px 0 0; color: #a45f66; font-size: 10px; line-height: 1.5; }

.conflict-alert.is-checking {
  color: #5b53af;
  border-color: #d8d3fa;
  background: linear-gradient(90deg, #f5f3ff, #f2f9ff);
}

.conflict-alert.is-checking .conflict-icon { background: var(--purple); animation: availabilityPulse 1s ease-in-out infinite; }
.conflict-alert.is-checking p { color: #77739b; }

.conflict-alert.is-available {
  color: #267b59;
  border-color: #bde8d5;
  background: linear-gradient(90deg, #ecfaf4, #f2fcf8);
}

.conflict-alert.is-available .conflict-icon { background: #35ad7b; }
.conflict-alert.is-available p { color: #5c8977; }

#bookingRoomShell.is-checking { border-color: #b8aff8; box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1); }
#bookingRoomShell.is-available { border-color: #6fd0aa; background: #f0fbf6; box-shadow: 0 0 0 3px rgba(53, 173, 123, 0.1); }
#bookingRoomShell.is-available i { color: #29966b; }
.date-time-control.is-available .date-trigger,
.date-time-control.is-available .time-select-shell {
  border-color: #6fd0aa;
  background: #f0fbf6;
  box-shadow: 0 0 0 3px rgba(53, 173, 123, 0.08);
}

.room-availability-status {
  display: block;
  margin: 6px 0 0 3px;
  color: #6a6683;
  font-size: 9px;
  font-weight: 700;
}

.room-availability-status[hidden] { display: none; }
.room-availability-status.is-available { color: #22875f; }
.room-availability-status.is-unavailable { color: #c84b5a; }

.day-availability {
  margin-top: 16px;
  padding: 15px;
  border: 1px solid #d9e8e1;
  border-radius: 16px;
  background: linear-gradient(135deg, #f8fffb, #f4fbff);
}

.day-availability[hidden] { display: none; }

.day-availability-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.day-availability-heading strong { display: block; color: #34354a; font-size: 11px; }
.day-availability-heading small { display: block; margin-top: 2px; color: #7d8092; font-size: 9px; }
.availability-key { display: flex; gap: 10px; color: #777b8e; font-size: 8px; font-weight: 700; }
.availability-key span { display: flex; align-items: center; gap: 4px; }
.availability-key i { width: 7px; height: 7px; border-radius: 50%; }
.availability-key i.free { background: #36b27d; }
.availability-key i.busy { background: #e85f70; }

.availability-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.availability-block {
  min-height: 54px;
  padding: 9px 11px;
  border-radius: 12px;
  text-align: left;
  font-family: inherit;
}

.availability-block strong,
.availability-block small { display: block; }
.availability-block strong { font-size: 10px; }
.availability-block small { margin-top: 3px; overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.availability-block.is-free { border: 1px solid #70d2aa; color: #207c59; background: #e9faf2; cursor: pointer; transition: transform 140ms ease, box-shadow 140ms ease; }
.availability-block.is-free:hover { transform: translateY(-1px); box-shadow: 0 7px 15px rgba(45, 165, 113, 0.15); }
.availability-block.is-busy { border: 1px solid #f2a2ac; color: #b84050; background: #fff0f2; }
.availability-block.is-busy small { color: #c86a76; }
.availability-hint { display: block; margin-top: 9px; color: #718076; font-size: 8px; }
.availability-loading,
.availability-holiday { grid-column: 1 / -1; padding: 12px; border-radius: 11px; color: #716b91; background: #f1effc; font-size: 9px; text-align: center; }
.day-availability.is-holiday { border-color: #f2bdc5; background: #fff7f8; }
.day-availability.is-holiday .availability-holiday { color: #bd4b5a; background: #ffecef; }

@keyframes availabilityPulse { 50% { opacity: .55; transform: scale(.9); } }

@keyframes conflictIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.duration-summary > span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: #fff; background: linear-gradient(135deg, var(--purple), var(--cyan)); }
.duration-summary strong,
.duration-summary small { display: block; }
.duration-summary strong { font-size: 11px; }
.duration-summary small { margin-top: 1px; color: #7f7b98; font-size: 10px; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 17px 28px;
  border-top: 1px solid #ededf4;
  background: #fbfbfd;
}

.secondary-button,
.save-button,
.delete-button { min-height: 42px; padding: 0 19px; border-radius: 12px; font-weight: 700; }
.secondary-button { color: #696d83; }

.save-button { display: inline-flex; align-items: center; justify-content: center; gap: 17px; min-width: 150px; }
.save-button i { font-style: normal; font-size: 18px; }
.save-button:disabled { opacity: 0.65; cursor: wait; transform: none; }

.detail-modal { width: min(580px, 100%); }
.detail-header { position: relative; padding: 35px 28px 28px; color: #fff; text-align: center; background: linear-gradient(135deg, #6754df, #806dee 62%, #46bdd6); }
.detail-badge { display: inline-block; margin-bottom: 16px; padding: 5px 9px; border-radius: 99px; color: #dcfaff; background: rgba(255, 255, 255, 0.14); font-family: 'Manrope', sans-serif; font-size: 8px; font-weight: 800; letter-spacing: 1.5px; }
.detail-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 12px; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 18px; background: rgba(255, 255, 255, 0.15); font-size: 23px; transform: rotate(-4deg); }
.detail-header h2 { margin: 0; font-size: 21px; }
.detail-header p { margin: 4px 0 0; color: rgba(255, 255, 255, 0.77); font-size: 11px; }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-item { min-width: 0; padding: 14px; border: 1px solid #ebebf3; border-radius: 14px; background: #fafafd; }
.detail-item span,
.detail-item strong { display: block; }
.detail-item span { margin-bottom: 4px; color: #999caf; font-size: 9px; }
.detail-item strong { overflow-wrap: anywhere; color: #4f536a; font-size: 11px; line-height: 1.55; }

.color-editor { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 17px; padding: 15px; border-radius: 15px; background: #f5f3ff; }
.color-editor strong,
.color-editor small { display: block; }
.color-editor strong { font-size: 11px; }
.color-editor small { margin-top: 2px; color: #8c89a0; font-size: 9px; }
.color-options { display: flex; gap: 7px; }
.color-option { width: 24px; height: 24px; padding: 0; border: 3px solid #fff; border-radius: 8px; cursor: pointer; box-shadow: 0 0 0 1px rgba(61, 59, 89, 0.1); transition: transform 150ms ease, box-shadow 150ms ease; }
.color-option:hover,
.color-option.is-selected { transform: translateY(-2px) scale(1.08); box-shadow: 0 0 0 2px #aaa1ec; }

.department-swatch {
  display: block;
  flex: 0 0 42px;
  width: 42px;
  height: 30px;
  border: 4px solid #fff;
  border-radius: 11px;
  box-shadow: 0 0 0 1px rgba(61, 59, 89, 0.1), 0 6px 14px rgba(46, 42, 81, 0.14);
}

.detail-footer { justify-content: space-between; }
.delete-button { color: #d95462; border-color: #ffd8db; background: #fff4f5; }
.delete-button:hover { background: #ffe8ea; }
.delete-button.is-confirming { color: #fff; border-color: #dc5965; background: #dc5965; }
.save-button.compact { min-width: 110px; }

.toast-stack {
  position: fixed;
  z-index: 1300;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 10px;
  width: min(350px, calc(100vw - 44px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 15px;
  color: #fff;
  background: #33314e;
  box-shadow: 0 15px 35px rgba(28, 26, 53, 0.22);
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  animation: toastIn 220ms ease forwards;
}

.toast.success { background: linear-gradient(135deg, #269d70, #3abf8a); }
.toast.error { background: linear-gradient(135deg, #d94e5d, #f27880); }
.toast-icon { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border-radius: 9px; background: rgba(255, 255, 255, 0.17); }
.toast strong,
.toast small { display: block; }
.toast strong { font-size: 11px; }
.toast small { margin-top: 1px; color: rgba(255, 255, 255, 0.78); font-size: 9px; }
@keyframes toastIn { to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 240px minmax(0, 1fr); }
  .sidebar { padding: 25px 17px; }
  .main-content { padding: 30px 25px 40px; }
  .calendar-toolbar { align-items: flex-start; flex-direction: column; }
  .calendar-tools { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .search-box { flex: 1 1 230px; }
}

@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar { position: static; flex-direction: row; align-items: center; gap: 12px; padding: 14px 18px; border: 0; border-bottom: 1px solid var(--line); }
  .brand { flex: 1; padding: 0; }
  .brand small { display: none; }
  .brand-mark { width: 40px; height: 40px; padding: 8px; }
  .primary-action { width: auto; min-height: 42px; padding: 0 15px; }
  .sidebar-section,
  .sidebar-tip,
  .sidebar-footer { display: none; }
  .main-content { padding: 24px 18px 34px; }
  .stats-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); overflow-x: auto; padding-bottom: 5px; }
  .stat-card { min-height: 102px; }
  .topbar { align-items: flex-start; }
  .profile-chip { display: none; }
}

@media (max-width: 640px) {
  .sidebar { position: sticky; top: 0; z-index: 50; }
  .brand strong { font-size: 16px; }
  .primary-action span:nth-child(2) { display: none; }
  .primary-action { width: 42px; padding: 0; border-radius: 13px; }
  .button-icon { background: transparent; }
  .topbar { margin-bottom: 18px; }
  .topbar-actions { display: none; }
  .topbar h1 { font-size: 26px; }
  .stats-grid { gap: 11px; margin-right: -18px; }
  .stat-card { padding: 15px; }
  .stat-icon { width: 42px; height: 42px; flex-basis: 42px; }
  .calendar-panel { padding: 14px; border-radius: 21px; }
  .calendar-title-group { align-items: flex-start; flex-direction: column; gap: 10px; }
  .calendar-tools { display: grid; grid-template-columns: 1fr 1fr; }
  .search-box { grid-column: 1 / -1; min-width: 0; }
  .room-filter select { width: 100%; max-width: none; }
  .view-switcher { justify-self: end; }
  .view-switcher button { min-width: 42px; padding: 0 7px; }
  .modal-layer { padding: 10px; align-items: end; }
  .app-modal { max-height: calc(100vh - 20px); border-radius: 23px 23px 17px 17px; }
  .modal-hero { min-height: 124px; padding: 22px 55px 22px 20px; }
  .modal-hero-art { display: none; }
  .modal-hero h2 { font-size: 22px; }
  .modal-body { padding: 20px; }
  .form-grid,
  .detail-grid { grid-template-columns: 1fr; gap: 11px; }
  .date-time-control { grid-template-columns: minmax(0, 1fr) 105px; }
  .form-section-title.second { margin-top: 16px; }
  .modal-footer { padding: 14px 20px; }
  .secondary-button,
  .save-button { flex: 1; }
  .detail-header { padding: 28px 20px 23px; }
  .color-editor { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
