/* Check-in station (mw-cis-*) — standalone, no scoped CSS.
   The extracted, host-agnostic check-in list (MwCheckInStation) + its full-page host
   (CheckInStationPage). MitWare theme language (docs/plans/mitware-theme/): deep near-black
   ops canvas, hairline borders, flat fills, MitWare violet accent in milligrams, Geist body +
   JetBrains Mono for meta (times, counts), Material Symbols Rounded icons. The expanded row
   detail carries the theme's tail corner + edge glow (origin = the list flow, top-left).
   Every custom property is scoped to .mw-cis-root / .mw-cis-page so nothing leaks. */

.mw-cis-root,
.mw-cis-page {
    /* surfaces */
    --mw-cis-surface: hsl(240 12% 9%);
    --mw-cis-surface-elev: hsl(240 11% 11.5%);
    --mw-cis-surface-hover: hsla(0 0% 100% / 0.03);

    /* borders */
    --mw-cis-border: hsla(0 0% 100% / 0.06);
    --mw-cis-border-strong: hsla(0 0% 100% / 0.10);

    /* text */
    --mw-cis-text: hsl(0 0% 96%);
    --mw-cis-text-dim: hsl(240 5% 60%);
    --mw-cis-text-faint: hsl(240 5% 40%);

    /* accent — MitWare violet */
    --mw-cis-accent: hsl(263 90% 67%);
    --mw-cis-accent-soft: hsl(263 70% 79%);
    --mw-cis-accent-tint: hsla(263 90% 67% / 0.10);
    --mw-cis-accent-line: hsla(263 90% 67% / 0.30);

    /* status — calm, not neon */
    --mw-cis-green: hsl(152 55% 56%);
    --mw-cis-green-dim: hsla(152 55% 56% / 0.13);
    --mw-cis-amber: hsl(38 92% 62%);
    --mw-cis-amber-dim: hsla(38 92% 62% / 0.13);
    --mw-cis-blue: hsl(210 80% 65%);

    --mw-cis-font-body: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
    --mw-cis-font-mono: 'JetBrains Mono', ui-monospace, monospace;
    --mw-cis-radius: 12px;
    --mw-cis-radius-sm: 8px;
}

.mw-cis-root {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    height: 100%;
    color: var(--mw-cis-text);
    font-family: var(--mw-cis-font-body);
    font-weight: 400;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.mw-cis-root *,
.mw-cis-root *::before,
.mw-cis-root *::after { box-sizing: border-box; }

/* Material Symbols Rounded icon helper (scoped) */
.mw-cis-mi {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-size: 16px;
}

/* ── Search bar ── */
.mw-cis-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--mw-cis-border);
    border-radius: 999px;
    background: var(--mw-cis-surface-elev);
    color: var(--mw-cis-text-faint);
    flex-shrink: 0;
    transition: border-color 0.15s ease;
}

.mw-cis-search:focus-within {
    border-color: var(--mw-cis-accent-line);
}

.mw-cis-search input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--mw-cis-text);
    font-family: var(--mw-cis-font-body);
    font-size: 12.5px;
    outline: none;
}

.mw-cis-search input::placeholder {
    color: var(--mw-cis-text-faint);
}

.mw-cis-search-clear {
    display: inline-flex;
    align-items: center;
    border: none;
    background: transparent;
    color: var(--mw-cis-text-faint);
    cursor: pointer;
    padding: 2px;
}

.mw-cis-search-clear:hover {
    color: var(--mw-cis-text);
}

/* ── List ── */
.mw-cis-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.mw-cis-empty {
    padding: 18px;
    text-align: center;
    color: var(--mw-cis-text-faint);
    font-size: 12px;
}

.mw-cis-item {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    margin-bottom: 6px;
    border-radius: var(--mw-cis-radius);
}

.mw-cis-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid var(--mw-cis-border);
    border-radius: var(--mw-cis-radius);
    background: var(--mw-cis-surface-elev);
    font-family: var(--mw-cis-font-body);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.mw-cis-row:hover {
    border-color: var(--mw-cis-accent-line);
    background: var(--mw-cis-surface-hover);
}

.mw-cis-row--in {
    opacity: 0.72;
}

/* Expanded item — the theme's tail corner (top-left, pointing back into the list flow) +
   violet edge glow (anchored bottom-left, diagonal to the tail; the top edge stays clean).
   Recipe from docs/plans/mitware-theme/edge-glow-and-tail-corner.md. */
.mw-cis-item--expanded {
    border-radius: var(--mw-cis-radius);
    border-top-left-radius: 4px;
    border: 1.5px solid transparent;
    background:
        linear-gradient(var(--mw-cis-surface-elev), var(--mw-cis-surface-elev)) padding-box,
        radial-gradient(135% 125% at 0% 100%,
            color-mix(in srgb, var(--mw-cis-accent) 80%, transparent) 0%,
            color-mix(in srgb, var(--mw-cis-accent) 45%, transparent) 40%,
            transparent 72%) border-box,
        linear-gradient(var(--mw-cis-border-strong), var(--mw-cis-border-strong)) border-box;
    box-shadow: -3px 2px 9px -8px color-mix(in srgb, var(--mw-cis-accent) 65%, transparent);
    overflow: hidden;
}

.mw-cis-item--expanded .mw-cis-row {
    border: none;
    border-radius: 0;
    background: transparent;
    opacity: 1;
}

.mw-cis-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    background: hsl(var(--mw-cis-hue, 263) 55% 45%);
    color: hsl(0 0% 100%);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.mw-cis-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mw-cis-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--mw-cis-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mw-cis-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--mw-cis-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Host-supplied subtitle chips (e.g. "Act" / "Kontakt" in the artist office) */
.mw-cis-chip {
    flex-shrink: 0;
    padding: 1px 7px;
    border: 1px solid var(--mw-cis-accent-line);
    border-radius: 999px;
    background: var(--mw-cis-accent-tint);
    color: var(--mw-cis-accent-soft);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mw-cis-chip--contact {
    border-color: color-mix(in srgb, var(--mw-cis-blue) 30%, transparent);
    background: color-mix(in srgb, var(--mw-cis-blue) 10%, transparent);
    color: var(--mw-cis-blue);
}

/* ── Per-row handout indicators — the handout type's color, spent as a dot ── */
.mw-cis-row-handouts {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.mw-cis-hdot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--mw-cis-border-strong);
    color: var(--mw-cis-text-faint);
    opacity: 0.55;
}

.mw-cis-hdot .mw-cis-mi {
    font-size: 13px;
}

.mw-cis-hdot--given {
    opacity: 1;
    border-color: color-mix(in srgb, var(--mw-cis-hcolor, var(--mw-cis-green)) 35%, transparent);
    background: color-mix(in srgb, var(--mw-cis-hcolor, var(--mw-cis-green)) 12%, transparent);
    color: var(--mw-cis-hcolor, var(--mw-cis-green));
}

/* ── Check-in state pill (tap = toggle check-in); time in mono ── */
.mw-cis-state-anchor {
    margin-left: auto;
    flex-shrink: 0;
}

.mw-cis-state {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--mw-cis-border-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--mw-cis-text-dim);
    font-family: var(--mw-cis-font-mono);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.mw-cis-state:hover {
    border-color: var(--mw-cis-accent-line);
    color: var(--mw-cis-text);
}

.mw-cis-state .mw-cis-mi {
    font-size: 13px;
}

.mw-cis-state--in {
    border-color: transparent;
    background: var(--mw-cis-green-dim);
    color: var(--mw-cis-green);
}

/* Gate mode: "QR shown, waiting for the provider's check-in confirmation" countdown */
.mw-cis-state--pending {
    border-color: transparent;
    background: var(--mw-cis-amber-dim);
    color: var(--mw-cis-amber);
    animation: mw-cis-pending-pulse 2s ease-in-out infinite;
}

@keyframes mw-cis-pending-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* ── Expanded detail ── */
.mw-cis-detail {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--mw-cis-border);
}

.mw-cis-handouts {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mw-cis-handout {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mw-cis-handout-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: var(--mw-cis-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mw-cis-handout-label .mw-cis-mi {
    font-size: 15px;
    color: var(--mw-cis-hcolor, var(--mw-cis-text-dim));
}

.mw-cis-handout-owed {
    flex-shrink: 0;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px dashed var(--mw-cis-border-strong);
    color: var(--mw-cis-text-dim);
    font-family: var(--mw-cis-font-mono);
    font-size: 9.5px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mw-cis-handout-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    padding: 5px 12px;
    border: 1px solid var(--mw-cis-border-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--mw-cis-text-dim);
    font-family: var(--mw-cis-font-body);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.mw-cis-handout-toggle:hover:not(:disabled) {
    border-color: var(--mw-cis-accent-line);
    color: var(--mw-cis-text);
}

.mw-cis-handout-toggle:disabled {
    opacity: 0.45;
    cursor: default;
}

.mw-cis-handout-toggle--given {
    border-color: color-mix(in srgb, var(--mw-cis-hcolor, var(--mw-cis-green)) 35%, transparent);
    background: color-mix(in srgb, var(--mw-cis-hcolor, var(--mw-cis-green)) 12%, transparent);
    color: var(--mw-cis-hcolor, var(--mw-cis-green));
}

.mw-cis-handout-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.mw-cis-handout-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--mw-cis-border-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--mw-cis-text-dim);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.mw-cis-handout-step:hover:not(:disabled) {
    border-color: var(--mw-cis-accent-line);
    color: var(--mw-cis-text);
}

.mw-cis-handout-step:disabled {
    opacity: 0.35;
    cursor: default;
}

.mw-cis-handout-count {
    min-width: 18px;
    text-align: center;
    font-family: var(--mw-cis-font-mono);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--mw-cis-text);
}

/* ── Ticket QR ── */
.mw-cis-tickets {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mw-cis-ticket-none {
    font-size: 11.5px;
    color: var(--mw-cis-text-faint);
}

.mw-cis-ticket {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mw-cis-ticket-img {
    width: 96px;
    max-width: 40%;
    border-radius: var(--mw-cis-radius-sm);
    border: 1px solid var(--mw-cis-border-strong);
    cursor: zoom-in;
    flex-shrink: 0;
}

.mw-cis-ticket-loading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 96px;
    height: 60px;
    justify-content: center;
    border: 1px dashed var(--mw-cis-border-strong);
    border-radius: var(--mw-cis-radius-sm);
    color: var(--mw-cis-text-faint);
    font-size: 10px;
    flex-shrink: 0;
}

.mw-cis-ticket-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.mw-cis-ticket-type {
    font-size: 12px;
    font-weight: 600;
    color: var(--mw-cis-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mw-cis-ticket-redeemed {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--mw-cis-font-mono);
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
    color: var(--mw-cis-green);
}

.mw-cis-ticket-redeemed .mw-cis-mi {
    font-size: 13px;
}

/* ── Entrance-gate fullscreen QR overlay — the bare ticket QR for the provider scanner,
   with the scan → chip-bind instructions. ── */
.mw-cis-qr-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: hsla(240 15% 3% / 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.mw-cis-qr-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(420px, 100%);
    max-height: 100%;
    overflow-y: auto;
    padding: 16px;
    background: var(--mw-cis-surface-elev, hsl(240 11% 11.5%));
    border: 1px solid hsla(0 0% 100% / 0.10);
    border-radius: 14px;
    border-top-left-radius: 4px;
    box-shadow: 0 28px 70px -20px hsla(0 0% 0% / 0.9);
    color: hsl(0 0% 96%);
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
}

.mw-cis-qr-name {
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

.mw-cis-qr-img {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    border-radius: 8px;
    background: hsl(0 0% 100%);
}

.mw-cis-qr-missing,
.mw-cis-qr-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;
    border: 1px dashed hsla(0 0% 100% / 0.10);
    border-radius: 8px;
    color: hsl(240 5% 40%);
    font-size: 12px;
}

.mw-cis-qr-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mw-cis-qr-step {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 12.5px;
    line-height: 1.45;
    color: hsl(240 5% 75%);
}

.mw-cis-qr-step-nr {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 50%;
    background: hsla(263 90% 67% / 0.14);
    color: hsl(263 70% 79%);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    font-weight: 700;
}

.mw-cis-qr-hint {
    font-size: 11px;
    line-height: 1.5;
    color: hsl(240 5% 50%);
}

.mw-cis-qr-close {
    padding: 10px 0;
    border: none;
    border-radius: 999px;
    background: hsl(263 90% 67%);
    color: hsl(0 0% 100%);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.mw-cis-qr-close:hover {
    background: hsl(263 90% 72%);
}

/* ── Page host (CheckInStationPage) — same near-black ops canvas as the Volunteer Care page ── */
.mw-cis-page {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 48px);
    max-height: calc(100dvh - 48px);
    box-sizing: border-box;
    overflow: hidden;
    padding: 12px;
    background: #07070a;
    color: var(--mw-cis-text);
    font-family: var(--mw-cis-font-body);
    -webkit-font-smoothing: antialiased;
}

.mw-cis-page *,
.mw-cis-page *::before,
.mw-cis-page *::after { box-sizing: border-box; }

.mw-cis-page-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 2px 4px 10px;
    flex-shrink: 0;
}

.mw-cis-page-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* The frame card holding the station (mw-vc-frame recipe) */
.mw-cis-page-frame {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 10px;
    background: var(--mw-cis-surface);
    border: 1px solid var(--mw-cis-border);
    border-radius: var(--mw-cis-radius);
    overflow: hidden;
    box-shadow:
        0 1px 0 hsla(0 0% 100% / 0.02) inset,
        0 18px 40px -24px hsla(0 0% 0% / 0.8);
}

/* ── Mobile (below 960px) ── */
@media (max-width: 959.98px) {
    .mw-cis-page { padding: 8px; }

    .mw-cis-page-header { margin: 2px 2px 8px; }

    .mw-cis-page-frame { padding: 8px; }
}
