/* ============================================================================
   Booking editor — shared design layer.

   Used by every owner-facing booking editor screen (per-page editor, brand
   settings). Everything visual lives here so a look change is a one-place edit:
   templates carry structure, this file carries style.

   Sections:
     1. Tokens
     2. Shell (top bar · section nav · form column · preview column)
     3. Form controls
     4. Composite controls (toggles, cards, pills, questions, calendars)
     5. Live preview
     6. Toast
     7. Responsive
   ========================================================================= */

/* ===== 1. Tokens ========================================================= */

/* Tokens live on :root, NOT on .be-root. Custom properties only inherit down
   the tree, and two overlays render outside the shell: the toast is appended to
   document.body, and the crop modal is emitted after the root pane closes.
   Scoping tokens to .be-root left both with invalid var() references — a toast
   with no background/border and an invisible white-on-transparent modal button.
   Only the editor screens load this file, so :root is safe here. */
:root {
    --be-surface: #fff;
    --be-canvas: #fafafa;
    --be-sunken: #f9fafb;
    --be-border: #e5e7eb;
    --be-border-soft: #f3f4f6;
    --be-border-hover: #9ca3af;
    --be-line-strong: #d1d5db;

    --be-text: #111;
    --be-text-muted: #6b7280;
    --be-text-subtle: #9ca3af;
    --be-label: #374151;

    --be-accent: #111;
    --be-accent-hover: #333;
    --be-danger: #dc2626;
    --be-danger-soft: #fecaca;
    --be-danger-bg: #fef2f2;
    --be-success: #16a34a;

    --be-radius: 10px;
    --be-radius-sm: 8px;
    --be-radius-lg: 14px;
    --be-ring: 0 0 0 3px rgba(0, 0, 0, 0.06);
    --be-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);

    --be-nav-w: 200px;
    --be-preview-w: 380px;
    --be-gap: 32px;
    --be-topbar-h: 60px;
}

/* The shell pane itself — layout only; its styling tokens are above. */
.be-root {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    color: var(--be-text);
}

/* ===== 2. Shell ========================================================== */

.be-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--be-topbar-h);
    padding: 10px 0;
    margin-bottom: 24px;
    background: var(--be-surface);
    border-bottom: 1px solid var(--be-border-soft);
}

.be-topbar-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius-sm);
    color: var(--be-text-muted);
    font-size: 0.75rem;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}

.be-topbar-back:hover {
    border-color: var(--be-text);
    color: var(--be-text);
}

.be-topbar-heading {
    min-width: 0;
    flex: 1;
}

.be-topbar-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.be-topbar-sub {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: var(--be-text-subtle);
    font-family: 'SF Mono', 'Fira Code', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.be-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.be-layout {
    display: grid;
    grid-template-columns: var(--be-nav-w) minmax(0, 1fr) var(--be-preview-w);
    gap: var(--be-gap);
    align-items: start;
}

/* Set by booking-editor.js when the form is too short to be worth navigating —
   the form reclaims the column rather than leaving a dead gutter. */
.be-layout.no-nav {
    grid-template-columns: minmax(0, 1fr) var(--be-preview-w);
}

.be-layout.no-nav .be-nav {
    display: none;
}

/* Section nav — populated from [data-nav-label] sections by booking-editor.js */
.be-nav {
    position: sticky;
    top: calc(var(--be-topbar-h) + 24px);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.be-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: none;
    border-radius: var(--be-radius-sm);
    background: none;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--be-text-muted);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.be-nav-item:hover {
    background: var(--be-sunken);
    color: var(--be-text);
}

.be-nav-item.active {
    background: var(--be-sunken);
    color: var(--be-text);
    font-weight: 600;
}

.be-nav-item i {
    width: 14px;
    flex-shrink: 0;
    font-size: 0.78rem;
    color: var(--be-text-subtle);
}

.be-nav-item.active i {
    color: var(--be-text);
}

/* Form column */
.be-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.be-section {
    scroll-margin-top: calc(var(--be-topbar-h) + 24px);
    padding: 22px 24px;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius-lg);
    background: var(--be-surface);
}

.be-section-title {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.be-section-desc {
    margin: 0 0 20px;
    font-size: 0.8rem;
    color: var(--be-text-muted);
    line-height: 1.5;
}

.be-field + .be-field {
    margin-top: 20px;
}

.be-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== 3. Form controls ================================================== */

.be-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--be-label);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* A field that stays folded away until it is relevant (Group bookings).
   `.be-label` sets display:block, which drops the summary's native disclosure
   triangle, so put it back — a heading with no affordance reads as dead text. */
.be-disclosure > summary {
    display: list-item;
    list-style-position: outside;
    margin-left: 14px;
    cursor: pointer;
}

.be-hint {
    margin: 6px 0 0;
    font-size: 0.78rem;
    color: var(--be-text-subtle);
    line-height: 1.5;
}

/* Hint used as a caption above its control rather than below it. */
.be-hint-caption {
    margin: 0 0 6px;
}

.be-hint-error {
    color: var(--be-danger);
}

.be-hint-success {
    color: var(--be-success);
}

.be-icon-google { color: #4285f4; }
.be-icon-ms { color: #00a4ef; }

.be-check .be-icon-google,
.be-check .be-icon-ms {
    font-size: 0.75rem;
}

.be-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius);
    background: var(--be-surface);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--be-text);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.be-input:focus,
.be-url:focus-within {
    border-color: var(--be-accent);
    box-shadow: var(--be-ring);
}

.be-input::placeholder {
    color: var(--be-text-subtle);
}

select.be-input {
    cursor: pointer;
}

textarea.be-input {
    resize: vertical;
}

.be-input-mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
}

/* Buttons */
.be-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius-sm);
    background: var(--be-surface);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--be-label);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.be-btn:hover {
    border-color: var(--be-border-hover);
    color: var(--be-text);
}

.be-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.be-btn-primary {
    min-width: 96px;
    border-color: var(--be-accent);
    background: var(--be-accent);
    color: #fff;
    font-weight: 600;
}

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

.be-btn-primary:disabled:hover {
    border-color: var(--be-accent);
    background: var(--be-accent);
}

.be-btn-primary.be-btn-saved,
.be-btn-primary.be-btn-saved:hover {
    border-color: var(--be-success);
    background: var(--be-success);
    color: #fff;
}

.be-btn-danger {
    border-color: var(--be-danger-soft);
    color: var(--be-danger);
}

.be-btn-danger:hover {
    border-color: var(--be-danger);
    background: var(--be-danger-bg);
    color: var(--be-danger);
}

.be-btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
}

.be-btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* ===== 4. Composite controls ============================================= */

/* Switch — one implementation, sized by modifier */
.be-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.be-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.be-switch .be-switch-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--be-line-strong);
    cursor: pointer;
    transition: background 0.2s;
}

.be-switch .be-switch-track::after {
    content: '';
    position: absolute;
    left: 3px;
    bottom: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.be-switch input:checked + .be-switch-track {
    background: var(--be-accent);
}

.be-switch input:checked + .be-switch-track::after {
    transform: translateX(20px);
}

.be-switch input:focus-visible + .be-switch-track {
    box-shadow: var(--be-ring);
}

.be-switch-sm {
    width: 36px;
    height: 20px;
}

.be-switch-sm .be-switch-track::after {
    left: 2px;
    bottom: 2px;
    width: 16px;
    height: 16px;
}

.be-switch-sm input:checked + .be-switch-track::after {
    transform: translateX(16px);
}

.be-switch-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--be-text-subtle);
}

.be-switch-label.on {
    color: var(--be-text);
}

/* Checkbox rows */
.be-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.85rem;
    color: var(--be-label);
    cursor: pointer;
}

.be-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--be-accent);
    cursor: pointer;
}

/* States something that always happens — checked and non-interactive. */
.be-check-locked {
    align-items: flex-start;
    cursor: default;
    color: var(--be-text);
}

/* Reads as a ticked box without being a form control — nothing to submit,
   and no greyed-out disabled checkbox implying the opposite of the message. */
.be-check-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    border-radius: 4px;
    background: var(--be-accent);
    color: #fff;
    font-size: 0.6rem;
}

.be-check-sub {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--be-text-subtle);
}

/* A control that qualifies the statement above it. */
.be-subfield {
    margin-top: 12px;
    padding-left: 24px;
}

.be-check-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.be-check-meta {
    margin-left: auto;
    max-width: 50%;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem;
    color: var(--be-text-subtle);
    white-space: nowrap;
}

/* Duration input */
.be-duration,
.be-color {
    display: flex;
    align-items: center;
    gap: 10px;
}

.be-duration input {
    width: 84px;
    text-align: center;
    font-weight: 600;
    -moz-appearance: textfield;
}

.be-duration input::-webkit-inner-spin-button,
.be-duration input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.be-suffix {
    font-size: 0.85rem;
    color: var(--be-text-muted);
}

/* URL field */
.be-url {
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius);
    background: var(--be-sunken);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.be-url-prefix {
    padding: 10px 0 10px 14px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--be-text-subtle);
    white-space: nowrap;
}

.be-url input {
    flex: 1;
    min-width: 0;
    padding: 10px 8px 10px 0;
    border: none;
    background: transparent;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--be-text);
    outline: none;
}

/* Location cards */
.be-loc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.be-loc {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 14px;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius);
    background: var(--be-surface);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background 0.15s;
}

.be-loc:hover {
    border-color: var(--be-border-hover);
}

.be-loc-connect {
    border-color: #bfdbfe;
    background: #eff6ff;
    text-decoration: none;
}

.be-loc-connect:hover {
    border-color: #60a5fa;
    background: #dbeafe;
}

.be-loc-connect .be-loc-icon {
    background: #dbeafe;
    color: #2563eb;
}

.be-loc-connect:hover .be-loc-icon {
    background: #bfdbfe;
}

.be-loc-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.be-loc-connect-label {
    color: #2563eb;
    font-size: 0.7rem;
    font-weight: 600;
}

/* The radio drives selection; the card is its visible surface. */
.be-loc-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
}

.be-loc:focus-within {
    border-color: var(--be-accent);
    box-shadow: var(--be-ring);
}

.be-loc.selected {
    border-color: var(--be-accent);
    background: var(--be-canvas);
}

.be-loc-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: var(--be-radius-sm);
    background: var(--be-border-soft);
    color: var(--be-text-muted);
    font-size: 0.85rem;
    transition: background 0.15s, color 0.15s;
}

.be-loc.selected .be-loc-icon {
    background: var(--be-accent);
    color: #fff;
}

.be-loc-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--be-label);
}

.be-reveal {
    display: none;
    margin-top: 10px;
}

.be-reveal.show {
    display: block;
}

/* Weekly schedule */
.be-sched-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--be-border-soft);
}

.be-sched-row:last-child {
    border-bottom: none;
}

.be-sched-day {
    width: 36px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--be-text-muted);
}

.be-sched-day.active {
    color: var(--be-text);
}

.be-sched-times {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.be-sched-times.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* A day can hold several blocks (split around lunch). They stack vertically,
   while a single-block day keeps the original one-line layout. */
.be-sched-intervals {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.be-sched-interval {
    display: flex;
    align-items: center;
    gap: 6px;
}

.be-sched-interval-remove {
    flex-shrink: 0;
    padding: 4px;
    border: none;
    background: none;
    color: var(--be-text-subtle);
    font-size: 0.8rem;
    cursor: pointer;
}

.be-sched-interval-remove:hover {
    color: var(--be-danger);
}

.be-sched-add {
    flex-shrink: 0;
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--be-text-muted);
    cursor: pointer;
    white-space: nowrap;
}

.be-sched-add:hover {
    color: var(--be-text);
}

.be-sched-dash {
    font-size: 0.8rem;
    color: var(--be-text-subtle);
}

.be-time {
    width: 130px;
    padding: 6px 8px;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius-sm);
    font-family: inherit;
    font-size: 0.8rem;
    text-align: center;
    outline: none;
    transition: border-color 0.15s;
}

.be-time:focus {
    border-color: var(--be-accent);
}

/* Duration pills */
/* Wrapping row of inline controls — pills, connect links, question fields. */
.be-pills,
.be-connect,
.be-question-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.be-pill {
    padding: 7px 15px;
    font-family: inherit;
    border: 1.5px solid var(--be-border);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--be-label);
    background: var(--be-surface);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.be-pill:hover {
    border-color: var(--be-border-hover);
}

.be-pill:focus-visible {
    outline: none;
    border-color: var(--be-accent);
    box-shadow: var(--be-ring);
}

.be-pill.selected {
    border-color: var(--be-accent);
    background: var(--be-accent);
    color: #fff;
}

.be-pill.locked {
    cursor: default;
}

/* Custom questions */
.be-question {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    padding: 12px;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius);
    background: var(--be-surface);
}

.be-question-fields {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
}

.be-question-top .be-input {
    flex: 1;
    min-width: 120px;
    width: auto;
    padding: 8px 12px;
    font-size: 0.85rem;
}

.be-question-top select.be-input {
    flex: 0 0 auto;
    min-width: 0;
}

.be-question-required {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: var(--be-text-muted);
    white-space: nowrap;
    cursor: pointer;
}

.be-question-required input {
    width: 14px;
    height: 14px;
    accent-color: var(--be-accent);
    cursor: pointer;
}

.be-question-remove,
.be-override-remove {
    flex-shrink: 0;
    margin-top: 6px;
    padding: 4px;
    border: none;
    background: none;
    color: var(--be-text-subtle);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.15s;
}

.be-question-remove:hover,
.be-override-remove:hover {
    color: var(--be-danger);
}

/* Date overrides — one-off exceptions to the weekly schedule. */
.be-override {
    margin-bottom: 8px;
    padding: 12px;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius);
    background: var(--be-surface);
}

.be-override-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.be-override-top .be-override-remove {
    margin-top: 0;
    margin-left: auto;
}

.be-override-date {
    flex: 0 0 auto;
    width: 170px;
    padding: 8px 12px;
    font-size: 0.85rem;
}

.be-override-blocked {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    font-size: 0.78rem;
    color: var(--be-text-muted);
    white-space: nowrap;
    cursor: pointer;
}

.be-override-blocked input {
    width: 14px;
    height: 14px;
    accent-color: var(--be-accent);
    cursor: pointer;
}

.be-override-times {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
}

.be-override-times.be-override-hidden {
    display: none;
}

.be-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1.5px dashed var(--be-line-strong);
    border-radius: var(--be-radius-sm);
    background: none;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--be-text-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.be-add:hover {
    border-color: var(--be-border-hover);
    color: var(--be-label);
}

/* Variable reference (calendar event name) */
.be-vars {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--be-border-soft);
    border-radius: var(--be-radius-sm);
    background: var(--be-sunken);
}

.be-vars-title {
    margin: 0 0 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--be-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.be-var {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 2px 0;
    font-size: 0.8rem;
    color: var(--be-text-muted);
}

.be-var code {
    padding: 1px 6px;
    border-radius: 5px;
    background: #eef2f7;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    color: var(--be-text);
    white-space: nowrap;
}

.be-echo {
    margin-top: 8px;
    min-height: 1em;
    font-size: 0.82rem;
    color: var(--be-label);
}

.be-echo-value {
    font-weight: 600;
    color: var(--be-text);
}

/* Colour field */
.be-color input[type="color"] {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    padding: 2px;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius-sm);
    background: var(--be-surface);
    cursor: pointer;
}

/* Logo dropzone */
.be-drop {
    padding: 20px;
    border: 2px dashed var(--be-border);
    border-radius: var(--be-radius);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.be-drop:hover,
.be-drop.dragover {
    border-color: var(--be-line-strong);
    background: var(--be-sunken);
}

.be-drop-icon {
    margin-bottom: 6px;
    font-size: 1.5rem;
    color: var(--be-text-subtle);
}

.be-drop img {
    max-height: 48px;
    max-width: 200px;
    margin: 0 auto;
    object-fit: contain;
}

.be-drop-actions {
    margin-top: 8px;
}

.be-crop {
    height: 300px;
}

.be-counter {
    margin: 4px 0 0;
    font-size: 0.72rem;
    color: var(--be-text-subtle);
    text-align: right;
}

/* ===== 5. Live preview =================================================== */

.be-preview {
    position: sticky;
    top: calc(var(--be-topbar-h) + 24px);
}

.be-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.be-preview-label {
    margin-right: auto;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--be-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Mobile-only affordance — see the ≤860px block. */
.be-preview-toggle {
    display: none;
    padding: 4px 10px;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius-sm);
    background: var(--be-surface);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--be-label);
    cursor: pointer;
}

.be-preview-frame {
    padding: 20px 16px 16px;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius-lg);
    background: var(--be-canvas);
}

/* The mock itself mirrors templates/event_type.html at narrow (stacked) width,
   so the preview is the real mobile layout rather than an invented one. */
.bp-logo {
    display: block;
    max-height: 40px;
    max-width: 160px;
    margin: 0 auto 14px;
    object-fit: contain;
}

.bp-card {
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.bp-accent {
    height: 3px;
    background: var(--bp-brand, #000);
}

.bp-info {
    padding: 18px;
    border-bottom: 1px solid #f3f4f6;
    background: #fafafa;
}

.bp-host {
    margin: 0 0 4px;
    font-size: 0.78rem;
    color: #6b7280;
}

.bp-title {
    margin: 0 0 10px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #111;
    overflow-wrap: anywhere;
}

.bp-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.8rem;
    color: #6b7280;
}

.bp-meta i {
    width: 14px;
    flex-shrink: 0;
    text-align: center;
    color: #9ca3af;
    font-size: 0.78rem;
}

.bp-desc {
    margin: 12px 0 0;
    font-size: 0.8rem;
    line-height: 1.55;
    color: #6b7280;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.bp-bio {
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
    font-size: 0.76rem;
    line-height: 1.55;
    color: #9ca3af;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* Content-block editor rows. Shared by the booking-page editor and the branding
   editor — both mount static/js/booking-widgets-editor.js, so the markup is the
   same and the styles cannot live on one page's template. */
.be-widget-row {
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius);
    padding: 12px;
    margin-bottom: 10px;
}

.be-widget-head {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.be-widget-head select {
    flex: 1;
}

.be-widget-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Content blocks — the preview's echo of the .bw-* rules in booking_base.html,
   scaled down to the preview card and without live embeds. */
.bp-widgets {
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bp-w-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    background: linear-gradient(135deg, #334155, #0f172a);
}

/* The play mark: a CSS triangle on a light disc, so the frame reads as video
   without shipping an icon font into the preview. */
.bp-w-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
}

.bp-w-play::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 52%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent #0f172a;
}

.bp-w-image {
    width: 100%;
    min-height: 56px;
    border-radius: 8px;
    background: #f3f4f6;
    overflow: hidden;
}

.bp-w-img {
    width: 100%;
    display: block;
    border-radius: 8px;
}

.bp-w-caption {
    margin: 6px 0 0;
    font-size: 0.72rem;
    color: #9ca3af;
    overflow-wrap: anywhere;
}

.bp-w-heading {
    margin: 0 0 3px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #111;
    overflow-wrap: anywhere;
}

.bp-w-body {
    margin: 0;
    font-size: 0.76rem;
    line-height: 1.55;
    color: #6b7280;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.bp-w-link {
    font-size: 0.76rem;
    font-weight: 500;
    color: #374151;
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}

.bp-w-quote {
    margin: 0;
    font-size: 0.76rem;
    line-height: 1.55;
    color: #6b7280;
    font-style: italic;
    overflow-wrap: anywhere;
}

.bp-w-cite {
    margin: 5px 0 0;
    font-size: 0.72rem;
    color: #9ca3af;
    overflow-wrap: anywhere;
}

/* Month grid — mirrors the .cal-* rules in templates/event_type.html. */
.bp-cal {
    padding: 16px 18px 18px;
}

.bp-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.bp-cal-month {
    font-size: 0.85rem;
    font-weight: 600;
    color: #111;
}

.bp-cal-arrows {
    display: flex;
    gap: 5px;
}

.bp-cal-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    color: #9ca3af;
    font-size: 0.55rem;
}

.bp-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.bp-cal-head {
    padding: 4px 0;
    font-size: 0.6rem;
    font-weight: 600;
    color: #9ca3af;
    text-align: center;
}

.bp-cal-day {
    padding: 5px 0;
    border-radius: 6px;
    font-size: 0.72rem;
    color: #d1d5db;
    text-align: center;
}

.bp-cal-day.on {
    background: color-mix(in srgb, var(--bp-brand, #000) 7%, #fff);
    color: #111;
    font-weight: 500;
}

.bp-cal-day.selected {
    background: var(--bp-brand, #000);
    color: #fff;
    font-weight: 600;
}

.bp-cal-day.today {
    position: relative;
}

.bp-cal-day.today::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--bp-brand, #000);
    transform: translateX(-50%);
}

.bp-cal-day.selected.today::after {
    background: #fff;
}

.bp-cal-tz {
    margin: 10px 0 0;
    font-size: 0.68rem;
    color: #9ca3af;
}

/* --- Face: the guest's details form --- */
.bp-form {
    padding: 18px;
}

.bp-form-heading {
    margin: 0 0 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #111;
}

.bp-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bp-field-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #374151;
}

/* Inert outline standing in for an input — the preview never accepts typing. */
.bp-field-box {
    padding: 7px 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 0.75rem;
    color: #9ca3af;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.bp-field-box.tall {
    min-height: 34px;
}

.bp-cta {
    margin-top: 14px;
    padding: 9px;
    border-radius: 8px;
    background: var(--bp-brand, #000);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
}

/* --- Face: the event on your calendar --- */
.bp-event-caption {
    margin: 0 0 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
}

.bp-event-calendar {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.bp-event-card {
    overflow: hidden;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.bp-event-body {
    padding: 14px 16px;
}

.bp-event-title {
    margin: 0 0 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #111;
    overflow-wrap: anywhere;
}

.bp-footer {
    padding: 10px;
    font-size: 0.68rem;
    color: #9ca3af;
    text-align: center;
}

/* ===== 6. Modal + toast ================================================== */

.be-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
}

.be-modal[hidden] {
    display: none;
}

.be-modal-card {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    border-radius: var(--be-radius-lg);
    background: var(--be-surface);
}

.be-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.be-modal-head .be-section-title {
    margin: 0;
}

.be-modal-close {
    border: none;
    background: none;
    font-size: 1.2rem;
    line-height: 1;
    color: var(--be-text-subtle);
    cursor: pointer;
}

.be-modal-close:hover {
    color: var(--be-text);
}

.be-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

/* ===== Toast ============================================================= */

.be-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 340px;
    padding: 11px 16px;
    border: 1.5px solid var(--be-border);
    border-radius: var(--be-radius);
    background: var(--be-surface);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
    font-size: 0.85rem;
    color: var(--be-label);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

.be-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.be-toast i {
    flex-shrink: 0;
}

.be-toast-success i {
    color: var(--be-success);
}

.be-toast-error {
    border-color: var(--be-danger-soft);
    color: var(--be-danger);
}

.be-toast-error i {
    color: var(--be-danger);
}

/* ===== 7. Responsive ===================================================== */

/* The preview column collapses before the nav does — the nav is a navigational
   affordance, the preview is supplementary. It moves ABOVE the form rather than
   below it: the form is six tall sections, so a preview appended at the bottom
   would never be seen. */
@media (max-width: 1180px) {
    .be-layout {
        grid-template-columns: var(--be-nav-w) minmax(0, 1fr);
    }

    .be-layout.no-nav {
        grid-template-columns: minmax(0, 1fr);
    }

    .be-layout.no-nav .be-preview,
    .be-layout.no-nav .be-form {
        grid-column: 1;
    }

    .be-nav {
        grid-row: 1 / span 2;
        grid-column: 1;
    }

    .be-preview {
        position: static;
        grid-row: 1;
        grid-column: 2;
        max-width: 420px;
        margin-bottom: 4px;
    }

    .be-form {
        grid-row: 2;
        grid-column: 2;
    }
}

/* Phone layout: one column, no section nav (the form is short enough to scroll),
   and the preview folds away behind a Show/Hide toggle so it never pushes the
   form off screen. */
@media (max-width: 860px) {
    .be-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .be-nav {
        display: none;
    }

    .be-preview {
        grid-row: 1;
        grid-column: 1;
        max-width: none;
        margin-bottom: 0;
    }

    .be-form {
        grid-row: 2;
        grid-column: 1;
    }

    .be-preview-bar {
        margin-bottom: 0;
    }

    .be-preview-toggle {
        display: inline-block;
    }

    .be-preview.collapsed .be-preview-frame {
        display: none;
    }

    .be-preview:not(.collapsed) .be-preview-bar {
        margin-bottom: 10px;
    }

    .be-loc-grid,
    .be-field-row {
        grid-template-columns: 1fr;
    }

    .be-time {
        width: 110px;
        font-size: 0.75rem;
    }

    .be-topbar-sub {
        display: none;
    }

    /* Four actions plus a title don't fit 390px at desktop padding; the title
       yields first, then the buttons tighten. Nothing may push the page wider
       than the viewport — a sideways-scrolling editor reads as broken. */
    .be-topbar {
        gap: 8px;
    }

    .be-topbar-title {
        font-size: 0.9rem;
    }

    .be-topbar-actions {
        gap: 6px;
    }

    .be-topbar-actions .be-btn {
        padding-left: 10px;
        padding-right: 10px;
    }

    .be-topbar-actions .be-btn-icon {
        padding-left: 8px;
        padding-right: 8px;
    }

    .be-check-meta {
        max-width: 40%;
    }
}

/* Guest reminders: separate the email settings from removing the whole reminder. */
#section-reminders { --be-text-subtle: #616161; }
#section-reminders .be-section-desc a { color: var(--be-text); text-decoration: underline; }
.be-reminder-help { margin-bottom: 20px; }
.be-reminder-help > summary { text-transform: none; letter-spacing: normal; font-weight: 500; }
.be-reminder-help code { overflow-wrap: anywhere; }
.be-reminder { border-top: 1px solid var(--be-border); padding: 20px 0 0; margin: 0; }
.be-reminder-title { margin: 0 0 16px; font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: 600; }
.be-reminder-options { margin-top: 16px; }
.be-reminder .reminder-widgets-hint { margin: 0 0 16px 24px; }
.be-reminder-footer { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--be-border); }
#section-reminders .be-input,
#section-reminders .be-btn,
#section-reminders .be-add,
#section-reminders .reminder-preview-frame { border-radius: 4px; }
#section-reminders .be-btn { transition: none; }
#section-reminders .be-btn:hover { color: var(--be-label); border-color: var(--be-border); }
#section-reminders .be-add { margin-top: 20px; border-style: solid; transition: none; }
#section-reminders .be-add:hover { color: var(--be-text-subtle); border-color: var(--be-border); background: transparent; }

.be-reminder-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
#section-reminders .reminder-offset-preset[aria-pressed="true"] { border-color: var(--be-text); color: var(--be-text); background: var(--be-sunken); }
