.attendance-kiosk-layout {
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(160deg, #f0f9ff 0%, #e0f2fe 45%, #f8fafc 100%);
}

.attendance-kiosk {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Reserve space for fixed side panels so scan text sits in the true middle gap. */
    padding: 2rem calc(1rem + min(34rem, 46vw - 1rem) + 1rem) 4rem calc(1rem + min(18rem, 32vw - 1rem) + 1rem);
    text-align: center;
    position: relative;
    transition: background-color 0.25s ease;
    box-sizing: border-box;
}

/* Scan messaging — centered in the padded middle column (not under the history panels). */
.attendance-kiosk__stage {
    position: relative;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 36rem;
    margin: 0 auto;
    text-align: center;
    pointer-events: none;
}

.attendance-kiosk-scan-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.attendance-kiosk__icon {
    font-size: clamp(3.5rem, 12vw, 5.5rem);
    line-height: 1;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.attendance-kiosk__icon--success {
    animation: attendance-kiosk-icon-pop 0.55s ease-out;
}

.attendance-kiosk__title {
    font-size: clamp(1.75rem, 5vw, 2.75rem);
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.35rem;
    position: relative;
    z-index: 1;
}

.attendance-kiosk__subtitle {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--app-text-muted, #1e293b);
    margin-bottom: 0;
    max-width: 28rem;
}

.attendance-kiosk__student {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 700;
    color: #0f172a;
    margin-top: 0.5rem;
    position: relative;
    z-index: 1;
}

.attendance-kiosk__detail {
    font-size: clamp(1rem, 2.5vw, 1.15rem);
    color: var(--app-text-muted, #1e293b);
    margin-top: 0.35rem;
    position: relative;
    z-index: 1;
}

.attendance-kiosk__clock {
    font-size: 0.95rem;
    color: var(--app-text-muted-soft, #334155);
    margin-top: 1.5rem;
    position: relative;
    z-index: 1;
}

.attendance-kiosk__success-burst {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.attendance-kiosk__success-burst::before,
.attendance-kiosk__success-burst::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 45%;
    width: min(22rem, 90%);
    height: min(22rem, 90%);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.35);
    opacity: 0;
    animation: attendance-kiosk-burst 1.1s ease-out;
}

.attendance-kiosk--check-in .attendance-kiosk__success-burst::before {
    background: radial-gradient(circle, rgba(34, 197, 94, 0.45) 0%, rgba(34, 197, 94, 0) 70%);
}

.attendance-kiosk--check-in .attendance-kiosk__success-burst::after {
    background: radial-gradient(circle, rgba(134, 239, 172, 0.35) 0%, rgba(134, 239, 172, 0) 68%);
    animation-delay: 0.12s;
}

.attendance-kiosk--check-out .attendance-kiosk__success-burst::before {
    background: radial-gradient(circle, rgba(37, 99, 235, 0.4) 0%, rgba(37, 99, 235, 0) 70%);
}

.attendance-kiosk--check-out .attendance-kiosk__success-burst::after {
    background: radial-gradient(circle, rgba(147, 197, 253, 0.35) 0%, rgba(147, 197, 253, 0) 68%);
    animation-delay: 0.12s;
}

.attendance-kiosk--ready .attendance-kiosk__icon {
    color: #0284c7;
}

.attendance-kiosk--processing .attendance-kiosk__icon {
    color: #0284c7;
}

.attendance-kiosk--check-in {
    background: linear-gradient(160deg, #dcfce7 0%, #bbf7d0 40%, #f0fdf4 100%);
    animation: attendance-kiosk-flash-in 0.9s ease-out;
}

.attendance-kiosk--check-in .attendance-kiosk__icon {
    color: #16a34a;
}

.attendance-kiosk--check-out {
    background: linear-gradient(160deg, #dbeafe 0%, #bfdbfe 40%, #eff6ff 100%);
    animation: attendance-kiosk-flash-out 0.9s ease-out;
}

.attendance-kiosk--check-out .attendance-kiosk__icon {
    color: #2563eb;
}

.attendance-kiosk--info .attendance-kiosk__icon {
    color: #d97706;
}

.attendance-kiosk--error .attendance-kiosk__icon {
    color: #dc2626;
}

.attendance-kiosk__spinner {
    width: 4rem;
    height: 4rem;
    border-width: 0.35rem;
}

.attendance-kiosk__back-btn {
    position: fixed;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0.45rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.85);
    color: #334155;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    backdrop-filter: blur(6px);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.attendance-kiosk__back-btn:hover {
    color: #0f172a;
    background: #fff;
    border-color: rgba(100, 116, 139, 0.55);
}

.attendance-kiosk__back-btn:focus-visible {
    outline: 2px solid #0284c7;
    outline-offset: 2px;
}

.attendance-kiosk__back-btn .bi {
    font-size: 0.95rem;
}

.attendance-kiosk__staff-link {
    position: fixed;
    bottom: 0.75rem;
    right: 0.75rem;
    font-size: 0.75rem;
    color: var(--app-text-muted-soft, #334155);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    z-index: 2;
}

.attendance-kiosk__staff-link:hover {
    color: var(--app-text-muted, #1e293b);
    background: rgba(255, 255, 255, 0.6);
}

.attendance-kiosk-history {
    position: fixed;
    top: 10vh;
    height: 80vh;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    text-align: left;
    padding: 0.85rem 0.9rem;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.65rem;
    backdrop-filter: blur(6px);
    z-index: 1;
    pointer-events: none;
}

.attendance-kiosk-history--staff {
    left: 1rem;
    right: auto;
    width: min(18rem, calc(32vw - 1rem));
}

.attendance-kiosk-history--students {
    right: 1rem;
    left: auto;
    width: min(34rem, calc(46vw - 1rem));
}

.attendance-kiosk-history__title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--app-text-muted, #1e293b);
    margin: 0 0 0.35rem;
}

.attendance-kiosk-history__summary {
    font-size: 0.8rem;
    color: var(--app-text-muted, #1e293b);
    margin: 0 0 0.55rem;
    line-height: 1.3;
}

.attendance-kiosk-history__summary-count {
    font-weight: 700;
    color: #0f172a;
}

.attendance-kiosk-history__summary-sep {
    margin: 0 0.15rem;
    color: var(--app-text-muted-soft, #334155);
}

.attendance-kiosk-history__sections {
    display: grid;
    align-items: stretch;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
}

.attendance-kiosk-history--staff .attendance-kiosk-history__sections {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
}

.attendance-kiosk-history--students .attendance-kiosk-history__sections {
    grid-template-columns: 1fr 1fr;
}

.attendance-kiosk-history__section {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    padding: 0.4rem 0.4rem 0.45rem;
    border-radius: 0.5rem;
    background: rgba(248, 250, 252, 0.75);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.attendance-kiosk-history__section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--app-text-muted, #1e293b);
    margin: 0 0 0.35rem;
}

.attendance-kiosk-history__empty {
    font-size: 0.85rem;
    color: var(--app-text-muted-soft, #334155);
    margin: 0;
}

.attendance-kiosk-history__list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-height: 0;
    pointer-events: auto;
}

.attendance-kiosk-history__row {
    padding: 0.4rem 0.45rem;
    border-radius: 0.45rem;
    border: 1px solid transparent;
}

.attendance-kiosk-history__row--checked-in {
    background: #ecfdf5;
    border-color: rgba(34, 197, 94, 0.22);
}

.attendance-kiosk-history__row--checked-out {
    background: #eff6ff;
    border-color: rgba(37, 99, 235, 0.22);
}

.attendance-kiosk-history__row--latest-in {
    background: #fed7aa;
    border-color: rgba(234, 88, 12, 0.5);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.25);
    animation: attendance-kiosk-row-pulse-latest-in 1.2s ease-out;
}

.attendance-kiosk-history__row--latest-out {
    background: #c4b5fd;
    border-color: rgba(109, 40, 217, 0.45);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.28);
    animation: attendance-kiosk-row-pulse-latest-out 1.2s ease-out;
}

.attendance-kiosk-history__name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.attendance-kiosk-history__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attendance-kiosk-history__badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.12rem 0.4rem;
    border-radius: 0.25rem;
}

.attendance-kiosk-history__badge--student {
    color: #0369a1;
    background: #e0f2fe;
}

.attendance-kiosk-history__badge--staff {
    color: #5b21b6;
    background: #ede9fe;
}

.attendance-kiosk-history__times {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    color: var(--app-text-muted, #1e293b);
}

.attendance-kiosk-history__out {
    color: #2563eb;
    font-weight: 600;
}

@keyframes attendance-kiosk-flash-in {
    0% { background-color: #86efac; }
    100% { background-color: transparent; }
}

@keyframes attendance-kiosk-flash-out {
    0% { background-color: #93c5fd; }
    100% { background-color: transparent; }
}

@keyframes attendance-kiosk-burst {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.25);
    }
    70% {
        opacity: 0.45;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.35);
    }
}

@keyframes attendance-kiosk-icon-pop {
    0% { transform: scale(0.7); opacity: 0.4; }
    55% { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes attendance-kiosk-row-pulse-latest-in {
    0% { background: #fb923c; }
    100% { background: #fed7aa; }
}

@keyframes attendance-kiosk-row-pulse-latest-out {
    0% { background: #a78bfa; }
    100% { background: #c4b5fd; }
}

@media (max-width: 900px) {
    .attendance-kiosk {
        padding: 2rem 1rem calc(2.75rem + min(42vh, 18rem) + 1rem);
    }

    .attendance-kiosk-history {
        top: auto;
        bottom: 2.75rem;
        height: min(42vh, 18rem);
        max-height: min(42vh, 18rem);
        pointer-events: auto;
    }

    .attendance-kiosk-history--staff {
        left: 0.75rem;
        right: auto;
        width: calc(38% - 0.85rem);
    }

    .attendance-kiosk-history--students {
        right: 0.75rem;
        left: auto;
        width: calc(62% - 0.85rem);
    }
}
