/* Page styles for the reception area — owned by that area's redesign. Build on theme.css tokens (--ui-*) and ui-* classes.
   Every selector is scoped under .pg-reception (shared by all reception list/desk pages)
   or a page wrapper: .pg-rx-dash, .pg-rx-register, .pg-rx-profile, .pg-rx-stays,
   .pg-rx-qr, .pg-rx-search, .pg-rx-desk-form (+ .pg-rx-travel), .pg-rx-police. */

/* ───────── Shared helpers ───────── */
.pg-reception .rx-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.pg-reception .rx-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; white-space: nowrap; }
.pg-reception .rx-right { text-align: right; }
.pg-reception .rx-mt { margin-top: 6px; }
.pg-reception .rx-wrap { white-space: normal; }
.pg-reception .rx-nowrap-row { flex-wrap: nowrap; gap: 6px; white-space: nowrap; }
.pg-reception .rx-wrap-row { flex-wrap: wrap; }
.pg-reception .rx-col { align-content: start; gap: 16px; }
.pg-reception .ui-card-head h2 .lucide { width: 16px; height: 16px; }

/* Guest cell: avatar + name, used across every guest table */
.pg-reception .rx-guest { display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 260px; }
.pg-reception .rx-guest .ui-cell-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-reception .ui-table .ui-avatar,
.pg-reception .ui-list-row .ui-avatar { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
.pg-reception .ui-avatar .lucide { width: 16px; height: 16px; }
.pg-reception .rx-foreign { width: 14px; height: 14px; margin-left: 4px; color: var(--ui-info); vertical-align: -2px; }

/* Extra tag tones used by view-provided status keys (guest.display_status) */
.pg-reception .ui-tag.danger { background: var(--ui-bad-bg); color: var(--ui-bad); }
.pg-reception .ui-tag.payment { background: var(--ui-warn-bg); color: var(--ui-warn); }
.pg-reception .ui-tag.neutral { background: var(--ui-sunken); color: var(--ui-text-2); }

/* Status dots (always paired with a text label) */
.pg-reception .rx-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ui-muted); }
.pg-reception .rx-dot.good, .pg-reception .rx-dot.available { background: var(--ui-good); }
.pg-reception .rx-dot.info { background: var(--ui-info); }
.pg-reception .rx-dot.warn, .pg-reception .rx-dot.cleaning { background: #d97706; }
.pg-reception .rx-dot.bad, .pg-reception .rx-dot.occupied { background: var(--ui-bad); }
.pg-reception .rx-dot.maintenance { background: #94a3b8; }

/* Toolbar / filters living inside a flush card */
.pg-reception .ui-card.flush > .rx-filters { display: grid; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--ui-hairline); background: #fcfcfe; }
.pg-reception .ui-card.flush > form.rx-filters { display: flex; }
.pg-reception .ui-toolbar input[type="date"] { min-width: 0; }

/* Pagination footer under a table card (hidden when the partial renders nothing) */
.pg-reception .rx-card-foot { padding: 0 20px 16px; border-top: 1px solid var(--ui-hairline); }
.pg-reception .rx-card-foot:not(:has(.pms-pagination)) { display: none; }
.pg-reception .rx-card-foot .pms-pagination-status { color: var(--ui-muted); }

/* Guest ticket code (kept class .guest-ticket; toned to the kit) */
.pg-reception .guest-ticket { border-color: #c7cbe8; border-radius: 7px; background: var(--ui-primary-soft); color: var(--ui-primary); }

.pg-reception .ui-empty { padding: 28px 16px; }
.pg-reception .rx-empty-sm { padding: 16px; }

/* ───────── Reception dashboard ───────── */
.pg-rx-dash .rx-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pg-rx-dash .rx-live {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px;
  background: var(--ui-good-bg); color: var(--ui-good); letter-spacing: 0; text-transform: none;
}
.pg-rx-dash .rx-live i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: rx-pulse 2s ease-in-out infinite; }
.pg-rx-dash.is-live-stale .rx-live { background: var(--ui-warn-bg); color: var(--ui-warn); }
.pg-rx-dash.is-live-stale .rx-live i { animation: none; }
.pg-rx-dash.is-live-updated .ui-kpi-value { transition: color .3s; color: var(--ui-primary); }
@keyframes rx-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pg-rx-dash .rx-live i { animation: none; } }

.pg-rx-dash .rx-meter { display: block; height: 6px; border-radius: 999px; background: var(--ui-sunken); overflow: hidden; }
.pg-rx-dash .rx-meter > span { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: var(--ui-primary); }

.pg-rx-dash .ui-table td { white-space: nowrap; }
.pg-rx-dash .ui-list-row > div { min-width: 0; }
.pg-rx-dash .ui-list-row .ui-cell-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bed map */
.pg-rx-dash .rx-bed-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ui-text-2); font-size: 12px; font-weight: 600; }
.pg-rx-dash .rx-bed-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pg-rx-dash .rx-bed-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; max-height: 420px; overflow-y: auto; }
.pg-rx-dash .rx-bed-map > .ui-empty { grid-column: 1 / -1; }
.pg-rx-dash .rx-bed {
  display: grid; align-content: center; gap: 1px; min-height: 52px; padding: 7px 9px;
  border: 1px solid var(--ui-border); border-left-width: 3px; border-radius: 9px; background: var(--ui-surface); color: var(--ui-text);
}
.pg-rx-dash .rx-bed b { overflow: hidden; font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.pg-rx-dash .rx-bed small {
  display: -webkit-box; overflow: hidden; color: var(--ui-muted); font-size: 11px; line-height: 1.25;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pg-rx-dash .rx-bed.available { border-left-color: var(--ui-good); background: var(--ui-good-bg); }
.pg-rx-dash .rx-bed.occupied { border-left-color: var(--ui-bad); background: var(--ui-bad-bg); }
.pg-rx-dash .rx-bed.cleaning { border-left-color: #d97706; background: var(--ui-warn-bg); }
.pg-rx-dash .rx-bed.maintenance,
.pg-rx-dash .rx-bed.blocked { border-left-color: #94a3b8; background: var(--ui-sunken); color: var(--ui-text-2); }
.pg-rx-dash .rx-bed.reserved { border-left-color: var(--ui-primary); background: var(--ui-primary-soft); }

/* ───────── Guest register ───────── */
.pg-rx-register .rx-quick { max-width: 100%; }
.pg-rx-register .rx-quick .rx-dot { width: 7px; height: 7px; }
.pg-rx-register .rx-ledger td { white-space: nowrap; }
.pg-rx-register .rx-ledger td.rx-name-cell { min-width: 200px; white-space: normal; }
.pg-rx-register .rx-ledger td.rx-name-cell .ui-tag { display: inline-flex; }
.pg-rx-register .row-actions { align-items: center; }

/* Kebab menu (JS toggles .open on .action-dropdown-menu) */
.pg-rx-register .action-dropdown { position: relative; }
.pg-rx-register .action-dropdown-menu {
  min-width: 190px; padding: 6px; border: 1px solid var(--ui-border); border-radius: 12px;
  background: var(--ui-surface); box-shadow: var(--ui-shadow-pop);
}
.pg-rx-register .action-dropdown-menu a {
  gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ui-text); font-size: 13px; font-weight: 600;
}
.pg-rx-register .action-dropdown-menu a:hover { background: var(--ui-sunken); }
.pg-rx-register .action-dropdown-menu a .lucide { width: 15px; height: 15px; color: var(--ui-muted); }
/* Give the last rows room so the menu isn't clipped by the scroll wrapper */
.pg-rx-register .ui-table-wrap { padding-bottom: 4px; }
.pg-rx-register .rx-ledger tbody tr:nth-last-child(-n+2):not(:nth-child(-n+4)) .action-dropdown-menu { top: auto; bottom: calc(100% + 6px); }

/* ───────── Guest profile ───────── */
.pg-rx-profile .rx-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pg-rx-profile .rx-title .ui-tag { font-size: 12px; letter-spacing: 0; }
.pg-rx-profile .rx-profile-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.pg-rx-profile .rx-identity-top { display: flex; align-items: center; gap: 12px; }
.pg-rx-profile .rx-identity-top h2 { font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.pg-rx-profile .rx-identity-top p { margin-top: 2px; font-size: 13px; }
.pg-rx-profile .rx-ticket-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pg-rx-profile .ui-dl.rx-dl-stack { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.pg-rx-profile .ui-dl dd { overflow-wrap: anywhere; }
.pg-rx-profile .rx-verify { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-rx-profile .rx-verify .ui-tag { padding: 6px 10px; font-size: 12px; }
.pg-rx-profile .rx-verify .ui-tag .lucide { width: 14px; height: 14px; }
.pg-rx-profile .ui-alert p { margin: 6px 0 0; }

/* History tabs: radio-driven .ds-tabs (CSS in design-system.css shows the checked panel) */
.pg-rx-profile .rx-history .ds-tab-list { gap: 4px; margin: 0; padding: 0 20px; border-bottom: 1px solid var(--ui-hairline); }
.pg-rx-profile .rx-history .ds-tab-list label { padding: 12px 6px; margin: 0 8px -1px 0; color: var(--ui-text-2); font-size: 13px; font-weight: 700; }
.pg-rx-profile .rx-history .ds-tab-list label:hover { color: var(--ui-text); }
.pg-rx-profile .rx-history .ds-tab-input:nth-of-type(1):checked ~ .ds-tab-list label:nth-of-type(1),
.pg-rx-profile .rx-history .ds-tab-input:nth-of-type(2):checked ~ .ds-tab-list label:nth-of-type(2),
.pg-rx-profile .rx-history .ds-tab-input:nth-of-type(3):checked ~ .ds-tab-list label:nth-of-type(3) { border-bottom-color: var(--ui-primary); color: var(--ui-primary); }
.pg-rx-profile .rx-docs { padding: 4px 20px; }
.pg-rx-profile .rx-docs .ui-list-row > div { min-width: 0; }
.pg-rx-profile .rx-docs .ui-cell-title { overflow-wrap: anywhere; }

/* Timeline */
.pg-rx-profile .rx-timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.pg-rx-profile .rx-tl-item { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding-bottom: 16px; }
.pg-rx-profile .rx-tl-item:not(:last-child)::before { content: ""; position: absolute; top: 30px; bottom: 2px; left: 13px; width: 2px; background: var(--ui-hairline); }
.pg-rx-profile .rx-tl-dot { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ui-sunken); color: var(--ui-text-2); }
.pg-rx-profile .rx-tl-dot .lucide { width: 14px; height: 14px; }
.pg-rx-profile .rx-tl-item.good .rx-tl-dot { background: var(--ui-good-bg); color: var(--ui-good); }
.pg-rx-profile .rx-tl-item.info .rx-tl-dot { background: var(--ui-info-bg); color: var(--ui-info); }
.pg-rx-profile .rx-tl-item.warn .rx-tl-dot { background: var(--ui-warn-bg); color: var(--ui-warn); }
.pg-rx-profile .rx-tl-item.bad .rx-tl-dot, .pg-rx-profile .rx-tl-item.danger .rx-tl-dot { background: var(--ui-bad-bg); color: var(--ui-bad); }
.pg-rx-profile .rx-tl-item > div { display: grid; gap: 2px; padding-top: 3px; }
.pg-rx-profile .rx-tl-item strong { font-size: 13px; font-weight: 700; }
.pg-rx-profile .rx-tl-item span { color: var(--ui-text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.pg-rx-profile .rx-tl-item time { color: var(--ui-muted); font-size: 11.5px; font-weight: 600; }

/* ───────── Active stays / police register ───────── */
.pg-rx-stays .ui-table td, .pg-rx-police .ui-table td { white-space: nowrap; }

/* ───────── Desk QR ───────── */
.pg-rx-qr .rx-qr-grid { align-items: start; }
.pg-rx-qr .rx-qr-card { align-items: center; gap: 16px; padding: 28px 24px; text-align: center; }
.pg-rx-qr .rx-qr-logo { width: auto; max-width: 160px; height: 44px; object-fit: contain; }
.pg-rx-qr .rx-qr-image { width: min(280px, 100%); height: auto; padding: 12px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: #fff; image-rendering: pixelated; }
.pg-rx-qr .rx-qr-fallback { display: grid; place-items: center; width: 220px; max-width: 100%; aspect-ratio: 1; border: 1px dashed var(--ui-border-strong); border-radius: var(--ui-radius); background: var(--ui-sunken); color: var(--ui-muted); }
.pg-rx-qr .rx-qr-fallback .lucide { width: 56px; height: 56px; }
.pg-rx-qr .rx-qr-url {
  display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 12px;
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-sunken);
  color: var(--ui-text-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; text-align: left;
}
.pg-rx-qr .rx-qr-url span { min-width: 0; overflow-wrap: anywhere; }
.pg-rx-qr .rx-qr-url .lucide { flex: none; width: 14px; height: 14px; color: var(--ui-muted); }
.pg-rx-qr .rx-steps { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: rx-step; }
.pg-rx-qr .rx-steps li {
  position: relative; display: grid; gap: 2px; padding: 12px 0 12px 44px; border-bottom: 1px solid var(--ui-hairline); counter-increment: rx-step;
}
.pg-rx-qr .rx-steps li:last-child { border-bottom: 0; }
.pg-rx-qr .rx-steps li::before {
  content: counter(rx-step); position: absolute; top: 12px; left: 0; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 9px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 12px; font-weight: 800;
}
.pg-rx-qr .rx-steps b { font-size: 14px; font-weight: 700; }
.pg-rx-qr .rx-steps span { color: var(--ui-text-2); font-size: 13px; }

/* ───────── Desk check-in search ───────── */
.pg-rx-search .ui-table td { white-space: nowrap; }
.pg-rx-search .ui-list-row > div { min-width: 0; }
.pg-rx-search .rx-notfound .ui-between { flex-wrap: wrap; }

/* ───────── Desk check-in forms (details + travel) ───────── */
.pg-rx-desk-form .rx-h-icon { display: flex; align-items: center; gap: 8px; }
.pg-rx-desk-form .rx-h-icon .lucide { color: var(--ui-primary); }
.pg-rx-desk-form .ui-form-grid.rx-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pg-rx-desk-form .ui-error:empty { display: none; }
.pg-rx-desk-form .ui-error ul { margin: 0; padding: 0; list-style: none; }
.pg-rx-desk-form .ui-field label { color: var(--ui-text-2); font-size: 12.5px; font-weight: 700; }
.pg-rx-desk-form .ui-field .ui-between { min-height: 22px; }
.pg-rx-desk-form .rx-check-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 40px; }
.pg-rx-desk-form .rx-check-field input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--ui-primary); }
.pg-rx-desk-form .rx-check-field .ui-error { flex-basis: 100%; }
.pg-rx-desk-form .rx-file-field input[type="file"] {
  width: 100%; padding: 10px 12px; border: 1px dashed var(--ui-border-strong); border-radius: var(--ui-radius-sm);
  background: var(--ui-sunken); color: var(--ui-text-2); font: inherit; font-size: 13px; cursor: pointer;
}
.pg-rx-desk-form .rx-file-field input[type="file"]::file-selector-button {
  margin-right: 10px; padding: 6px 12px; border: 1px solid var(--ui-border); border-radius: 8px;
  background: var(--ui-surface); color: var(--ui-text); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.pg-rx-desk-form .ui-card > .ui-field + .ui-field { margin-top: -2px; }

.pg-reception .rx-stepper { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pg-reception .rx-stepper li {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 6px;
  border: 1px solid var(--ui-border); border-radius: 999px; background: var(--ui-surface); color: var(--ui-muted); font-size: 12px; font-weight: 700;
}
.pg-reception .rx-stepper li span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ui-sunken); font-size: 11px; }
.pg-reception .rx-stepper li.done { color: var(--ui-good); }
.pg-reception .rx-stepper li.done span { background: var(--ui-good-bg); }
.pg-reception .rx-stepper li.current { border-color: var(--ui-primary); background: var(--ui-primary-soft); color: var(--ui-primary); }
.pg-reception .rx-stepper li.current span { background: var(--ui-primary); color: #fff; }

/* ───────── Responsive ───────── */
@media (max-width: 1280px) {
  .pg-rx-profile .rx-profile-grid { grid-template-columns: 260px minmax(0, 1fr); }
  .pg-rx-profile .rx-timeline-card { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .pg-rx-desk-form .ui-form-grid.rx-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .pg-rx-profile .rx-profile-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .pg-reception .ui-card.flush > .rx-filters,
  .pg-reception .ui-card.flush > .ui-card-head { padding-left: 16px; padding-right: 16px; }
  .pg-reception .rx-card-foot { padding: 0 16px 14px; }
  .pg-reception .ui-page-head .ui-actions { width: 100%; }
  .pg-rx-register .rx-quick { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .pg-reception .ui-toolbar select,
  .pg-reception .ui-toolbar input[type="date"] { flex: 1 1 calc(50% - 4px); }
  .pg-reception .ui-toolbar .ui-btn { flex: 1 1 100%; }
  .pg-rx-desk-form .ui-form-grid.rx-grid-4 { grid-template-columns: minmax(0, 1fr); }
  .pg-reception .rx-stepper li:not(.current) { display: none; }
  .pg-rx-profile .rx-history .ds-tab-list { padding: 0 16px; overflow-x: auto; flex-wrap: nowrap; }
  .pg-rx-profile .rx-docs { padding: 4px 16px; }
  .pg-rx-profile .rx-docs .ui-list-row { grid-template-columns: auto minmax(0, 1fr); }
  .pg-rx-profile .rx-docs .ui-list-row > .ui-row { grid-column: 1 / -1; }
  .pg-rx-dash .rx-bed-map { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
}
.pg-rx-travel .ui-tag[hidden] { display: none; }
