:root {
  --bg: #F5F7FB;
  --panel: #FFFFFF;
  --text: #111827;
  --muted: #6B7280;
  --line: #E5E7EB;
  --primary: #0A84FF;
  --secondary: #E5F1FF;
  --danger: #FF3B30;
  --warning: #FFCC00;
  --ok: #34C759;
  --sidebar: #0A84FF;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Thai", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: linear-gradient(180deg, #4055df, #4b35a7);
  color: #fff;
  padding: 18px;
  overflow-y: auto;
  z-index: 50;
}

.mobile-menu-toggle {
  display: none;
  position: sticky;
  top: 0;
  z-index: 60;
  width: 100%;
  border: 0;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  font-weight: 700;
  margin-bottom: 22px;
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar a {
  padding: 11px 12px;
  border-radius: 8px;
  color: rgba(255, 255, 255, .92);
}

.sidebar a.active,
.sidebar a:hover {
  background: rgba(0, 0, 0, .28);
}

.app {
  margin-left: 260px;
  min-height: 100vh;
  padding: 24px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 28px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.panel,
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

.narrow {
  max-width: 980px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(460px, 100%);
}

.login-logo {
  width: 110px;
  height: 110px;
  object-fit: contain;
  display: block;
  margin: 0 auto 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  background: #e8edf7;
  color: #172033;
  font: inherit;
  cursor: pointer;
}

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

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

.btn.ghost {
  background: #fff;
  border: 1px solid var(--line);
}

.btn.small {
  min-height: 32px;
  padding: 5px 10px;
}

.wide {
  width: 100%;
  margin-top: 10px;
}

.alert {
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: #ecfdf3;
  color: #067647;
}

.alert.error {
  background: #fef3f2;
  color: #b42318;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  margin-bottom: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 98px;
  resize: vertical;
}

.grid-form,
.filters,
.week-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.filters,
.week-toolbar {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 14px;
}

.span-2 {
  grid-column: span 2;
}

.check {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

.check input {
  width: auto;
}

.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.vehicle-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.vehicle-img,
.vehicle-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
}

.vehicle-img {
  object-fit: cover;
  display: block;
}

.vehicle-placeholder {
  display: grid;
  place-items: center;
  background: #eaf1ff;
  font-size: 44px;
}

.vehicle-body {
  padding: 16px;
}

.vehicle-body h2 {
  margin: 0 0 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: #edf2ff;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.badge.ok {
  background: #dcfae6;
  color: var(--ok);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  font-weight: 700;
}

.thumb {
  width: 78px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
}

.thumb-placeholder {
  width: 78px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eaf1ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.day-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  margin-bottom: 12px;
}

.day-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.booking-item {
  display: block;
  width: 100%;
  border: 0;
  text-align: left;
  font: inherit;
  background: #eff6ff;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}

.muted {
  color: var(--muted);
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.user {
  color: var(--muted);
  margin-right: 8px;
}

.top-actions,
.quick-actions,
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.reason-input {
  width: 160px;
  min-height: 32px;
  padding: 5px 8px;
  font-size: 13px;
}

.settings-logo-preview {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}

.settings-logo-preview.small {
  width: 64px;
  height: 64px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.stat-card strong {
  display: block;
  font-size: 34px;
  line-height: 1;
  margin-bottom: 8px;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-approved {
  background: #dcfce7;
  color: #166534;
}

.status-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.status-cancelled {
  background: #e5e7eb;
  color: #374151;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 8px;
  overflow-x: auto;
}

.calendar-week-labels {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.calendar-day {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.calendar-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.event {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 6px;
  margin-top: 6px;
  text-align: left;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.event span,
.event small,
.booking-item span,
.booking-item small {
  display: block;
}

.event small,
.booking-item small {
  margin-top: 2px;
  opacity: .85;
  line-height: 1.35;
}

.event.status-pending { background: #fef3c7; color: #92400e; }
.event.status-approved { background: #dcfce7; color: #166534; }
.event.status-rejected { background: #fee2e2; color: #991b1b; }
.event.status-cancelled { background: #e5e7eb; color: #374151; }

.modal {
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  border: 0;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
}

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}

.modal::backdrop {
  background: rgba(15, 23, 42, .45);
}

.modal-close {
  float: right;
  border: 0;
  background: #eef2f7;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.detail-list {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 14px;
}

.detail-list dt {
  font-weight: 700;
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
}

@media print {
  .sidebar,
  .topbar,
  .filters .btn,
  .btn {
    display: none !important;
  }
  .app {
    margin: 0;
    padding: 0;
  }
  .panel {
    box-shadow: none;
    border: 0;
  }
  table {
    min-width: 0;
    font-size: 11px;
  }
}

@media (max-width: 900px) {
  .mobile-menu-toggle {
    display: block;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 310px);
    border-radius: 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
    pointer-events: auto;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar nav {
    grid-template-columns: 1fr;
  }
  .app {
    margin-left: 0;
    padding: 14px;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .grid-form,
  .filters,
  .week-toolbar {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: span 1;
  }
  .sidebar nav {
    grid-template-columns: 1fr;
  }
  .panel,
  .auth-card {
    padding: 16px;
    border-radius: 10px;
  }
  .login-logo {
    width: 90px;
    height: 90px;
  }
  .btn {
    width: 100%;
  }

  .calendar-grid {
    grid-template-columns: 1fr;
    overflow-x: hidden;
  }

  .calendar-week-labels {
    display: none;
  }

  .calendar-day {
    min-height: auto;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .modal {
    width: 100vw;
    max-width: 100vw;
    min-height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 16px;
  }

  .modal-actions,
  .inline-form {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .reason-input {
    width: 100%;
  }
}

/* Glassmorphism login inspired by the provided reference */
.auth-page {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 16%, rgba(92, 213, 255, .58), transparent 32%),
    radial-gradient(circle at 70% 20%, rgba(157, 111, 255, .55), transparent 35%),
    radial-gradient(circle at 76% 62%, rgba(255, 165, 206, .55), transparent 30%),
    radial-gradient(circle at 32% 82%, rgba(255, 111, 173, .42), transparent 30%),
    linear-gradient(135deg, #EAF8FF 0%, #ECEBFF 42%, #FFF0F7 100%);
}

.auth-page::before,
.auth-page::after {
  content: "";
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(58px);
  opacity: .62;
}

.auth-page::before {
  width: 380px;
  height: 380px;
  left: 8%;
  top: 6%;
  background: rgba(89, 207, 255, .58);
}

.auth-page::after {
  width: 420px;
  height: 420px;
  right: 12%;
  bottom: 4%;
  background: rgba(180, 116, 255, .42);
}

.auth-page .auth-card {
  position: relative;
  z-index: 1;
  width: min(430px, calc(100vw - 32px));
  padding: 42px 34px 34px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 28px;
  background: rgba(255, 255, 255, .18);
  box-shadow: 0 30px 95px rgba(67, 56, 202, .18);
  backdrop-filter: blur(26px) saturate(150%);
  text-align: center;
}

.auth-page .auth-card::before {
  display: none;
}

.auth-page .login-logo {
  width: 76px;
  height: 76px;
  margin-bottom: 20px;
  border-radius: 24px;
  padding: 8px;
  background: rgba(255, 255, 255, .54);
  box-shadow: 0 18px 36px rgba(111, 93, 255, .20);
}

.auth-page .auth-card h1 {
  margin: 0 0 6px;
  color: rgba(17, 24, 39, .92);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 700;
}

.auth-page .auth-card p {
  margin: 0 0 24px;
  color: rgba(17, 24, 39, .62);
}

.auth-page .auth-card form {
  display: grid;
  gap: 14px;
  text-align: left;
}

.auth-page .auth-card label {
  margin: 0;
  color: rgba(17, 24, 39, .72);
}

.auth-page .auth-card input {
  min-height: 54px;
  border: 2px solid rgba(255, 255, 255, .78);
  border-radius: 12px;
  background: rgba(255, 255, 255, .20);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32);
}

.auth-page .auth-card input::placeholder {
  color: rgba(17, 24, 39, .42);
}

.auth-page .auth-card input:focus {
  border-color: rgba(255, 255, 255, .95);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .18), 0 10px 30px rgba(10, 132, 255, .12);
}

.auth-page .auth-card .btn.primary {
  min-height: 56px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, #55D7FF 0%, #7A8DFF 48%, #A85DFB 100%);
  box-shadow: 0 16px 30px rgba(106, 108, 255, .26);
  color: #fff;
  font-size: 16px;
}

.auth-page .auth-card .btn.ghost {
  background: rgba(255, 255, 255, .28);
  color: #30415F;
}

.auth-page .auth-card hr {
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .38);
  margin: 22px 0;
}

.auth-page .alert.error {
  text-align: left;
  background: rgba(255, 59, 48, .13);
  border-color: rgba(255, 255, 255, .48);
}

@media (max-width: 640px) {
  .auth-page {
    padding: 14px;
  }

  .auth-page .auth-card {
    padding: 30px 18px 22px;
    border-radius: 24px;
  }

  .auth-page .auth-card h1 {
    font-size: 28px;
  }
}

/* Reference layout layer: fixed sidebar + top navbar + card content */
:root {
  --sidebar-width: 292px;
}

.sidebar {
  width: var(--sidebar-width);
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(245, 247, 251, .96)),
    radial-gradient(circle at 12% 0%, rgba(10, 132, 255, .16), transparent 28%);
  color: var(--text);
  border-right: 1px solid rgba(229, 231, 235, .88);
  box-shadow: 12px 0 34px rgba(17, 24, 39, .06);
}

.sidebar-inner {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  flex: 0 0 auto;
  margin: 0 0 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 10px 26px rgba(17, 24, 39, .06);
}

.brand span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
}

.brand img {
  width: 46px;
  height: 46px;
  border-radius: 18px;
  background: var(--secondary);
}

.sidebar nav,
.sidebar-nav {
  flex: 1 1 auto;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 2px;
}

.sidebar a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 16px;
  color: var(--muted);
  font-weight: 700;
}

.sidebar a:hover {
  background: var(--secondary);
  color: var(--primary);
  transform: none;
  box-shadow: none;
}

.sidebar a.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 14px 26px rgba(10, 132, 255, .25);
}

.sidebar a.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 13px;
  bottom: 13px;
  width: 4px;
  border-radius: 999px;
  background: var(--primary);
}

.menu-icon {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  background: #F3F7FF;
  color: var(--primary);
  font-size: 16px;
  line-height: 1;
}

.sidebar a.active .menu-icon {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}

.menu-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(17, 24, 39, .06);
}

.sidebar-user strong,
.profile-pill strong {
  display: block;
  color: var(--text);
  line-height: 1.2;
}

.sidebar-user span,
.profile-pill small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 16px;
  background: var(--secondary);
  color: var(--primary);
  font-weight: 900;
}

.avatar.small {
  flex-basis: 34px;
  width: 34px;
  height: 34px;
  border-radius: 14px;
}

.app {
  margin-left: var(--sidebar-width);
  padding: 20px 24px 32px;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 420px) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
  padding: 14px 16px;
  border-radius: 28px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(18px);
}

.topbar-title h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 32px);
}

.topbar-title p {
  margin: 2px 0 0;
}

.top-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #F8FAFC;
}

.top-search span {
  color: var(--muted);
  font-size: 20px;
}

.top-search input {
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.top-search input:focus {
  box-shadow: none;
}

.top-actions {
  justify-content: flex-end;
}

.top-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 18px rgba(17, 24, 39, .06);
  cursor: pointer;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(17, 24, 39, .06);
}

.logout-btn {
  background: #fff;
}

.panel,
.table-wrap,
.auth-card,
.stat-card,
.vehicle-card,
.day-card {
  border-radius: 24px;
}

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 292px;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 14px;
    top: 12px;
    z-index: 70;
    width: auto;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow-card);
  }

  .sidebar {
    width: min(88vw, 330px);
    transform: translateX(-105%);
  }

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

  .app {
    margin-left: 0;
    padding: 68px 14px 24px;
  }

  .topbar {
    position: relative;
    top: auto;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 14px;
  }

  .top-search {
    min-width: 0;
  }

  .profile-pill,
  .logout-btn {
    width: 100%;
    justify-content: center;
  }

  .top-icon {
    width: 100%;
  }
}

/* iOS-inspired design system layer */
:root {
  --bg: #eef6ff;
  --panel: rgba(255, 255, 255, .86);
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(148, 163, 184, .28);
  --primary: #0a84ff;
  --primary-2: #64d2ff;
  --danger: #ff3b30;
  --warning: #ff9f0a;
  --ok: #34c759;
  --shadow-soft: 0 18px 55px rgba(15, 23, 42, .10);
  --shadow-card: 0 12px 30px rgba(15, 23, 42, .08);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 6%, rgba(100, 210, 255, .28), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(10, 132, 255, .16), transparent 32%),
    linear-gradient(180deg, #f8fbff 0%, #eef6ff 48%, #f7faff 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.35), transparent 60%);
}

.auth-page {
  background: linear-gradient(145deg, rgba(255,255,255,.24), rgba(10,132,255,.08));
}

.auth-card,
.panel,
.stat-card,
.day-card,
.vehicle-card {
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 28px;
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
}

.auth-card {
  position: relative;
  overflow: hidden;
  width: min(480px, 100%);
  padding: 30px;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

.login-logo {
  border-radius: 24px;
  filter: drop-shadow(0 14px 20px rgba(10,132,255,.18));
}

.sidebar {
  width: 282px;
  background:
    linear-gradient(180deg, rgba(10, 132, 255, .94), rgba(36, 55, 150, .96)),
    radial-gradient(circle at top left, rgba(255,255,255,.35), transparent 34%);
  padding: 22px 18px;
}

.brand {
  border-radius: 24px;
  padding: 10px;
  background: rgba(255,255,255,.13);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.26);
}

.brand img {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: rgba(255,255,255,.92);
  padding: 4px;
}

.sidebar a {
  border-radius: 18px;
  padding: 12px 14px;
  color: rgba(255,255,255,.9);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.sidebar a:hover,
.sidebar a.active {
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24);
  transform: translateX(2px);
}

.app {
  margin-left: 282px;
  padding: 28px;
}

.topbar {
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 28px;
  padding: 18px 20px;
  background: rgba(255,255,255,.72);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
}

.topbar h1 {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 800;
  letter-spacing: 0;
}

.topbar p,
.muted,
.user {
  color: var(--muted);
}

.btn {
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.24);
  padding: 9px 16px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, opacity .16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(15, 23, 42, .10);
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), #0066d6);
  color: #fff;
}

.btn.danger {
  border-color: transparent;
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
}

.btn.ghost {
  background: rgba(255,255,255,.68);
}

.btn.small {
  min-height: 34px;
  padding: 6px 12px;
}

label {
  color: #1e293b;
  font-size: 14px;
}

input,
select,
textarea {
  min-height: 44px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.34);
  background: rgba(255,255,255,.88);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(10,132,255,.72);
  box-shadow: 0 0 0 4px rgba(10,132,255,.14);
  background: #fff;
}

.check {
  border-radius: 18px;
  padding: 10px 12px;
  background: rgba(248,250,252,.75);
}

.alert {
  position: sticky;
  top: 14px;
  z-index: 45;
  border: 1px solid rgba(52,199,89,.18);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  background: rgba(236, 253, 243, .92);
  backdrop-filter: blur(16px);
}

.alert.error {
  border-color: rgba(255,59,48,.2);
  background: rgba(255, 242, 241, .94);
}

table {
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 22px;
}

th,
td {
  border-bottom: 1px solid rgba(148,163,184,.22);
  padding: 13px 12px;
}

th {
  background: rgba(241,245,249,.86);
  color: #334155;
  font-size: 13px;
}

tbody tr {
  background: rgba(255,255,255,.54);
}

tbody tr:hover {
  background: rgba(239,246,255,.86);
}

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background: rgba(10,132,255,.12);
}

.stat-card strong {
  color: #075ec8;
}

.status {
  border-radius: 999px;
  padding: 5px 11px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
}

.status-pending {
  background: #fff4d6;
  color: #9a5a00;
}

.status-approved {
  background: #e1faea;
  color: #137333;
}

.status-rejected {
  background: #ffe4e2;
  color: #b42318;
}

.status-cancelled {
  background: #edf1f7;
  color: #475569;
}

.calendar-week-labels span,
.calendar-day,
.booking-item,
.event {
  border-radius: 22px;
}

.calendar-day {
  border-color: rgba(148,163,184,.24);
  background: rgba(255,255,255,.72);
  box-shadow: 0 8px 18px rgba(15,23,42,.05);
}

.event,
.booking-item {
  border: 1px solid rgba(255,255,255,.72);
  box-shadow: 0 8px 18px rgba(15,23,42,.06);
  transition: transform .16s ease, box-shadow .16s ease;
}

.event:hover,
.booking-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(15,23,42,.10);
}

.modal {
  border-radius: 28px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 30px 90px rgba(15, 23, 42, .30);
}

.modal::backdrop {
  background: rgba(15,23,42,.34);
  backdrop-filter: blur(10px);
}

.modal-close {
  display: grid;
  place-items: center;
  background: rgba(241,245,249,.96);
  color: #334155;
}

.detail-list {
  border-radius: 22px;
  padding: 14px;
  background: rgba(248,250,252,.78);
}

.empty-state {
  border-radius: 24px;
  background: rgba(255,255,255,.74);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  background: rgba(248,250,252,.54);
  backdrop-filter: blur(10px);
}

body.is-loading .loading-overlay {
  display: grid;
}

.loading-card {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  border-radius: 999px;
  padding: 14px 18px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-soft);
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(10,132,255,.18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.confirm-dialog {
  width: min(420px, calc(100vw - 28px));
  border: 0;
  border-radius: 28px;
  padding: 22px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 30px 90px rgba(15, 23, 42, .28);
}

.confirm-dialog::backdrop {
  background: rgba(15,23,42,.34);
  backdrop-filter: blur(10px);
}

.confirm-dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0;
  margin: 18px 0 0;
}

@media (max-width: 900px) {
  .app {
    margin-left: 0;
    padding: 14px;
  }

  .mobile-menu-toggle {
    display: block;
    background: rgba(255,255,255,.88);
    color: var(--text);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(16px);
  }

  .sidebar {
    width: min(86vw, 330px);
  }
}

@media (max-width: 640px) {
  .auth-page {
    padding: 12px;
  }

  .auth-card,
  .panel {
    border-radius: 24px;
    padding: 16px;
  }

  .topbar {
    border-radius: 24px;
    padding: 16px;
  }

  .btn {
    min-height: 46px;
  }

  .table-wrap {
    border-radius: 24px;
  }

  table {
    min-width: 760px;
  }

  .calendar-day {
    padding: 12px;
  }

  .modal {
    border-radius: 0;
  }
}

/* Requested system-wide UI polish: Noto Sans Thai + iOS palette */
:root {
  --bg: #F5F7FB;
  --panel: #FFFFFF;
  --text: #111827;
  --muted: #6B7280;
  --line: #E5E7EB;
  --primary: #0A84FF;
  --secondary: #E5F1FF;
  --danger: #FF3B30;
  --warning: #FFCC00;
  --ok: #34C759;
  --shadow-soft: 0 20px 55px rgba(17, 24, 39, .09);
  --shadow-card: 0 10px 28px rgba(17, 24, 39, .07);
}

html {
  background: var(--bg);
}

body {
  background:
    radial-gradient(circle at top left, rgba(10, 132, 255, .10), transparent 30%),
    linear-gradient(180deg, #FFFFFF 0%, var(--bg) 36%, var(--bg) 100%);
  color: var(--text);
  font-family: "Noto Sans Thai", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "liga" 1, "kern" 1;
}

body::before {
  opacity: .28;
}

.auth-card,
.panel,
.stat-card,
.day-card,
.vehicle-card,
.empty-state,
.topbar {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-card);
}

.auth-card,
.panel,
.stat-card,
.vehicle-card {
  border-radius: 28px;
}

.panel {
  overflow: hidden;
}

.sidebar {
  background:
    radial-gradient(circle at 18% 4%, rgba(255, 255, 255, .28), transparent 24%),
    linear-gradient(180deg, #0A84FF 0%, #1769D8 48%, #0B3A86 100%);
  box-shadow: 18px 0 45px rgba(10, 49, 118, .18);
}

.sidebar a.active,
.sidebar a:hover {
  background: rgba(255, 255, 255, .20);
  color: #fff;
}

.mobile-menu-toggle {
  border-bottom: 1px solid rgba(229, 231, 235, .9);
  background: rgba(255, 255, 255, .92);
  color: var(--text);
}

.topbar {
  border-radius: 28px;
}

.topbar h1,
.auth-card h1,
.panel h1,
.panel h2,
.vehicle-body h2 {
  color: var(--text);
  letter-spacing: 0;
}

.topbar p,
.muted,
.user,
.calendar-empty,
.detail-list dt {
  color: var(--muted);
}

.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

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

.btn.primary:hover {
  background: #006FE6;
}

.btn.ghost {
  background: var(--secondary);
  color: #0758B8;
}

.btn.danger {
  border-color: transparent;
  background: var(--danger);
  color: #fff;
}

.btn:focus-visible,
.sidebar a:focus-visible,
.event:focus-visible,
.booking-item:focus-visible,
.modal-close:focus-visible {
  outline: 3px solid rgba(10, 132, 255, .24);
  outline-offset: 2px;
}

input,
select,
textarea {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 18px;
}

input::placeholder,
textarea::placeholder {
  color: #9CA3AF;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, .14);
}

.badge,
.status {
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 999px;
  font-weight: 800;
}

.badge {
  background: var(--secondary);
  color: #0758B8;
}

.badge.ok,
.status-approved,
.event.status-approved {
  background: rgba(52, 199, 89, .16);
  color: #16833A;
}

.status-pending,
.event.status-pending {
  background: rgba(255, 204, 0, .23);
  color: #8A6300;
}

.status-rejected,
.event.status-rejected {
  background: rgba(255, 59, 48, .14);
  color: #B42318;
}

.status-cancelled,
.event.status-cancelled {
  background: #EEF2F7;
  color: #4B5563;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: var(--secondary);
  color: var(--text);
}

td {
  color: #1F2937;
}

tbody tr:nth-child(even) {
  background: #FAFBFD;
}

tbody tr:hover {
  background: #F0F7FF;
}

.vehicle-placeholder,
.thumb-placeholder {
  background: var(--secondary);
  color: var(--primary);
}

.calendar-week-labels span,
.calendar-day,
.day-card {
  border: 1px solid var(--line);
  background: #fff;
}

.event,
.booking-item {
  border: 1px solid rgba(10, 132, 255, .12);
}

.modal,
.confirm-dialog {
  border: 1px solid rgba(229, 231, 235, .9);
  background: #fff;
}

.modal::backdrop,
.confirm-dialog::backdrop {
  background: rgba(17, 24, 39, .38);
  backdrop-filter: blur(12px);
}

.alert {
  color: #166534;
  background: rgba(52, 199, 89, .13);
  border-color: rgba(52, 199, 89, .22);
}

.alert.error {
  color: #B42318;
  background: rgba(255, 59, 48, .10);
  border-color: rgba(255, 59, 48, .20);
}

.report-print {
  font-family: "Sarabun", "Noto Sans Thai", sans-serif;
}

.field-hint {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.field-error {
  display: block;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.btn.is-loading {
  opacity: .75;
  cursor: wait;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  color: var(--muted);
}

.per-page-form,
.pagination-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.per-page-form label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
}

.per-page-form select {
  width: auto;
  min-height: 34px;
  padding: 5px 30px 5px 10px;
  border-radius: 999px;
}

.catalog-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.catalog-hero h2 {
  margin: 4px 0;
  font-size: clamp(24px, 3vw, 34px);
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.vehicle-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.vehicle-catalog-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.catalog-image-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(135deg, #E5F1FF, #F5F7FB);
}

.catalog-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.catalog-image.placeholder {
  display: grid;
  place-items: center;
  color: var(--primary);
  font-weight: 900;
  letter-spacing: .08em;
}

.catalog-status {
  position: absolute;
  top: 12px;
  right: 12px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(12px);
}

.catalog-status.ready {
  background: rgba(52, 199, 89, .16);
  color: #166534;
}

.catalog-status.inactive {
  background: rgba(255, 59, 48, .14);
  color: #B42318;
}

.catalog-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.catalog-body h3 {
  margin: 0;
  font-size: 20px;
}

.catalog-body p {
  margin: 4px 0 0;
  color: var(--muted);
}

.catalog-meta {
  display: grid;
  gap: 9px;
  margin: 0;
}

.catalog-meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.catalog-meta dt {
  color: var(--muted);
  font-size: 13px;
}

.catalog-meta dd {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  text-align: right;
}

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

@media (max-width: 767px) {
  .catalog-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .vehicle-catalog-grid {
    grid-template-columns: 1fr;
  }
}

.btn.disabled {
  pointer-events: none;
  opacity: .45;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.calendar-toolbar h2 {
  margin: 0;
  text-align: center;
}

.calendar-nav,
.calendar-view-switch {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.calendar-view-switch {
  justify-content: flex-end;
}

.google-calendar {
  border: 1px solid var(--line);
  border-radius: 26px;
  overflow: hidden;
  background: #fff;
}

.calendar-grid {
  gap: 0;
  border-top: 1px solid var(--line);
}

.calendar-week-labels {
  gap: 0;
  margin: 0;
}

.calendar-week-labels span {
  padding: 12px;
  border-right: 1px solid var(--line);
  background: var(--secondary);
  color: var(--muted);
  text-align: center;
}

.calendar-day {
  min-height: 150px;
  border-width: 0 1px 1px 0;
  border-radius: 0;
  box-shadow: none;
}

.calendar-day > strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.calendar-day > strong > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
}

.calendar-day > strong > small {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
}

.calendar-day.is-today > strong > span,
.google-day-column.is-today header strong {
  background: var(--primary);
  color: #fff;
}

.calendar-day-muted {
  background: #F8FAFC;
}

.google-calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(170px, 1fr));
  overflow-x: auto;
}

.google-calendar-day {
  display: block;
}

.google-day-column {
  min-height: 520px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.google-day-column header {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
}

.google-day-column header strong,
.google-day-column header span {
  display: block;
}

.google-day-column header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.google-day-events {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
}

.google-event {
  width: 100%;
  margin: 0;
  border-left: 4px solid currentColor;
}

.google-day-column.is-expanded {
  min-height: 560px;
  border-right: 0;
}

@media (max-width: 900px) {
  body.menu-open {
    overflow: hidden;
  }

  body.menu-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(17, 24, 39, .30);
    backdrop-filter: blur(8px);
  }

  .sidebar {
    z-index: 60;
  }
}

@media (max-width: 640px) {
  body {
    background: var(--bg);
  }

  .app {
    padding: 12px;
  }

  .auth-card,
  .panel,
  .stat-card,
  .vehicle-card,
  .topbar {
    border-radius: 22px;
  }

  .topbar {
    gap: 12px;
  }

  .top-actions,
  .quick-actions,
  .page-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .table-wrap {
    border-radius: 22px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 720px;
  }

  th,
  td {
    padding: 11px 10px;
  }

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

  .calendar-grid,
  .week-toolbar,
  .filters,
  .grid-form {
    gap: 10px;
  }

  .modal {
    width: 100vw;
    max-width: 100vw;
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .pagination-bar,
  .pagination-actions,
  .per-page-form,
  .per-page-form label {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .calendar-toolbar {
    grid-template-columns: 1fr;
  }

  .calendar-toolbar h2 {
    text-align: left;
  }

  .calendar-nav,
  .calendar-view-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .google-calendar-month .calendar-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .calendar-day-muted,
  .calendar-week-labels {
    display: none;
  }

  .calendar-day {
    min-height: auto;
    border-right: 0;
    padding: 14px;
  }

  .google-calendar-week {
    grid-template-columns: 1fr;
    overflow-x: hidden;
  }

  .google-day-column {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
