/* =========================================================================
   Host console. Same palette as the guest page, but built for reading and
   sorting rather than for atmosphere: quieter background, denser type.
   ========================================================================= */

:root
{
    --ink: #0B0A12;
    --panel: rgba(255, 255, 255, 0.04);
    --panel-line: rgba(255, 255, 255, 0.09);
    --cream: #F7F2E9;
    --muted: rgba(247, 242, 233, 0.62);
    --faint: rgba(247, 242, 233, 0.36);
    --gold: #D8B26A;
    --gold-soft: #E8C89A;
    --danger: #E5786E;
    --ok: #7FBF9A;

    --font-display: "Didot", "Bodoni 72", "Bodoni MT", "Playfair Display", Garamond, "Times New Roman", serif;
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --radius: 16px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

    /* Tells the browser to draw its own widgets dark: select popups, the date picker,
       scrollbars and focus rings. Without it a native <option> list renders on a white
       sheet and our cream text disappears into it. */
    color-scheme: dark;
}

*,
*::before,
*::after
{
    box-sizing: border-box;
}

/* The UA stylesheet's [hidden] rule loses to any author `display` declaration, so an
   element given both stays on screen. This makes the attribute mean what it says. */
[hidden]
{
    display: none !important;
}

body
{
    margin: 0;
    min-height: 100dvh;
    background: var(--ink);
    color: var(--cream);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------------------
   Backdrop: pooled gold light, the way candles sit in a dark room. Layered
   blurred discs rather than one flat gradient, so the colour has somewhere
   to gather and somewhere to fall away.
   ------------------------------------------------------------------------- */

.backdrop
{
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(120% 70% at 50% -10%, #17131F 0%, transparent 62%),
        linear-gradient(180deg, #0B0A12 0%, #0C0A14 50%, #08070D 100%);
}

.glow
{
    position: absolute;
    display: block;
    border-radius: 50%;
    filter: blur(70px);
    will-change: transform;
}

.glow-1
{
    width: 46vmax;
    height: 46vmax;
    top: -16vmax;
    left: -10vmax;
    background: radial-gradient(circle, rgba(216, 178, 106, 0.34), transparent 66%);
    animation: pool-a 30s var(--ease-in-out) infinite alternate;
}

.glow-2
{
    width: 34vmax;
    height: 34vmax;
    top: 24%;
    right: -8vmax;
    background: radial-gradient(circle, rgba(232, 200, 154, 0.22), transparent 68%);
    animation: pool-b 38s var(--ease-in-out) infinite alternate;
}

.glow-3
{
    width: 40vmax;
    height: 40vmax;
    bottom: -14vmax;
    left: 18%;
    background: radial-gradient(circle, rgba(216, 178, 106, 0.2), transparent 70%);
    animation: pool-c 34s var(--ease-in-out) infinite alternate;
}

/* One cool note keeps the gold from reading as a single flat wash. */
.glow-4
{
    width: 38vmax;
    height: 38vmax;
    bottom: -10vmax;
    right: 6%;
    background: radial-gradient(circle, rgba(91, 62, 107, 0.3), transparent 68%);
    animation: pool-b 44s var(--ease-in-out) infinite alternate-reverse;
}

/* A very slow diagonal sheen, like light moving across a foiled card. */
.shimmer
{
    position: absolute;
    inset: -30%;
    background: linear-gradient(
        104deg,
        transparent 38%,
        rgba(232, 200, 154, 0.05) 47%,
        rgba(247, 242, 233, 0.07) 50%,
        rgba(232, 200, 154, 0.05) 53%,
        transparent 62%);
    animation: sheen 22s linear infinite;
}

@keyframes pool-a { to { transform: translate3d(8vw, 6vh, 0) scale(1.16); } }
@keyframes pool-b { to { transform: translate3d(-7vw, -5vh, 0) scale(1.1); } }
@keyframes pool-c { to { transform: translate3d(6vw, -7vh, 0) scale(0.9); } }

@keyframes sheen
{
    0% { transform: translate3d(-24%, -12%, 0); }
    100% { transform: translate3d(24%, 12%, 0); }
}

.view
{
    position: relative;
    z-index: 1;
    display: none;
    max-width: 72rem;
    margin: 0 auto;
    padding:
        calc(env(safe-area-inset-top, 0px) + 20px)
        clamp(16px, 4vw, 32px)
        calc(env(safe-area-inset-bottom, 0px) + 40px);
}

.view.is-active
{
    display: block;
    animation: fade 0.35s var(--ease) both;
}

@keyframes fade
{
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Login ---------- */

.view[data-view="login"]
{
    display: none;
    place-items: center;
    min-height: 100dvh;
}

.view[data-view="login"].is-active
{
    display: grid;
}

.card
{
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-radius: 22px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.card-login
{
    max-width: 22rem;
    padding: 34px 28px 30px;
    text-align: center;
}

.brand
{
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.9rem;
    letter-spacing: 0.01em;
}

.brand-sm
{
    font-size: 1.3rem;
}

.sub
{
    margin: 4px 0 26px;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--faint);
}

/* ---------- Fields and buttons ---------- */

.field
{
    display: block;
    margin-bottom: 14px;
    text-align: left;
}

.field span
{
    display: block;
    margin-bottom: 6px;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}

.field input,
.field textarea,
select
{
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    color: var(--cream);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-line);
    border-radius: 12px;
    font-family: var(--font-ui);

    /* 16px so iOS does not zoom the layout when a field takes focus. */
    font-size: 16px;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.field textarea
{
    resize: vertical;
}

/* Drop the platform chevron and draw our own, so the control matches the panel
   instead of showing a light-mode arrow on a dark field. */
select
{
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--gold-soft) 50%),
        linear-gradient(135deg, var(--gold-soft) 50%, transparent 50%);
    background-position:
        calc(100% - 20px) calc(50% + 2px),
        calc(100% - 14px) calc(50% + 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    cursor: pointer;
}

/* The popup list is drawn by the OS. `color-scheme: dark` handles most platforms;
   these two lines cover the ones that still paint the sheet white. */
select option
{
    background-color: #14121F;
    color: #F7F2E9;
}

.field input:hover,
.field textarea:hover,
select:hover
{
    border-color: rgba(216, 178, 106, 0.3);
}

.field input:focus,
.field textarea:focus,
select:focus
{
    outline: none;
    border-color: rgba(216, 178, 106, 0.55);
    background: rgba(255, 255, 255, 0.07);
}

/* Keyboard users get a ring the mouse never shows. */
.field input:focus-visible,
.field textarea:focus-visible,
select:focus-visible,
.btn:focus-visible,
.icon-btn:focus-visible,
.event-card:focus-visible
{
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.btn
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-family: var(--font-ui);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s var(--ease), background 0.2s;
}

.btn:active
{
    transform: scale(0.98);
}

.btn-primary
{
    width: 100%;
    color: #1A1408;
    background: linear-gradient(135deg, var(--gold-soft), var(--gold));
    font-weight: 600;
}

.btn-ghost
{
    color: var(--cream);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--panel-line);
}

.btn-xs
{
    width: auto;
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.82rem;
}

.error
{
    margin: 12px 0 0;
    color: var(--danger);
    font-size: 0.85rem;
}

/* ---------- Bars ---------- */

.bar
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.bar-actions
{
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Events list ---------- */

.events
{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    gap: 14px;
}

.event-card
{
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-radius: var(--radius);
    text-align: left;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.event-card:hover
{
    border-color: rgba(216, 178, 106, 0.42);
    transform: translateY(-2px);
}

/* A hairline of gold catching the top edge, as if lit from above. */
.event-card::before,
.settings::before,
.qr-block::before,
.card-login::before
{
    content: "";
    position: absolute;
    top: 0;
    left: 16%;
    right: 16%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(216, 178, 106, 0.5), transparent);
}

.event-card,
.settings,
.qr-block,
.card-login
{
    position: relative;
}

.event-card h3
{
    margin: 0 0 4px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.35rem;
}

.event-card p
{
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.stats
{
    display: flex;
    gap: 18px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--panel-line);
}

.stats b
{
    display: block;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    line-height: 1;
}

.stats small
{
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}

/* ---------- Event detail ---------- */

.event-head
{
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 22px;
}

.event-name
{
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.7rem, 5vw, 2.3rem);
}

.event-meta
{
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.qr-block
{
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-radius: var(--radius);
}

.qr
{
    width: 128px;
    height: 128px;
    border-radius: 10px;
    background: #fff;
    padding: 8px;
}

.qr-button
{
    padding: 0;
    background: none;
    border: 0;
    border-radius: 10px;
    cursor: zoom-in;
    line-height: 0;
    transition: transform 0.2s var(--ease);
}

.qr-button:hover
{
    transform: scale(1.03);
}

.qr-side
{
    min-width: 0;
}

.qr-hint
{
    margin: 10px 0 0;
    font-size: 0.74rem;
    color: var(--faint);
}

/* ---------- Scan-me overlay ---------- */

.scan-overlay
{
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(6, 5, 10, 0.96);
}

.scan-card
{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 30px;
    background: #fff;
    border-radius: 20px;
    text-align: center;
}

.scan-card img
{
    /* As large as the viewport allows: an easier target for a phone camera. */
    width: min(74vmin, 460px);
    height: min(74vmin, 460px);
    display: block;
    image-rendering: pixelated;
}

.scan-url
{
    margin: 0;
    max-width: min(74vmin, 460px);
    overflow-wrap: anywhere;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.78rem;
    color: #444;
}

.scan-help
{
    margin: 0;
    font-size: 0.86rem;
    color: #777;
}

.link
{
    display: block;
    max-width: 20rem;
    overflow-wrap: anywhere;
    font-size: 0.74rem;
    color: var(--gold-soft);
}

.qr-actions
{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

/* ---------- Settings ---------- */

.settings
{
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    padding: 18px;
    margin-bottom: 22px;
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-radius: var(--radius);
}

.setting
{
    display: block;
}

.setting > span
{
    display: block;
    margin-bottom: 6px;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}

.setting-inline
{
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
}

.setting-inline > span
{
    margin: 0;
    font-size: 0.88rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--cream);
}

.setting-inline input
{
    width: 20px;
    height: 20px;
    accent-color: var(--gold);
}

/* ---------- Panel tabs ---------- */

.panel-tabs
{
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--panel-line);
}

.vtab
{
    position: relative;
    min-height: 44px;
    padding: 0 18px;
    color: var(--muted);
    background: none;
    border: 0;
    font-family: var(--font-ui);
    font-size: 0.94rem;
    cursor: pointer;
    transition: color 0.2s var(--ease);
}

.vtab:hover
{
    color: var(--cream);
}

.vtab.is-active
{
    color: var(--cream);
}

/* The active tab is marked by light on the edge, not a filled block. */
.vtab.is-active::after
{
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.panel
{
    display: none;
}

.panel.is-active
{
    display: block;
    animation: fade 0.3s var(--ease) both;
}

/* ---------- Toolbar ---------- */

.toolbar
{
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.tool
{
    display: block;
    min-width: 9.5rem;
}

.tool-grow
{
    flex: 1 1 14rem;
}

.tool > span
{
    display: block;
    margin-bottom: 6px;
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}

.tool input,
.tool select
{
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    color: var(--cream);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-line);
    border-radius: 12px;
    font-family: var(--font-ui);
    font-size: 16px;
}

.tool input:focus,
.tool select:focus
{
    outline: none;
    border-color: rgba(216, 178, 106, 0.55);
}

.result-count
{
    margin: 0 0 14px;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
}

/* ---------- Guest profile banner ---------- */

.profile-banner
{
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    background: linear-gradient(120deg, rgba(216, 178, 106, 0.12), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(216, 178, 106, 0.3);
    border-radius: var(--radius);
}

.profile-avatar
{
    flex: none;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(216, 178, 106, 0.16);
    border: 1px solid rgba(216, 178, 106, 0.45);
    color: var(--gold-soft);
    font-family: var(--font-display);
    font-size: 1.25rem;
    text-transform: uppercase;
}

.profile-text
{
    flex: 1;
    min-width: 0;
}

.profile-text b
{
    display: block;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.25rem;
}

.profile-text small
{
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
}

/* ---------- Guest list ---------- */

.avatar img,
.profile-avatar img,
.lightbox-facts .fact-head .avatar img
{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar.has-photo,
.profile-avatar.has-photo,
.fact-head .avatar.has-photo
{
    background: none;
    overflow: hidden;
}

.profile-avatar,
.guest-card .avatar,
.fact-head .avatar
{
    overflow: hidden;
}

.guest-list
{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
    gap: 12px;
}

.guest-card
{
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px;
    text-align: left;
    color: inherit;
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.22s var(--ease), transform 0.22s var(--ease);
}

.guest-card:hover
{
    border-color: rgba(216, 178, 106, 0.42);
    transform: translateY(-2px);
}

.guest-card .avatar
{
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(216, 178, 106, 0.14);
    border: 1px solid rgba(216, 178, 106, 0.35);
    color: var(--gold-soft);
    font-family: var(--font-display);
    font-size: 1.15rem;
    text-transform: uppercase;
}

.guest-card .who
{
    flex: 1;
    min-width: 0;
}

.guest-card .who b
{
    display: block;
    font-size: 0.98rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guest-card .who small
{
    display: block;
    font-size: 0.75rem;
    color: var(--faint);
}

.guest-card .tally
{
    flex: none;
    text-align: right;
}

.guest-card .tally b
{
    display: block;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1;
    color: var(--gold-soft);
    font-variant-numeric: tabular-nums;
}

.guest-card .tally small
{
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}

/* ---------- Media grid ---------- */

.media-grid
{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.media-card
{
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-line);
}

.media-card .shot
{
    display: block;
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.media-card img
{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-card .placeholder
{
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-size: 0.72rem;
    color: var(--faint);
}

.media-foot
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 7px 9px;
    font-size: 0.72rem;
    color: var(--muted);
}

.media-foot span
{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-btn
{
    flex: none;
    width: 30px;
    height: 30px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.06);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
}

.icon-btn:hover
{
    color: var(--cream);
}

.badge
{
    position: absolute;
    top: 7px;
    left: 7px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(6px);
}

.badge-pending { background: rgba(216, 178, 106, 0.85); color: #1A1408; }
.badge-rejected { background: rgba(229, 120, 110, 0.85); color: #2A0F0C; }
.badge-failed { background: rgba(229, 120, 110, 0.5); color: var(--cream); }
.badge-deletedbyguest { background: rgba(120, 116, 140, 0.9); color: var(--cream); }

.media-card
{
    transition: border-color 0.22s var(--ease), transform 0.22s var(--ease);
}

.media-card:hover
{
    border-color: rgba(216, 178, 106, 0.4);
    transform: translateY(-2px);
}

/* A removed item stays visible to the host, but reads as retired. */
.media-card.is-removed .shot
{
    opacity: 0.42;
    filter: grayscale(0.7);
}

.stats b
{
    color: var(--gold-soft);
}

@media (prefers-reduced-motion: reduce)
{
    *,
    *::before,
    *::after
    {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.empty
{
    padding: 40px 0;
    color: var(--faint);
    text-align: center;
}

/* ---------- Dialog, lightbox, toast ---------- */

.dialog
{
    width: min(92vw, 26rem);
    padding: 24px;
    color: var(--cream);
    background: #14121F;
    border: 1px solid var(--panel-line);
    border-radius: 20px;
}

.dialog::backdrop
{
    background: rgba(6, 5, 10, 0.7);
    backdrop-filter: blur(4px);
}

.dialog h3
{
    margin: 0 0 18px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.4rem;
}

.dialog-actions
{
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.lightbox
{
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(6, 5, 10, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lightbox[hidden]
{
    display: none;
}

.lightbox-body
{
    display: flex;
    gap: 20px;
    align-items: flex-start;
    max-width: 100%;
    max-height: 88dvh;
}

.lightbox-inner img,
.lightbox-inner video
{
    max-width: min(62vw, 900px);
    max-height: 86dvh;
    border-radius: 12px;
    display: block;
}

/* Provenance sits beside the photo: who took it, when, and on what. */
.lightbox-facts
{
    width: 17rem;
    max-height: 86dvh;
    overflow-y: auto;
    padding: 18px;
    background: rgba(20, 18, 31, 0.92);
    border: 1px solid var(--panel-line);
    border-radius: var(--radius);
}

/* The pull-up handle. Only ever shown on a phone, where the facts sit in a
   sheet rather than beside the photo. */
.facts-grip
{
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 12px 0 14px;
    background: transparent;
    border: 0;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
}

.facts-grip .grip-bar
{
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: rgba(216, 178, 106, 0.55);
    transition: background 0.2s var(--ease);
}

.facts-grip:active .grip-bar
{
    background: rgba(216, 178, 106, 0.85);
}

.lightbox-facts dl
{
    display: grid;
    gap: 12px;
    margin: 0;
}

.lightbox-facts dt
{
    font-size: 0.63rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--faint);
}

.lightbox-facts dd
{
    margin: 3px 0 0;
    font-size: 0.88rem;
    color: var(--cream);
    overflow-wrap: anywhere;
}

.lightbox-facts .fact-head
{
    display: flex;
    align-items: center;
    gap: 11px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--panel-line);
}

.lightbox-facts .fact-head .avatar
{
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(216, 178, 106, 0.14);
    border: 1px solid rgba(216, 178, 106, 0.35);
    color: var(--gold-soft);
    font-family: var(--font-display);
    font-size: 1.05rem;
    text-transform: uppercase;
}

.lightbox-facts .fact-head b
{
    display: block;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.15rem;
}

.lightbox-facts .fact-head small
{
    font-size: 0.72rem;
    color: var(--faint);
}

@media (max-width: 900px)
{
    /* The photo is what they opened, so it keeps the screen. Provenance waits
       underneath as a sheet: one swipe up, or a tap on the handle. */
    .lightbox
    {
        padding: 14px 10px 72px;
    }

    .lightbox-body
    {
        flex-direction: column;
        gap: 0;
    }

    .lightbox-inner img,
    .lightbox-inner video
    {
        max-width: 94vw;
        max-height: 76dvh;
    }

    .lightbox-facts
    {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 8;
        width: 100%;
        max-height: 78dvh;
        padding: 0;
        border-width: 1px 0 0;
        border-radius: 20px 20px 0 0;
        background: rgba(20, 18, 31, 0.97);
        box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.52);

        /* Closed, only the handle clears the bottom edge. */
        transform: translateY(calc(100% - 58px));
        transition: transform 0.34s var(--ease-in-out);

        /* Nothing to scroll while it is shut, or the handle scrolls away. */
        overflow: hidden;
        overscroll-behavior: contain;
    }

    .lightbox.facts-open .lightbox-facts
    {
        transform: translateY(0);
        overflow-y: auto;
    }

    .facts-grip
    {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 1;
        background: rgba(20, 18, 31, 0.97);
    }

    .facts-body
    {
        padding: 0 18px 24px;
    }
}

.lightbox-close
{
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    color: var(--cream);
    background: rgba(255, 255, 255, 0.08);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.toast
{
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 70;
    padding: 12px 20px;
    background: #1D1A2B;
    border: 1px solid var(--panel-line);
    border-radius: 999px;
    font-size: 0.86rem;
    transform: translate(-50%, 16px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.28s var(--ease);
}

.toast.is-visible
{
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- Printable cards ----------
   The base rule must come BEFORE the print block: both selectors have the same
   specificity, so whichever is written last wins. With the order reversed the
   sheet stayed display:none on paper and every print came out blank. */

.print-sheet
{
    display: none;
}

@media print
{
    /* Hide the console, keep the sheet. */
    body > *
    {
        display: none !important;
    }

    .print-sheet
    {
        display: grid !important;
        gap: 0;
        color: #111;
        background: #fff;
    }

    /* Column count comes from the chosen cards-per-page. */
    .print-sheet[data-cols="1"] { grid-template-columns: 1fr; }
    .print-sheet[data-cols="2"] { grid-template-columns: 1fr 1fr; }

    .print-tile
    {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3mm;
        padding: 6mm 4mm;
        text-align: center;

        /* Never let a card be split across two sheets of paper. */
        break-inside: avoid;
        page-break-inside: avoid;

        /* A faint guide to cut along. */
        border: 0.2mm dashed #bbb;
    }

    .print-tile .names
    {
        margin: 0;
        font-family: "Didot", "Bodoni MT", Garamond, "Times New Roman", serif;
        font-weight: 400;
        line-height: 1.1;
    }

    .print-tile .date
    {
        margin: 0;
        letter-spacing: 0.3em;
        text-indent: 0.3em;
        text-transform: uppercase;
        color: #444;
    }

    .print-tile img
    {
        display: block;

        /* Printers drop background colours by default; the code must stay pure black. */
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-tile .call
    {
        margin: 0;
        color: #222;
    }

    /* Sizes per layout: bigger card, bigger code and type. */
    .print-sheet[data-per="2"] .print-tile { height: 138mm; }
    .print-sheet[data-per="2"] .names { font-size: 30pt; }
    .print-sheet[data-per="2"] .date { font-size: 10pt; }
    .print-sheet[data-per="2"] img { width: 62mm; height: 62mm; }
    .print-sheet[data-per="2"] .call { font-size: 12pt; }

    .print-sheet[data-per="4"] .print-tile { height: 138mm; }
    .print-sheet[data-per="4"] .names { font-size: 22pt; }
    .print-sheet[data-per="4"] .date { font-size: 8pt; }
    .print-sheet[data-per="4"] img { width: 52mm; height: 52mm; }
    .print-sheet[data-per="4"] .call { font-size: 9.5pt; }

    .print-sheet[data-per="6"] .print-tile { height: 92mm; }
    .print-sheet[data-per="6"] .names { font-size: 17pt; }
    .print-sheet[data-per="6"] .date { font-size: 7pt; }
    .print-sheet[data-per="6"] img { width: 40mm; height: 40mm; }
    .print-sheet[data-per="6"] .call { font-size: 8pt; }

    .print-sheet[data-per="8"] .print-tile { height: 69mm; }
    .print-sheet[data-per="8"] .names { font-size: 14pt; }
    .print-sheet[data-per="8"] .date { font-size: 6pt; }
    .print-sheet[data-per="8"] img { width: 32mm; height: 32mm; }
    .print-sheet[data-per="8"] .call { font-size: 7pt; }

    @page
    {
        size: A4;
        margin: 8mm;
    }
}

.dialog-note
{
    margin: 0 0 16px;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--muted);
}

@media (max-width: 560px)
{
    .qr-block
    {
        width: 100%;
    }

    .qr
    {
        width: 104px;
        height: 104px;
    }
}

/* A video tile, drawn rather than downloaded. */
.tile-video
{
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(216, 178, 106, 0.14), transparent 70%),
        linear-gradient(160deg, #241F33, #14121F);
}

.tile-video::after
{
    content: "";
    width: 0;
    height: 0;
    margin-left: 4px;
    border-left: 15px solid rgba(232, 200, 154, 0.9);
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

/* Fallback avatars were a gold wash; a neutral slate reads far better beside
   the guests who do have a photo. */
.avatar,
.profile-avatar,
.fact-head .avatar
{
    background: linear-gradient(155deg, #262133, #1A1726) !important;
    border-color: rgba(247, 242, 233, 0.16) !important;
    color: rgba(247, 242, 233, 0.72) !important;
}

.avatar.has-photo,
.profile-avatar.has-photo,
.fact-head .avatar.has-photo
{
    background: none !important;
}

/* An approved photo shows it at a glance in the grid. */
.icon-btn.is-approved
{
    color: #7FBF9A;
    background: rgba(127, 191, 154, 0.16);
}

/* -------------------------------------------------------------------------
   Filter actions and lightbox navigation
   ------------------------------------------------------------------------- */

.filter-actions
{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

/* Marked while a control has been changed but not yet applied, so the button
   says there is something waiting rather than looking inert. */
.btn.is-dirty
{
    box-shadow: 0 0 0 3px rgba(216, 178, 106, 0.22);
    animation: apply-nudge 2.4s var(--ease-in-out) infinite;
}

@keyframes apply-nudge
{
    0%, 100% { box-shadow: 0 0 0 3px rgba(216, 178, 106, 0.18); }
    50%      { box-shadow: 0 0 0 5px rgba(216, 178, 106, 0.1); }
}

/* Walking the grid without leaving the photo. */
.lightbox-step
{
    position: absolute;
    top: 50%;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    margin-top: -25px;
    color: var(--cream);
    background: rgba(10, 8, 16, 0.66);
    border: 1px solid rgba(247, 242, 233, 0.24);
    border-radius: 50%;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: transform 0.18s var(--ease), background 0.2s var(--ease);
}

.lightbox-step:hover
{
    background: rgba(20, 18, 31, 0.9);
    border-color: rgba(216, 178, 106, 0.45);
}

.lightbox-step:active
{
    transform: scale(0.94);
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-count
{
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(10, 8, 16, 0.6);
    border: 1px solid rgba(247, 242, 233, 0.16);
    font-size: 0.76rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

@media (max-width: 700px)
{
    .lightbox-step
    {
        width: 42px;
        height: 42px;
        margin-top: -21px;
        font-size: 1.4rem;
    }

    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
}

@media (prefers-reduced-motion: reduce)
{
    .btn.is-dirty
    {
        animation: none;
    }
}

/* ---------------------------------------------------------------------------
   Acting on the photo you are looking at
   --------------------------------------------------------------------------- */

.lightbox-tools
{
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 6;
    display: flex;
    gap: 10px;
}

.lb-tool
{
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--cream);
    background: rgba(10, 8, 16, 0.66);
    border: 1px solid rgba(247, 242, 233, 0.22);
    border-radius: 50%;
    cursor: pointer;
    text-decoration: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.16s var(--ease);
}

.lb-tool svg
{
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lb-tool:hover
{
    border-color: rgba(216, 178, 106, 0.5);
}

.lb-tool:active
{
    transform: scale(0.93);
}

.lb-tool[hidden]
{
    display: none;
}

/* On, meaning the photo is already approved or already hidden. */
.lb-tool.is-on
{
    color: #17131F;
    background: linear-gradient(150deg, var(--gold-soft), var(--gold));
    border-color: transparent;
}

.lb-danger:hover
{
    border-color: rgba(224, 49, 49, 0.55);
    color: #F0A9A9;
}

.lb-danger.is-on
{
    color: #17131F;
    background: linear-gradient(150deg, #F3B0B0, #E03131);
}

@media (max-width: 700px)
{
    .lightbox-tools
    {
        top: 12px;
        left: 12px;
        gap: 8px;
    }

    .lb-tool
    {
        width: 40px;
        height: 40px;
    }
}
