:root {
  --navy: #10254a;
  --navy-soft: #173a6b;
  --gold: #e0a92e;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f5f7fb;
  --ok: #0f9d58;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(15, 23, 42, .08);
}

* { -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04";
}

h1, h2, h3, h4, h5, .ck-title { letter-spacing: -.02em; }

/* ---------- Check-in / room ---------- */

.page-checkin, .page-room { background: #eef1f7; }

.ck-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, .9);
}

.ck-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ck-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: #fff;
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 4px 12px rgba(16, 37, 74, .3);
  flex: 0 0 auto;
  padding: 3px;
}
.ck-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; }
.ck-title { font-weight: 800; font-size: 16px; line-height: 1.1; }
.ck-sub { color: var(--muted); font-size: 11.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.operator-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--navy);
  border-radius: 999px; padding: 7px 12px; font-size: 12.5px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
}
.operator-chip:hover { background: #f8fafc; color: var(--navy); }

.ck-main {
  max-width: 900px; margin: 0 auto; padding: 18px 16px 64px;
}

.ck-hero {
  background: radial-gradient(120% 120% at 0% 0%, #1e4b8a 0%, var(--navy) 55%, #0b1b35 100%);
  color: #fff; border-radius: var(--radius);
  padding: 26px 22px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.ck-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: 10px;
}
.ck-hero h1 { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 800; margin: 0 0 6px; }
.ck-lead { color: rgba(255, 255, 255, .72); font-size: 13.5px; margin: 0 0 18px; max-width: 46ch; }

.searchbox {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 14px; padding: 4px 6px 4px 16px;
  box-shadow: 0 10px 24px rgba(4, 14, 33, .35);
}
.searchbox > i { color: var(--muted); font-size: 18px; }
.searchbox input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 17px; font-weight: 600; letter-spacing: .01em;
  padding: 12px 0; color: var(--ink); min-width: 0;
}
.searchbox input::placeholder { color: #94a3b8; font-weight: 500; }
.searchbox input[type="search"]::-webkit-search-cancel-button,
.searchbox input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.search-clear {
  border: 0; background: #f1f5f9; color: var(--muted);
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
}

.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 16px 2px 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .82);
  border-radius: 999px; padding: 6px 13px; font-size: 12px; font-weight: 600;
  white-space: nowrap; transition: background .15s ease, color .15s ease;
}
.chip:hover { background: rgba(255, 255, 255, .16); }
.chip-active { background: var(--gold); border-color: var(--gold); color: #2a1a00; }

.ck-progress {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  background: #fff; border-radius: 14px; padding: 14px 10px; margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
}
.ck-progress > div { text-align: center; }
.ck-progress strong { display: block; font-size: 20px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.ck-progress span { font-size: 11px; color: var(--muted); }

.results { display: grid; gap: 10px; }

.guest-card {
  display: flex; align-items: center; gap: 14px; width: 100%;
  text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
  transition: border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.guest-card:hover, .guest-card:focus-visible { border-color: #b8c6dd; box-shadow: 0 6px 18px rgba(15, 23, 42, .08); }
.guest-card:active { transform: scale(.995); }
.guest-card.is-in { background: #f3fbf6; border-color: #c6ecd7; }

.guest-avatar {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: #e8eefb; color: var(--navy-soft);
}
.guest-card.is-in .guest-avatar { background: #d7f2e2; color: #0b6b3d; }

.guest-main { flex: 1; min-width: 0; }
.guest-name { font-weight: 700; font-size: 15px; line-height: 1.25; margin: 0; }
.guest-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; }
.province-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: #eef2ff; color: #3538cd; border-radius: 6px;
  padding: 2px 7px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .02em; text-transform: uppercase;
}
.tag-badge {
  background: #f8fafc; color: #475569; border: 1px dashed #cbd5e1;
  border-radius: 6px; padding: 2px 7px; font-size: 10.5px; font-weight: 700;
}
.room-badge { color: #475569; font-size: 11.5px; display: inline-flex; align-items: center; gap: 4px; }
.guest-side { text-align: right; flex: 0 0 auto; }
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 4px 9px;
}
.status-in { background: #dcfce7; color: #166534; }
.status-out { background: #f1f5f9; color: #475569; }
.guest-time { display: block; font-size: 10.5px; color: var(--muted); margin-top: 4px; }

.empty-hint { color: var(--muted); font-size: 13px; text-align: center; padding: 22px 0; }
.empty-state { color: var(--muted); font-size: 13px; text-align: center; padding: 26px 16px; margin: 0; }

/* bottom sheet */
.sheet-scrim { position: fixed; inset: 0; background: rgba(8, 18, 36, .55); z-index: 40; backdrop-filter: blur(2px); }
dialog.sheet {
  border: 0; padding: 22px 20px 24px; border-radius: 22px 22px 0 0;
  width: 100%; max-width: 560px; margin: auto auto 0;
  position: fixed; inset: auto 0 0 0; z-index: 50;
  box-shadow: 0 -18px 50px rgba(4, 14, 33, .35);
  max-height: 88vh; overflow: auto;
}
dialog.sheet::backdrop { background: rgba(8, 18, 36, .55); backdrop-filter: blur(2px); }
dialog.sheet-sm { border-radius: 22px; inset: auto; margin: auto; max-width: 400px; }
.sheet-grip { width: 42px; height: 4px; border-radius: 999px; background: #cbd5e1; margin: -8px auto 16px; }
.sheet-close {
  position: absolute; top: 14px; right: 14px; border: 0; background: #f1f5f9;
  width: 34px; height: 34px; border-radius: 10px; color: var(--muted);
}

.sheet h2 { font-size: 1.15rem; font-weight: 800; }
.sheet .province-badge { margin-bottom: 0; }
.sheet-detail { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; display: grid; gap: 8px; }
.sheet-detail div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.sheet-detail dt, .sheet-detail .k { color: var(--muted); }
.sheet-detail .v { font-weight: 600; text-align: right; }

.room-card {
  margin-top: 16px; border-radius: 16px; padding: 18px;
  background: linear-gradient(150deg, #0f3d7a, #10254a);
  color: #fff; text-align: center;
}
.room-card .room-label { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.room-card .room-name { font-size: 1.35rem; font-weight: 800; margin: 6px 0 2px; }
.room-card .room-floor { font-size: 12.5px; color: rgba(255, 255, 255, .75); }
.room-card.room-empty { background: #f8fafc; color: var(--ink); border: 1px dashed #cbd5e1; }
.room-card.room-empty .room-label { color: var(--muted); }
.room-card.room-empty .room-name { font-size: 1rem; color: var(--muted); }

.success-burst {
  display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%;
  background: #dcfce7; color: #15803d; font-size: 26px; margin: 4px auto 12px;
}
.sheet-actions { display: grid; gap: 8px; margin-top: 16px; }
.sheet-actions .btn { padding: 12px; font-weight: 700; }

/* ---------- Login ---------- */

.page-login {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 10% 0%, #1e4b8a 0%, var(--navy) 55%, #0b1b35 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 20px;
  padding: 28px 26px; box-shadow: 0 24px 60px rgba(2, 8, 23, .45);
}
.login-card .ck-mark { width: 44px; height: 44px; }

/* ---------- Admin ---------- */

.admin-nav { background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(15, 23, 42, .02); }
.navbar-brand .brand-logo { border-radius: 8px; }
.admin-nav .nav-link { color: var(--muted); font-weight: 600; font-size: 14px; border-radius: 10px; padding: 8px 12px; }
.admin-nav .nav-link i { margin-right: 4px; }
.admin-nav .nav-link:hover { color: var(--navy); background: #f1f5f9; }
.admin-nav .nav-link.active { color: var(--navy); background: #e8eefb; }

.admin-main { padding: 22px 18px 48px; max-width: 1500px; }

.page-heading { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }

.stat-row .card { border: 1px solid var(--line); border-radius: 14px; box-shadow: none; }
.stat-card .card-body { padding: 16px 18px; }
.stat-label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat-value { display: block; font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1.15; margin-top: 4px; }
.stat-note { display: block; font-size: 11.5px; color: var(--muted); min-height: 16px; }
.stat-card.stat-ok .stat-value { color: var(--ok); }
.stat-card.stat-warn .stat-value { color: var(--warn); }
.stat-progress { height: 6px; margin-top: 8px; background: #eef2f7; }
.stat-progress .progress-bar { background: var(--navy-soft); }

.panel { border: 1px solid var(--line); border-radius: 14px; box-shadow: none; }
.panel > .card-header {
  background: #fff; border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: 13.5px; padding: 14px 18px;
}
.panel > .card-body { padding: 14px 16px; }

#guestTable thead th, #activityTable thead th {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; border-bottom-color: var(--line);
  white-space: nowrap;
}
#guestTable tbody td, #activityTable tbody td { font-size: 13.5px; vertical-align: middle; }
.cell-name { font-weight: 700; }
.cell-sub { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.cell-actions { white-space: nowrap; }
.cell-actions .btn { padding: 3px 8px; font-size: 12px; }

.progress-list { max-height: 620px; overflow: auto; padding: 6px 16px 14px; }
.progress-item { padding: 9px 0; border-bottom: 1px solid #f1f5f9; }
.progress-item:last-child { border-bottom: 0; }
.progress-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.progress-top strong { font-weight: 700; }
.progress-top span { color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-item .progress { height: 5px; margin-top: 6px; background: #eef2f7; }
.progress-item .progress-bar { background: #2f6fd0; }
.progress-room { font-size: 11px; color: var(--muted); margin-top: 3px; }

.dt-container .dt-search input,
.dt-container .dt-length select { border-color: var(--line); }
.dt-container .dt-info, .dt-container .dt-length { font-size: 12.5px; color: var(--muted); }
.dt-container .dt-paging .page-link { font-size: 13px; }
table.dataTable thead > tr > th.dt-orderable-asc:hover, table.dataTable thead > tr > th.dt-orderable-desc:hover { outline: 0; }

.province-map { max-height: 640px; overflow: auto; }
.province-map .form-select { min-width: 200px; }
.province-map td { font-size: 13px; }

.status-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status-chip.in { background: #dcfce7; color: #166534; }
.status-chip.out { background: #f1f5f9; color: #475569; }
.status-chip.undo { background: #fee2e2; color: #991b1b; }

.toast-box {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px);
  background: #10254a; color: #fff; padding: 11px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 600; box-shadow: 0 12px 30px rgba(4, 14, 33, .35);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 2000;
  max-width: min(92vw, 520px); text-align: center;
}
.toast-box.show { opacity: 1; transform: translate(-50%, 0); }
.toast-box.error { background: #991b1b; }

.form-label { font-size: 12.5px; font-weight: 700; color: #334155; }
.form-text { font-size: 11.5px; }

@media (max-width: 575.98px) {
  .ck-sub { max-width: 46vw; }
  .guest-side { display: none; }
  .guest-card { padding: 13px; }
  .admin-main { padding: 16px 12px 40px; }
  .stat-value { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
