.attendance-portal {
    padding: clamp(18px, 3vw, 30px);
    margin-bottom: 24px;
    border: 1px solid #dfe7f2;
    border-radius: 24px;
    background: #fff;
    color: #172033;
    min-width: 0;
    max-width: 100%;
    scroll-margin-top: 24px;
}

.attendance-portal [hidden] { display: none !important; }
.attendance-portal h2 { margin: 4px 0 10px; font-size: clamp(23px, 3vw, 30px); color: #061e45; }
.attendance-portal h3 { margin: 0 0 8px; color: #061e45; font-size: 20px; }
.attendance-portal p { margin: 0; line-height: 1.6; }
.attendance-kicker { color: #8e6617; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.attendance-heading, .attendance-toolbar, .attendance-roster-heading, .attendance-code-form { display: flex; gap: 18px; align-items: end; justify-content: space-between; }
.attendance-heading { align-items: start; }
.attendance-heading > div { min-width: 0; max-width: 800px; }
.attendance-heading p, .attendance-scanner > p, .attendance-roster-heading p { color: #667085; }
.attendance-toolbar { margin-top: 24px; }
.attendance-field { display: grid; gap: 8px; flex: 1; min-width: 0; font-size: 14px; font-weight: 750; }
.attendance-field input, .attendance-field select { width: 100%; min-width: 0; max-width: 100%; border: 1px solid #cbd5e1; border-radius: 12px; background: #fff; padding: 12px; color: #172033; font: inherit; font-weight: 450; }
.attendance-field input:focus-visible, .attendance-field select:focus-visible, .attendance-button:focus-visible, .attendance-qr-download:focus-visible, .attendance-image-label:focus-within { outline: 3px solid #8db4f0; outline-offset: 3px; }
.attendance-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 12px 18px; border: 1px solid #0b3d91; border-radius: 12px; background: #0b3d91; color: #fff; font: inherit; font-size: 14px; font-weight: 750; cursor: pointer; text-align: center; }
.attendance-button:disabled, .attendance-qr-download:disabled { cursor: wait; opacity: .55; }
.attendance-secondary { color: #0b3d91; background: #eef4ff; border-color: #d4e2f8; }
.attendance-image-label { position: relative; overflow: hidden; }
.attendance-image-label input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.attendance-message { padding: 14px 16px; margin-top: 18px !important; border-radius: 12px; background: #eef4ff; color: #164477; overflow-wrap: anywhere; }
.attendance-message[data-kind="error"] { background: #fef2f2; color: #991b1b; }
.attendance-message[data-kind="success"] { background: #ecfdf3; color: #166534; }
.attendance-workspace { display: grid; gap: 24px; margin-top: 22px; }
.attendance-scanner { padding: 20px; border: 1px solid #dfe7f2; border-radius: 16px; background: #f8fafc; min-width: 0; }
.attendance-scan-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.attendance-code-form { align-items: end; }
.attendance-camera { max-width: 600px; margin: 0 auto 20px; border-radius: 14px; overflow: hidden; background: #061e45; color: white; text-align: center; }
.attendance-camera video { display: block; width: 100%; max-height: 360px; object-fit: contain; }
.attendance-camera p { padding: 10px 14px; font-size: 13px; }
.attendance-roster { min-width: 0; }
.attendance-roster-heading { align-items: center; }
.attendance-roster-heading .attendance-field { flex: 0 1 320px; }
.attendance-help { margin: 14px 0 !important; color: #667085; font-size: 13px; }
.attendance-table-wrap { overflow-x: auto; width: 100%; border: 1px solid #dfe7f2; border-radius: 14px; }
.attendance-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 14px; text-align: left; }
.attendance-table th, .attendance-table td { padding: 15px 13px; border-bottom: 1px solid #e7edf5; max-width: 240px; overflow-wrap: anywhere; }
.attendance-table th { background: #f3f6fb; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.attendance-table tr:last-child td { border-bottom: 0; }
.attendance-badge { display: inline-block; padding: 5px 9px; border-radius: 99px; white-space: nowrap; font-size: 12px; font-weight: 750; }
.attendance-present { background: #dcfce7; color: #166534; }
.attendance-absent { background: #f1f5f9; color: #475569; }
.attendance-qr-download { color: #0b3d91; background: #eef4ff; border: 1px solid #d4e2f8; border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.attendance-muted { color: #667085; font-size: 12px; }
.attendance-empty { text-align: center; color: #667085; padding: 28px !important; }
.attendance-open-button { margin-top: 12px; }

@media (max-width: 720px) {
    .attendance-heading, .attendance-toolbar, .attendance-roster-heading, .attendance-code-form { flex-direction: column; align-items: stretch; }
    .attendance-heading > button { align-self: start; }
    .attendance-roster-heading .attendance-field { flex: auto; }
    .attendance-scanner { padding: 14px; }
    .attendance-scan-actions .attendance-button { flex: 1 1 150px; }
    .attendance-portal .attendance-button { max-width: 100%; }
}
