/**
 * marketplace-base.css
 * ════════════════════════════════════════════════════════════════
 * Shared styles for all marketplace listing pages (facility,
 * standing set, set room, soundstage, stage/package).
 *
 * Design reference: Hospital standing set page (space.php)
 * — all spacing, sizing, and positioning follows that template.
 *
 * Used by: facility.php, space.php
 * Loaded via: Assets.php (conditionally on marketplace listing pages)
 * ════════════════════════════════════════════════════════════════
 */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { margin-top: 0 !important; }

/* ── Skeleton / Shimmer loading ── */
@keyframes cr-shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.cr-skeleton {
    background: linear-gradient(90deg, var(--cr-border) 25%, var(--cr-bg-hover) 37%, var(--cr-border) 63%);
    background-size: 800px 100%;
    animation: cr-shimmer 1.2s ease-in-out infinite;
    border-radius: var(--cr-radius-sm);
}
.cr-skeleton-text { height: 14px; margin-bottom: var(--cr-space-2); }
.cr-skeleton-text.lg { height: 28px; width: 60%; }
.cr-skeleton-text.md { height: 16px; width: 40%; }
.cr-skeleton-text.sm { height: 12px; width: 30%; }
.cr-skeleton-hero { height: 400px; border-radius: var(--cr-radius-lg); }
.cr-skeleton-card { height: 200px; border-radius: var(--cr-radius-lg); }
.cr-skeleton-badge { height: 24px; width: 80px; border-radius: var(--cr-radius-full); display: inline-block; }
.cr-skeleton-circle { width: 32px; height: 32px; border-radius: var(--cr-radius-full); }
.cr-skeleton-rect { height: 44px; border-radius: var(--cr-radius-md); }
.cr-skeleton-hidden { display: none; }

/* ── Nav ── */
.cr-mkt-nav { display: flex; justify-content: space-between; align-items: center; padding: var(--cr-space-3) var(--cr-space-4) 0; max-width: 1120px; margin: 0 auto; }
.cr-mkt-nav .logo { font-size: var(--cr-font-size-lg); font-weight: var(--cr-font-weight-bold); text-decoration: none; color: var(--cr-text-primary); letter-spacing: -0.5px; }
.cr-mkt-nav .nav-links { display: flex; gap: var(--cr-space-3); align-items: center; }

/* ── Breadcrumb ── */
.cr-breadcrumb { max-width: 1120px; margin: 0 auto; padding: 18px var(--cr-space-4) var(--cr-space-2); display: flex; align-items: center; gap: var(--cr-space-2); font-size: var(--cr-font-size-xs); color: var(--cr-text-tertiary); flex-wrap: wrap; }
.cr-breadcrumb a { color: var(--cr-text-secondary); text-decoration: none; transition: color 0.2s; }
.cr-breadcrumb a:hover { color: var(--cr-text-primary); }
.cr-breadcrumb .sep { color: var(--cr-text-tertiary); }

/* ── Hero Gallery (4-image grid: 1 large + 3 side) ── */
.cr-hero-gallery { max-width: 1120px; margin: 0 auto var(--cr-space-8); padding: 0 var(--cr-space-4); }
.cr-hero-grid { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 480px; gap: var(--cr-space-2); border-radius: var(--cr-radius-lg); overflow: hidden; }
.cr-hero-grid.single { grid-template-columns: 1fr; }
.cr-hero-main { position: relative; overflow: hidden; cursor: pointer; min-height: 320px; }
.cr-hero-main img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.cr-hero-main:hover img { transform: scale(1.02); }
.cr-hero-side { display: grid; grid-template-rows: 1fr 1fr 1fr; gap: var(--cr-space-2); height: 100%; }
.cr-hero-side .thumb { position: relative; overflow: hidden; cursor: pointer; }
.cr-hero-side .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.cr-hero-side .thumb:hover img { transform: scale(1.05); }
.cr-hero-more { position: absolute; bottom: var(--cr-space-3); right: var(--cr-space-3); background: rgba(0,0,0,0.55); color: #fff; border: none; padding: var(--cr-space-1) var(--cr-space-3); border-radius: var(--cr-radius-md); font-size: var(--cr-font-size-xs); font-weight: var(--cr-font-weight-medium); cursor: pointer; backdrop-filter: blur(8px); font-family: var(--cr-font-family); transition: background 0.2s; }
.cr-hero-more:hover { background: rgba(0,0,0,0.72); }
.cr-hero-placeholder { background: var(--cr-bg-elevated); border: 1px dashed var(--cr-border); border-radius: var(--cr-radius-lg); height: 480px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cr-space-2); color: var(--cr-text-tertiary); font-size: var(--cr-font-size-sm); }
.cr-hero-placeholder .cr-icon { opacity: 0.6; }

/* ── Lightbox ── */
.cr-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 10000; display: flex; flex-direction: column; }
.cr-lightbox-header { display: flex; justify-content: space-between; align-items: center; padding: var(--cr-space-4) var(--cr-space-6); }
.cr-lightbox-header .count { color: #fff; font-size: var(--cr-font-size-sm); font-family: var(--cr-font-family); }
.cr-lightbox-close { background: none; border: none; color: #fff; cursor: pointer; padding: var(--cr-space-2); line-height: 1; display: flex; align-items: center; justify-content: center; opacity: 0.8; transition: opacity 0.2s; }
.cr-lightbox-close:hover { opacity: 1; }
.cr-lightbox-body { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; padding: 0 100px; min-height: 0; }
.cr-lightbox-body img { max-width: 100%; max-height: 75vh; object-fit: contain; border-radius: var(--cr-radius-md); }
.cr-lightbox-prev, .cr-lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.12); border: none; color: #fff; width: 56px; height: 56px; border-radius: var(--cr-radius-full); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.cr-lightbox-prev:hover, .cr-lightbox-next:hover { background: rgba(255,255,255,0.25); }
.cr-lightbox-prev { left: var(--cr-space-5); }
.cr-lightbox-next { right: var(--cr-space-5); }
.cr-lightbox-thumbs { display: flex; gap: var(--cr-space-2); padding: var(--cr-space-3) var(--cr-space-6); overflow-x: auto; justify-content: flex-start; scroll-behavior: smooth; }
.cr-lightbox-thumbs img { width: var(--cr-space-16); height: var(--cr-space-12); object-fit: cover; border-radius: var(--cr-radius-sm); cursor: pointer; opacity: 0.5; transition: opacity 0.2s; border: 2px solid transparent; flex-shrink: 0; }
.cr-lightbox-thumbs img.active { opacity: 1; border-color: #fff; }
/* Styled scrollbar for lightbox thumbnail strip */
.cr-lightbox-thumbs::-webkit-scrollbar { height: 6px; }
.cr-lightbox-thumbs::-webkit-scrollbar-track { background: rgba(255,255,255,0.08); border-radius: 3px; }
.cr-lightbox-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 3px; }
.cr-lightbox-thumbs::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.5); }
.cr-lightbox-thumbs { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.3) rgba(255,255,255,0.08); }

/* ── Listing action icons (inline with meta row, ghost-style) ── */
.cr-listing-actions { display: flex; gap: var(--cr-space-1); align-items: center; margin-left: auto; }
.cr-icon-btn { background: none; border: none; border-radius: var(--cr-radius-sm); width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--cr-text-tertiary); transition: all 0.15s; }
.cr-icon-btn:hover { color: var(--cr-text-primary); background: var(--cr-bg-hover); }
.cr-icon-btn svg { width: 13px; height: 13px; }
.cr-icon-btn.saved { color: var(--cr-error); }

/* ── Description / About (truncated with read-more toggle) ── */
.cr-about-text { font-size: var(--cr-font-size-sm); color: var(--cr-text-secondary); line-height: 1.7; }
.cr-about-text.truncated { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.cr-sd-description { font-size: var(--cr-font-size-sm); color: var(--cr-text-secondary); line-height: 1.7; margin-bottom: var(--cr-space-2); }
.cr-sd-description.truncated { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cr-read-more { background: none; border: none; color: var(--cr-text-tertiary); font-weight: var(--cr-font-weight-regular); font-size: var(--cr-font-size-xs); cursor: pointer; padding: 0; margin-top: var(--cr-space-1); display: block; font-family: var(--cr-font-family); text-decoration: none; }
.cr-read-more:hover { color: var(--cr-text-primary); }

/* ── Host Rules Accordion ── */
.cr-rules-accordion { border: 1px solid var(--cr-border); border-radius: var(--cr-radius-lg); background: var(--cr-bg-primary); overflow: hidden; }
.cr-rules-acc-row { display: flex; align-items: center; gap: var(--cr-space-3); padding: var(--cr-space-4); cursor: pointer; user-select: none; border-bottom: 1px solid var(--cr-border); transition: background 0.15s; }
.cr-rules-acc-row:hover { background: var(--cr-bg-hover); }
.cr-rules-acc-row.open { background: var(--cr-bg-primary); }
.cr-rules-acc-row.cr-rules-hidden { display: none; }
.cr-rules-acc-row.cr-rules-hidden + .cr-rules-acc-body { display: none !important; }
.cr-rules-accordion.cr-rules-show-all .cr-rules-acc-row.cr-rules-hidden { display: flex; }
.cr-rules-accordion.cr-rules-show-all .cr-rules-acc-row.cr-rules-hidden + .cr-rules-acc-body { display: none !important; }
.cr-rules-accordion.cr-rules-show-all .cr-rules-acc-row.cr-rules-hidden.open + .cr-rules-acc-body { display: block !important; }
.cr-rules-acc-icon { width: 28px; height: 28px; border-radius: var(--cr-radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cr-rules-acc-icon.red { background: rgba(239,68,68,0.10); color: var(--cr-error); }
.cr-rules-acc-icon.green { background: rgba(34,197,94,0.10); color: var(--cr-success); }
.cr-rules-acc-icon.yellow { background: rgba(245,158,11,0.10); color: var(--cr-warning); }
.cr-rules-acc-icon.blue { background: rgba(59,130,246,0.10); color: var(--cr-info); }
.cr-rules-acc-icon.gray { background: var(--cr-bg-hover); color: var(--cr-text-tertiary); }
.cr-rules-acc-label { flex: 1; min-width: 0; }
.cr-rules-acc-name { font-size: var(--cr-font-size-sm); font-weight: var(--cr-font-weight-semibold); color: var(--cr-text-primary); line-height: 1.2; }
.cr-rules-acc-summary { font-size: var(--cr-font-size-xs); color: var(--cr-text-tertiary); line-height: 1.3; margin-top: 1px; }
.cr-rules-acc-chev { color: var(--cr-text-tertiary); transition: transform 0.2s; display: flex; flex-shrink: 0; }
.cr-rules-acc-row.open .cr-rules-acc-chev { transform: rotate(180deg); }
.cr-rules-acc-body { display: none; padding: var(--cr-space-1) var(--cr-space-5) var(--cr-space-3) var(--cr-space-5); border-bottom: 1px solid var(--cr-border); background: var(--cr-bg-primary); }
.cr-rules-acc-body.open { display: block; }
.cr-rules-acc-rule { display: flex; align-items: center; gap: var(--cr-space-3); padding: var(--cr-space-3) 0; font-size: var(--cr-font-size-sm); border-bottom: 1px solid var(--cr-border); }
.cr-rules-acc-body > :last-child { border-bottom: none; }
.cr-rules-acc-rule.has-note { flex-wrap: wrap; cursor: pointer; }
.cr-rules-acc-rule.has-note .cr-rules-acc-note { width: 100%; flex-basis: 100%; display: none; overflow: hidden; }
.cr-rules-acc-rule.has-note.note-open .cr-rules-acc-note { display: block; }
.cr-rules-acc-rl { flex: 1; color: var(--cr-text-primary); font-weight: var(--cr-font-weight-medium); }
.cr-rules-acc-status { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: var(--cr-radius-full); flex-shrink: 0; }
.cr-rules-acc-status.denied { background: color-mix(in srgb, var(--cr-error) 12%, transparent); color: var(--cr-error); }
.cr-rules-acc-status.restricted { background: color-mix(in srgb, var(--cr-warning) 12%, transparent); color: var(--cr-warning); }
.cr-rules-acc-status.allowed { background: color-mix(in srgb, var(--cr-success) 12%, transparent); color: var(--cr-success); }
.cr-rules-acc-status.info { background: color-mix(in srgb, var(--cr-info) 12%, transparent); color: var(--cr-info); }
.cr-rules-note-trigger { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: var(--cr-radius-full); background: var(--cr-bg-hover); color: var(--cr-text-tertiary); flex-shrink: 0; cursor: pointer; transition: background 0.15s, color 0.15s; }
.cr-rules-note-trigger:hover { background: color-mix(in srgb, var(--cr-info) 15%, transparent); color: var(--cr-info); }
.cr-rules-acc-rule.note-open .cr-rules-note-trigger { background: color-mix(in srgb, var(--cr-info) 15%, transparent); color: var(--cr-info); }
.cr-rules-acc-note { font-size: var(--cr-font-size-xs); color: var(--cr-text-tertiary); line-height: 1.3; margin-top: var(--cr-space-1); padding-left: 34px; }
.cr-rules-acc-more { display: flex; align-items: center; justify-content: center; gap: var(--cr-space-1); padding: var(--cr-space-2) var(--cr-space-4); font-size: var(--cr-font-size-xs); font-weight: var(--cr-font-weight-medium); color: var(--cr-text-secondary); cursor: pointer; user-select: none; background: none; border: none; border-top: 1px solid var(--cr-border); width: 100%; font-family: var(--cr-font-family); transition: color 0.15s, background 0.15s; }
.cr-rules-acc-more:hover { color: var(--cr-text-primary); background: var(--cr-bg-hover); }
.cr-rules-acc-more .cr-rules-acc-chev { transition: transform 0.2s; }
.cr-rules-acc-more.expanded .cr-rules-acc-chev { transform: rotate(180deg); }

/* ── Toast ── */
.cr-toast { position: fixed; bottom: var(--cr-space-6); left: 50%; transform: translateX(-50%) translateY(100px); background: var(--cr-bg-elevated); color: var(--cr-text-primary); padding: var(--cr-space-3) var(--cr-space-5); border-radius: var(--cr-radius-md); font-size: var(--cr-font-size-sm); font-family: var(--cr-font-family); z-index: 10001; transition: transform 0.3s ease; pointer-events: none; box-shadow: var(--cr-shadow-lg); border: 1px solid var(--cr-border); }
.cr-toast.show { transform: translateX(-50%) translateY(0); }
.cr-toast.cr-toast-error { border-color: var(--cr-error); color: var(--cr-error); }

/* ── Share popover ── */
.cr-share-popover { position: fixed; inset: 0; z-index: 9500; display: none; align-items: center; justify-content: center; }
.cr-share-popover.active { display: flex; }
.cr-share-popover-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.cr-share-popover-content { position: relative; background: var(--cr-bg-elevated); border: 1px solid var(--cr-border); border-radius: var(--cr-radius-lg); padding: var(--cr-space-4); min-width: 280px; max-width: 320px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
.cr-share-popover-title { font-size: var(--cr-font-size-md); font-weight: var(--cr-font-weight-semibold); margin-bottom: var(--cr-space-4); }
.cr-share-options { display: flex; flex-direction: column; gap: var(--cr-space-2); }
.cr-share-option { display: flex; align-items: center; gap: var(--cr-space-2); padding: var(--cr-space-3); border: 1px solid var(--cr-border); border-radius: var(--cr-radius-md); background: var(--cr-bg-surface); cursor: pointer; transition: all 0.2s; font-family: var(--cr-font-family); font-size: var(--cr-font-size-sm); }
.cr-share-option:hover { border-color: var(--cr-text-primary); background: var(--cr-bg-hover); }
.cr-share-option-icon { font-size: var(--cr-font-size-lg); flex-shrink: 0; }
.cr-share-option-text { flex: 1; }

/* ── Copy inline button ── */
.cr-copy-inline { background: none; border: none; color: var(--cr-text-tertiary); cursor: pointer; padding: 0; margin-left: var(--cr-space-1); vertical-align: middle; transition: color 0.2s; }
.cr-copy-inline:hover { color: var(--cr-text-primary); }

/* ── Map modal ── */
.cr-map-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.cr-map-modal { background: var(--cr-bg-elevated); border: 1px solid var(--cr-border); border-radius: var(--cr-radius-lg); width: 90%; max-width: 640px; overflow: hidden; font-family: var(--cr-font-family); }
.cr-map-modal iframe { width: 100%; height: 300px; border: 0; border-radius: 0; margin-bottom: 0; }
.cr-map-modal-body { padding: var(--cr-space-3) var(--cr-space-5) var(--cr-space-4); }

/* ── Inquiry form fields ── */
.cr-inquiry-card { padding: var(--cr-space-5) 0; border-top: 1px solid var(--cr-border); margin-top: var(--cr-space-5); }
.cr-inquiry-card h3 { font-size: var(--cr-font-size-md); font-weight: var(--cr-font-weight-semibold); margin-bottom: var(--cr-space-4); }
.cr-field { margin-bottom: var(--cr-space-3); }
.cr-field label { display: block; font-size: var(--cr-font-size-sm); font-weight: var(--cr-font-weight-medium); margin-bottom: var(--cr-space-1); color: var(--cr-text-primary); }
.cr-field input, .cr-field textarea { width: 100%; padding: var(--cr-space-2) var(--cr-space-3); border: 1px solid var(--cr-border); border-radius: var(--cr-radius-md); background: var(--cr-bg-surface); color: var(--cr-text-primary); font-size: var(--cr-font-size-sm); font-family: var(--cr-font-family); }
.cr-field input:focus, .cr-field textarea:focus { outline: none; border-color: var(--cr-text-primary); }
.cr-field textarea { resize: vertical; min-height: 80px; }

/* ── Flatpickr Overrides (Gigster-inspired) ──────────────────── */
.flatpickr-calendar {
    border-radius: var(--cr-radius-lg) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2) !important;
    border: 1px solid var(--cr-border) !important;
    padding: var(--cr-space-2) !important;
    font-family: var(--cr-font-family) !important;
    width: 300px !important;
    z-index: 10000 !important;
}
.flatpickr-months { padding: var(--cr-space-2) var(--cr-space-1) !important; }
.flatpickr-months .flatpickr-month { height: 36px !important; }
.flatpickr-current-month { font-size: var(--cr-font-size-base) !important; font-weight: 600 !important; }
.flatpickr-current-month .flatpickr-monthDropdown-months { font-weight: 600 !important; }
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month { padding: var(--cr-space-1) var(--cr-space-2) !important; }
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg { width: 12px !important; height: 12px !important; }
span.flatpickr-weekday { font-size: var(--cr-font-size-xs) !important; font-weight: 500 !important; color: var(--cr-text-tertiary) !important; text-transform: uppercase !important; letter-spacing: 0.5px !important; }
.flatpickr-day { border-radius: var(--cr-radius-md) !important; height: 36px !important; line-height: 36px !important; font-size: var(--cr-font-size-sm) !important; margin: var(--cr-space-1) !important; transition: all 0.15s ease !important; }
.flatpickr-day:hover { background: var(--cr-bg-hover) !important; border-color: transparent !important; }
.flatpickr-day.today { border: none !important; font-weight: 700 !important; position: relative; }
.flatpickr-day.today::after { content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--cr-text-primary); }
.flatpickr-day.selected,
.flatpickr-day.selected:hover { border-radius: var(--cr-radius-md) !important; font-weight: 600 !important; }
.dayContainer { padding: var(--cr-space-1) 0 !important; }
.flatpickr-innerContainer { padding: 0 var(--cr-space-1) !important; }
input[type="date"].flatpickr-input { display: none; }

/* Dark theme overrides */
[data-theme="dark"] .flatpickr-calendar { background: var(--cr-bg-secondary) !important; border: 1px solid var(--cr-border) !important; box-shadow: 0 8px 24px rgba(0,0,0,.4) !important; font-family: var(--cr-font-family) !important; }
[data-theme="dark"] .flatpickr-calendar .flatpickr-month,
[data-theme="dark"] .flatpickr-calendar .flatpickr-months .flatpickr-prev-month,
[data-theme="dark"] .flatpickr-calendar .flatpickr-months .flatpickr-next-month { color: var(--cr-text-primary) !important; fill: var(--cr-text-primary) !important; }
[data-theme="dark"] .flatpickr-calendar .flatpickr-weekday { color: var(--cr-text-secondary) !important; }
[data-theme="dark"] .flatpickr-calendar .flatpickr-day { color: var(--cr-text-primary) !important; border-radius: var(--cr-radius-sm) !important; }
[data-theme="dark"] .flatpickr-calendar .flatpickr-day:hover { background: var(--cr-bg-hover) !important; border-color: var(--cr-bg-hover) !important; }
[data-theme="dark"] .flatpickr-calendar .flatpickr-day.selected { background: var(--cr-text-primary) !important; color: var(--cr-bg-primary) !important; border-color: var(--cr-text-primary) !important; }
[data-theme="dark"] .flatpickr-calendar .flatpickr-day.today { border-color: var(--cr-text-secondary) !important; }

/* Light theme overrides */
[data-theme="light"] .flatpickr-calendar { background: var(--cr-bg-primary) !important; border: 1px solid var(--cr-border) !important; box-shadow: 0 8px 24px rgba(0,0,0,.1) !important; font-family: var(--cr-font-family) !important; }
[data-theme="light"] .flatpickr-calendar .flatpickr-month,
[data-theme="light"] .flatpickr-calendar .flatpickr-current-month,
[data-theme="light"] .flatpickr-calendar .flatpickr-months .flatpickr-prev-month,
[data-theme="light"] .flatpickr-calendar .flatpickr-months .flatpickr-next-month { color: var(--cr-text-primary) !important; fill: var(--cr-text-primary) !important; }
[data-theme="light"] .flatpickr-calendar .flatpickr-months .flatpickr-prev-month svg,
[data-theme="light"] .flatpickr-calendar .flatpickr-months .flatpickr-next-month svg { fill: var(--cr-text-primary) !important; }
[data-theme="light"] .flatpickr-calendar .flatpickr-weekday { color: var(--cr-text-secondary) !important; }
[data-theme="light"] .flatpickr-calendar .flatpickr-day { color: var(--cr-text-primary) !important; }
[data-theme="light"] .flatpickr-calendar .flatpickr-day:hover { background: var(--cr-bg-hover) !important; border-color: var(--cr-bg-hover) !important; }
[data-theme="light"] .flatpickr-calendar .flatpickr-day.selected { background: var(--cr-bg-primary) !important; color: var(--cr-text-inverse) !important; border-color: var(--cr-bg-primary) !important; }
[data-theme="light"] .flatpickr-calendar .flatpickr-day.today { border-color: var(--cr-text-secondary) !important; }
[data-theme="light"] .flatpickr-calendar .flatpickr-day.prevMonthDay,
[data-theme="light"] .flatpickr-calendar .flatpickr-day.nextMonthDay { color: var(--cr-text-tertiary) !important; }

/* ── Amenity Grid ────────────────────────────────────────────── */
.cr-amenity-group { margin-bottom: var(--cr-space-4); }
.cr-amenity-group-title { font-size: var(--cr-font-size-xs); font-weight: var(--cr-font-weight-semibold); color: var(--cr-text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: var(--cr-space-2); }
.cr-amenity-list { display: flex; flex-wrap: wrap; gap: var(--cr-space-2); }
.cr-amenity-pill { display: inline-flex; align-items: center; gap: var(--cr-space-1); padding: var(--cr-space-1) var(--cr-space-3); background: var(--cr-bg-surface); border: 1px solid var(--cr-border); border-radius: var(--cr-radius-full); font-size: var(--cr-font-size-xs); color: var(--cr-text-secondary); }
.cr-amenity-pill .check { color: var(--cr-success); font-size: 10px; }

/* ── Parking ─────────────────────────────────────────────────── */
.cr-parking-info { display: flex; align-items: center; gap: var(--cr-space-3); padding: var(--cr-space-3) var(--cr-space-4); border: 1px solid var(--cr-border); border-radius: var(--cr-radius-md); background: var(--cr-bg-elevated); font-size: var(--cr-font-size-sm); color: var(--cr-text-secondary); }
.cr-parking-info .count { font-weight: var(--cr-font-weight-semibold); color: var(--cr-text-primary); }

/* ── Listing Card (shared card template for all listing pages) ─ */
.cr-listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--cr-space-4); }
.cr-listing-card { border: 1px solid var(--cr-border); border-radius: var(--cr-radius-lg); background: var(--cr-bg-elevated); transition: border-color 0.2s, transform 0.2s; text-decoration: none; color: inherit; display: block; overflow: hidden; }
.cr-listing-card:hover { border-color: var(--cr-text-tertiary); transform: translateY(-1px); }
.cr-listing-card.current { border-color: var(--cr-border); position: relative; pointer-events: none; }
.cr-listing-card.current .listing-photo { position: relative; }
.cr-listing-card.current .listing-photo::after { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.45); z-index: 1; }
.cr-listing-card.current::after { content: 'Viewing'; position: absolute; top: var(--cr-space-2); right: var(--cr-space-2); font-size: var(--cr-font-size-xs); font-weight: var(--cr-font-weight-medium); color: var(--cr-bg-primary); background: var(--cr-text-primary); padding: var(--cr-space-1) var(--cr-space-3); border-radius: var(--cr-radius-full); z-index: 2; }
.cr-listing-card .listing-photo { height: 120px; overflow: hidden; background: var(--cr-bg-surface); }
.cr-listing-card .listing-photo img { width: 100%; height: 100%; object-fit: cover; }
.cr-listing-card .listing-photo .no-photo { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--cr-text-tertiary); font-size: var(--cr-font-size-xs); }
.cr-listing-card .listing-body { padding: var(--cr-space-3) var(--cr-space-4); display: flex; justify-content: space-between; align-items: center; }
.cr-listing-card h4 { font-size: var(--cr-font-size-md); font-weight: var(--cr-font-weight-semibold); margin: 0; }
.cr-listing-card .listing-meta { font-size: var(--cr-font-size-xs); color: var(--cr-text-secondary); white-space: nowrap; }

/* ── Also At Facility Cards — now uses .cr-listing-card above ── */

/* ── Availability Modal ──────────────────────────────────────── */
.cr-availability-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 9999; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; }
.cr-availability-modal-overlay.active { opacity: 1; visibility: visible; }
.cr-availability-modal { background: var(--cr-bg-elevated); border: 1px solid var(--cr-border); border-radius: var(--cr-radius-lg); width: 90%; max-width: 360px; overflow: hidden; font-family: var(--cr-font-family); }
.cr-avail-modal-header { padding: var(--cr-space-4) var(--cr-space-5); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--cr-border); }
.cr-avail-modal-title { font-size: var(--cr-font-size-md); font-weight: var(--cr-font-weight-semibold); color: var(--cr-text-primary); margin: 0; }
.cr-avail-modal-close { background: none; border: none; color: var(--cr-text-tertiary); cursor: pointer; font-size: 20px; padding: var(--cr-space-1); line-height: 1; border-radius: var(--cr-radius-sm); transition: color 0.15s; }
.cr-avail-modal-close:hover { color: var(--cr-text-primary); }
.cr-availability-modal-body { padding: var(--cr-space-5); min-height: 480px; display: flex; flex-direction: column; }
.cr-avail-legend { display: flex; align-items: center; justify-content: center; gap: var(--cr-space-2); padding: var(--cr-space-2) var(--cr-space-5); }
.cr-avail-legend-pill { display: inline-flex; align-items: center; gap: 0; font-size: 10px; font-weight: var(--cr-font-weight-medium); padding: 3px 10px; border-radius: var(--cr-radius-full); border: none; }
.cr-avail-legend-pill.avail  { background: rgba(46,125,50,0.12); color: #2e7d32; }
.cr-avail-legend-pill.pending { background: rgba(245,158,11,0.14); color: #b45309; }
.cr-avail-legend-pill.booked  { background: rgba(239,68,68,0.12); color: #dc2626; }
[data-theme="dark"] .cr-avail-legend-pill.avail  { background: rgba(102,187,106,0.16); color: #66bb6a; }
[data-theme="dark"] .cr-avail-legend-pill.pending { background: rgba(245,158,11,0.16); color: #fbbf24; }
[data-theme="dark"] .cr-avail-legend-pill.booked  { background: rgba(239,68,68,0.16); color: #f87171; }
.cr-avail-legend-dot { display: none; }
.cr-avail-private-msg { font-size: var(--cr-font-size-sm); color: var(--cr-text-secondary); text-align: center; padding: var(--cr-space-6) 0; }
.cr-availability-cal .cr-datepicker { max-width: 320px; margin: 0 auto; }

/* Space Detail Modal → facility.php inline (page-specific) */

/* ── Responsive ── */
@media (max-width: 768px) {
    .cr-hero-grid { grid-template-columns: 1fr; grid-template-rows: 300px; }
    .cr-hero-side { display: none; }
    .cr-mkt-nav .nav-links { gap: var(--cr-space-2); }
    .cr-listing-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .cr-mkt-nav { padding: var(--cr-space-3); }
    .cr-mkt-nav .nav-links { gap: var(--cr-space-1); }
}

/* ═══════════════════════════════════════════════════════════
   Host Message Modal (.cr-msg-*)
   ═══════════════════════════════════════════════════════════ */

.cr-msg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 900;
    align-items: center;
    justify-content: center;
    display: flex;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.cr-msg-overlay.open { opacity: 1; visibility: visible; }

.cr-msg-modal {
    background: var(--cr-bg-elevated);
    border-radius: 16px;
    width: 92%;
    max-width: 440px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.24), 0 8px 20px rgba(0,0,0,0.12);
    transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Host header bar — hidden in unified modal */
.cr-msg-host-bar { display: none; }

/* Title row — header bar */
.cr-msg-title-row {
    padding: 20px 24px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.cr-msg-title {
    margin: 0;
    font-size: 18px;
    font-weight: var(--cr-font-weight-bold);
    color: var(--cr-text-primary);
    display: flex;
    align-items: center;
    gap: var(--cr-space-2);
}
.cr-msg-back {
    background: none;
    border: none;
    padding: 0;
    color: var(--cr-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.15s ease;
}
.cr-msg-back:hover { color: var(--cr-text-primary); }
.cr-msg-close {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: var(--cr-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cr-text-tertiary);
    cursor: pointer;
    transition: all 0.15s ease;
}
.cr-msg-close:hover {
    background: var(--cr-bg-hover);
    color: var(--cr-text-primary);
}

/* Facility selector wrapper inside modal title row.
   The actual dropdown reuses .cr-facility-selector-wrap from portal.css. */
.cr-msg-facility-sel { flex-shrink: 0; margin-left: auto; margin-right: var(--cr-space-2); }
/* Inside the modal, dropdown should open downward over the body content. */
.cr-msg-facility-sel .cr-facility-dropdown { z-index: 910; }

/* Body & panels */
.cr-msg-body { padding: 20px 24px 24px; flex: 1; overflow-y: auto; min-height: 0; }
.cr-msg-body.flex-panel { display: flex; flex-direction: column; }
.cr-msg-panel { display: none; opacity: 0; }
.cr-msg-panel.visible { display: block; animation: crMsgFadeIn 0.3s ease forwards; }
@keyframes crMsgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Intent cards */
.cr-msg-intent-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cr-msg-intent-card {
    display: flex;
    align-items: center;
    gap: var(--cr-space-3);
    padding: 14px 16px;
    border: 1.5px solid var(--cr-border);
    border-radius: 12px;
    background: var(--cr-bg-primary);
    cursor: pointer;
    transition: all 0.18s ease;
}
.cr-msg-intent-card:hover {
    border-color: var(--cr-text-tertiary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}
[data-theme="dark"] .cr-msg-intent-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.cr-msg-intent-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cr-msg-intent-icon.cal  { background: #e8f5e9; color: #2e7d32; }
.cr-msg-intent-icon.tour { background: #e3f2fd; color: #1565c0; }
.cr-msg-intent-icon.msg  { background: #fce4ec; color: #c62828; }
[data-theme="dark"] .cr-msg-intent-icon.cal  { background: rgba(46,125,50,0.18); color: #66bb6a; }
[data-theme="dark"] .cr-msg-intent-icon.tour { background: rgba(21,101,192,0.18); color: #64b5f6; }
[data-theme="dark"] .cr-msg-intent-icon.msg  { background: rgba(198,40,40,0.18); color: #ef9a9a; }
.cr-msg-intent-text { flex: 1; min-width: 0; }
.cr-msg-intent-title {
    font-size: 14px;
    font-weight: var(--cr-font-weight-semibold);
    color: var(--cr-text-primary);
    line-height: 1.3;
}
.cr-msg-intent-desc {
    font-size: 12px;
    color: var(--cr-text-tertiary);
    line-height: 1.4;
    margin-top: 1px;
}
.cr-msg-intent-arrow {
    color: var(--cr-text-tertiary);
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.cr-msg-intent-card:hover .cr-msg-intent-arrow { transform: translateX(2px); }

/* Form elements */
.cr-msg-form-group { margin-bottom: var(--cr-space-3); }
.cr-msg-label {
    display: block;
    font-size: 12px;
    font-weight: var(--cr-font-weight-medium);
    color: var(--cr-text-secondary);
    margin-bottom: 6px;
}
.cr-msg-input,
.cr-msg-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--cr-border);
    border-radius: 10px;
    background: var(--cr-bg-primary);
    color: var(--cr-text-primary);
    font-family: var(--cr-font-family);
    font-size: 13px;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}
.cr-msg-textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
.cr-msg-textarea-tall { min-height: 120px; }

/* Send a Message panel — textarea matches calendar height from other panels */
#cr-msg-message-panel .cr-msg-textarea { min-height: 340px; }
.cr-msg-input:focus, .cr-msg-textarea:focus {
    outline: none;
    border-color: var(--cr-accent);
}
.cr-msg-section-label {
    font-size: 12px;
    font-weight: var(--cr-font-weight-semibold);
    color: var(--cr-text-secondary);
    margin-bottom: 10px;
}
.cr-msg-divider {
    height: 1px;
    background: var(--cr-border);
    margin: var(--cr-space-3) 0;
}
.cr-msg-submit {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-family: var(--cr-font-family);
    font-size: 14px;
    font-weight: var(--cr-font-weight-semibold);
    cursor: pointer;
    transition: all 0.18s ease;
    margin-top: var(--cr-space-4);
    background: var(--cr-accent);
    color: #fff;
}
.cr-msg-submit:hover {
    background: var(--cr-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.cr-msg-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Tour option pills — multi-choice date+time chips */
.cr-msg-tour-options {
    display: none;
    margin-bottom: 10px;
}
.cr-msg-tour-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    margin: 0 6px 6px 0;
    border-radius: var(--cr-radius-full, 999px);
    background: color-mix(in srgb, var(--cr-accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--cr-accent) 30%, transparent);
    font-size: 12px;
    font-weight: var(--cr-font-weight-medium);
    color: var(--cr-accent);
    line-height: 1;
}
.cr-msg-tour-pill-text {
    white-space: nowrap;
}
.cr-msg-tour-pill-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    background: none;
    color: var(--cr-accent);
    opacity: 0.6;
    cursor: pointer;
    border-radius: 50%;
    transition: opacity 0.15s, background 0.15s;
}
.cr-msg-tour-pill-x:hover {
    opacity: 1;
    background: color-mix(in srgb, var(--cr-accent) 20%, transparent);
}
.cr-msg-tour-add {
    display: inline-block;
    padding: 0;
    margin: 0 0 6px 0;
    border: none;
    background: none;
    color: var(--cr-accent);
    font-size: 12px;
    font-weight: var(--cr-font-weight-medium);
    cursor: pointer;
    text-decoration: none;
}
.cr-msg-tour-add:hover {
    text-decoration: underline;
}
.cr-msg-tour-pill-dur {
    opacity: 0.7;
    font-weight: var(--cr-font-weight-regular);
}

/* ── Tour Day Strip (scrollable, Today-bar style) ── */
.cr-tour-strip-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
    flex-shrink: 0;
}
.cr-tour-strip-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    flex-shrink: 0;
    border: 1.5px solid var(--cr-border);
    border-radius: 10px;
    background: var(--cr-bg-primary);
    color: var(--cr-text-secondary);
    cursor: pointer;
    padding: 0;
    transition: all 0.15s;
}
.cr-tour-strip-arrow:hover {
    border-color: var(--cr-text-tertiary);
    color: var(--cr-text-primary);
    background: var(--cr-bg-secondary);
}
.cr-tour-strip-arrow[disabled] {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* Scrollable wrapper with fade edges */
.cr-tour-days-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.cr-tour-days-wrap::before,
.cr-tour-days-wrap::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 32px;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.2s;
}
.cr-tour-days-wrap::before {
    left: 0;
    background: linear-gradient(to right, var(--cr-bg-primary), transparent);
    opacity: 0;
}
.cr-tour-days-wrap::after {
    right: 0;
    background: linear-gradient(to left, var(--cr-bg-primary), transparent);
    opacity: 0;
}
.cr-tour-days-wrap.fade-left::before  { opacity: 1; }
.cr-tour-days-wrap.fade-right::after  { opacity: 1; }

/* Day strip — horizontal scroll, grab-to-drag */
.cr-tour-days {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    padding: 2px 0;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
}
.cr-tour-days::-webkit-scrollbar { display: none; }
.cr-tour-days.grabbing { cursor: grabbing; scroll-behavior: auto; }

/* Day cell — bordered pill with month + date number */
.cr-tour-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-width: 44px;
    flex-shrink: 0;
    padding: 6px 6px 5px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    border: 1.5px solid var(--cr-border);
    border-radius: 10px;
    background: var(--cr-bg-primary);
}
.cr-tour-day:hover {
    border-color: var(--cr-text-tertiary);
    background: var(--cr-bg-secondary);
}
.cr-tour-day.selected {
    border-color: var(--cr-accent);
    background: color-mix(in srgb, var(--cr-accent) 8%, var(--cr-bg-primary));
}
.cr-tour-day.has-slots .cr-tour-day-num {
    color: var(--cr-text-primary);
    font-weight: var(--cr-font-weight-bold);
}
.cr-tour-day.no-slots {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}
.cr-tour-day-month {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cr-text-tertiary);
    line-height: 1.2;
}
.cr-tour-day-dow {
    font-size: var(--cr-font-size-xs);
    font-weight: var(--cr-font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cr-text-tertiary);
    line-height: 1;
}
.cr-tour-day-num {
    font-size: var(--cr-font-size-base);
    font-weight: var(--cr-font-weight-bold);
    color: var(--cr-text-secondary);
    line-height: 1;
}

/* Tour panel — fixed height, flex layout, button pinned to bottom */
#cr-msg-tour-panel.visible {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 12px;
}
#cr-msg-tour-panel .cr-msg-textarea {
    flex: 1;
    min-height: 40px;
    resize: none;
}
#cr-msg-tour-panel .cr-msg-submit {
    flex-shrink: 0;
}

/* Appointment type selector — centered row of pills before calendar */
.cr-appt-type-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
    margin-bottom: 12px;
}

/* Tour slots wrap — keep compact so textarea stretches */
#cr-tour-slots-wrap { flex-shrink: 0; }

/* Time slots carousel — same pattern as day strip */
.cr-tour-slots-wrap-outer {
    flex-shrink: 0;
    animation: crTourSlideIn 0.2s ease;
}
@keyframes crTourSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cr-tour-slots-strip {
    position: relative;
    overflow: hidden;
}
.cr-tour-slots-strip::before,
.cr-tour-slots-strip::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 28px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1;
}
.cr-tour-slots-strip::before {
    left: 0;
    background: linear-gradient(to right, var(--cr-bg-primary), transparent);
}
.cr-tour-slots-strip::after {
    right: 0;
    background: linear-gradient(to left, var(--cr-bg-primary), transparent);
}
.cr-tour-slots-strip.fade-left::before { opacity: 1; }
.cr-tour-slots-strip.fade-right::after { opacity: 1; }
.cr-tour-slots-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    padding: 2px 0;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
}
.cr-tour-slots-row::-webkit-scrollbar { display: none; }
.cr-tour-slots-row.grabbing { cursor: grabbing; scroll-behavior: auto; }

.cr-tour-slot {
    padding: 5px 12px;
    border: 1.5px solid var(--cr-border);
    border-radius: 8px;
    background: var(--cr-bg-primary);
    color: var(--cr-text-secondary);
    font-size: 12px;
    font-weight: var(--cr-font-weight-medium);
    font-family: var(--cr-font-family);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.cr-tour-slot:hover {
    border-color: var(--cr-accent);
    color: var(--cr-text-primary);
    background: color-mix(in srgb, var(--cr-accent) 6%, var(--cr-bg-primary));
}
.cr-tour-slot.selected {
    border-color: var(--cr-accent);
    background: color-mix(in srgb, var(--cr-accent) 12%, transparent);
    color: var(--cr-accent);
    font-weight: var(--cr-font-weight-semibold);
}

/* Templated tour message */
.cr-tour-template {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--cr-bg-secondary);
    border: 1px solid var(--cr-border);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--cr-text-secondary);
    overflow-y: auto;
}
.cr-tour-template-greeting {
    color: var(--cr-text-primary);
    font-weight: var(--cr-font-weight-medium);
    margin-bottom: 6px;
}
.cr-tour-template-body {
    margin-bottom: 8px;
}
.cr-tour-template-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    min-height: 28px;
}
.cr-tour-template-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    background: color-mix(in srgb, var(--cr-accent) 10%, var(--cr-bg-elevated));
    border: 1px solid color-mix(in srgb, var(--cr-accent) 25%, var(--cr-border));
    border-radius: 6px;
    font-size: 12px;
    font-weight: var(--cr-font-weight-medium);
    color: var(--cr-text-primary);
    white-space: nowrap;
}
.cr-tour-template-pill-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--cr-text-tertiary);
    color: var(--cr-bg-primary);
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    padding: 0;
    font-family: var(--cr-font-family);
}
.cr-tour-template-pill-x:hover {
    background: var(--cr-error);
}
.cr-tour-template-empty {
    padding: 6px 0;
    color: var(--cr-text-tertiary);
    font-style: italic;
    font-size: 12px;
}
/* Editable sections within template */
.cr-tour-template-greeting:focus,
.cr-tour-template-body:focus,
.cr-tour-template-custom:focus,
.cr-tour-template-signoff:focus {
    outline: none;
}
/* Custom message area — fills remaining vertical space */
.cr-tour-template-custom {
    flex: 1;
    min-height: 24px;
    color: var(--cr-text-primary);
    cursor: text;
}
.cr-tour-template-custom:empty::before {
    content: attr(data-placeholder);
    color: var(--cr-text-tertiary);
    font-style: italic;
    pointer-events: none;
}
.cr-tour-template-signoff {
    color: var(--cr-text-primary);
    font-weight: var(--cr-font-weight-medium);
    margin-top: 0;
    padding-top: 4px;
    flex-shrink: 0;
}

/* No slots / empty state */
.cr-tour-no-slots {
    text-align: center;
    padding: 12px;
    color: var(--cr-text-tertiary);
    font-size: 13px;
    font-style: italic;
}
.cr-tour-empty {
    text-align: center;
    padding: 5px 12px;
    color: var(--cr-text-tertiary);
    font-size: 12px;
    border: 1.5px dashed var(--cr-border);
    border-radius: 8px;
    flex-shrink: 0;
    line-height: 1.4;
}

/* Confirmation panel — vertically centered, no title row */
.cr-msg-confirm-panel-outer {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 260px;
}
.cr-msg-confirm-x {
    position: absolute;
    top: 4px;
    right: 0;
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: var(--cr-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cr-text-tertiary);
    cursor: pointer;
    transition: all 0.15s ease;
}
.cr-msg-confirm-x:hover {
    background: var(--cr-bg-hover);
    color: var(--cr-text-primary);
}
.cr-msg-confirm-wrap {
    text-align: center;
    padding: var(--cr-space-6) var(--cr-space-4);
}
.cr-msg-confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--cr-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--cr-space-4);
    background: color-mix(in srgb, var(--cr-success) 12%, transparent);
    color: var(--cr-success);
}
.cr-msg-confirm-icon svg { display: block; }
.cr-msg-confirm-heading {
    font-size: var(--cr-font-size-lg);
    font-weight: var(--cr-font-weight-bold);
    color: var(--cr-text-primary);
    margin: 0 0 var(--cr-space-2);
}
.cr-msg-confirm-text {
    font-size: var(--cr-font-size-sm);
    color: var(--cr-text-secondary);
    line-height: 1.5;
    margin: 0 0 var(--cr-space-5);
}

/* Date row (private availability) */
.cr-msg-date-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: var(--cr-space-3);
}
.cr-msg-date-row .cr-msg-form-group { margin-bottom: 0; }

/* Login prompt */
.cr-msg-login-wrap {
    text-align: center;
    padding: var(--cr-space-4) 0;
}
.cr-msg-login-wrap p {
    font-size: var(--cr-font-size-sm);
    color: var(--cr-text-secondary);
    margin-bottom: var(--cr-space-4);
}
.cr-msg-login-wrap .cr-msg-form-group { text-align: left; }
.cr-msg-login-error {
    color: var(--cr-error);
    font-size: var(--cr-font-size-xs);
    margin-bottom: var(--cr-space-2);
    text-align: left;
}
.cr-msg-login-links {
    margin-top: var(--cr-space-3);
    font-size: var(--cr-font-size-xs);
    text-align: center;
}
.cr-msg-login-links a { color: var(--cr-text-tertiary); }
.cr-msg-login-links a:hover { color: var(--cr-text-primary); }

/* Two-column layout for avail and tour panels */
.cr-msg-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}
.cr-msg-col-left { min-width: 0; }
.cr-msg-col-right {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.cr-msg-col-right .cr-msg-textarea { flex: 1; min-height: 120px; }
#cr-msg-tour-panel .cr-msg-col-right .cr-msg-textarea { min-height: 72px; flex: 1; }
.cr-msg-col-right .cr-msg-submit { margin-top: var(--cr-space-3); }

/* Availability calendar container */
.cr-msg-cal-container { margin-bottom: 0; }

/* Calendar shimmer / loading skeleton */
@keyframes crCalShimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}
.cr-msg-cal-shimmer {
    padding: 0;
}
.cr-cal-shim-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0 12px;
}
.cr-cal-shim-bar {
    height: 14px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--cr-bg-hover) 25%, color-mix(in srgb, var(--cr-bg-hover) 60%, transparent) 50%, var(--cr-bg-hover) 75%);
    background-size: 400px 100%;
    animation: crCalShimmer 1.4s ease infinite;
}
.cr-cal-shim-dow,
.cr-cal-shim-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cr-cal-shim-dow { margin-bottom: 4px; }
.cr-cal-shim-row { margin-bottom: 2px; }
.cr-cal-shim-cell {
    aspect-ratio: 1;
    border-radius: var(--cr-radius-md);
    background: linear-gradient(90deg, var(--cr-bg-hover) 25%, color-mix(in srgb, var(--cr-bg-hover) 60%, transparent) 50%, var(--cr-bg-hover) 75%);
    background-size: 400px 100%;
    animation: crCalShimmer 1.4s ease infinite;
}
.cr-cal-shim-label {
    aspect-ratio: auto;
    height: 12px;
    border-radius: 4px;
    margin: 0 4px;
}
.cr-cal-shim-empty {
    background: none;
    animation: none;
}

/* Legend — sits below calendar */
.cr-msg-avail-legend { margin-top: var(--cr-space-2); margin-bottom: 0; }

/* Tour date picker container */
.cr-msg-tour-cal-container { margin-bottom: 0; }

/* Square calendar cells inside modal — aspect-ratio forces equal width/height */
.cr-msg-col-left .cr-dp-grid {
    grid-template-rows: repeat(6, 1fr);
    gap: 2px;
}
.cr-msg-col-left .cr-dp-day {
    height: auto;
    aspect-ratio: 1;
    font-size: var(--cr-font-size-sm);
    border-radius: var(--cr-radius-md);
}
.cr-msg-col-left .cr-dp-header { margin-bottom: var(--cr-space-2); }
.cr-msg-col-left .cr-dp-title {
    font-size: var(--cr-font-size-base);
    font-weight: var(--cr-font-weight-bold);
}
.cr-msg-col-left .cr-dp-nav { width: 32px; height: 32px; }
.cr-msg-col-left .cr-dp-wday {
    font-size: var(--cr-font-size-xs);
    padding: var(--cr-space-1) 0;
}

@media (max-width: 600px) {
    .cr-msg-two-col {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}
