:root {
    --app-bg: #eef3f8;
    --app-surface: #ffffff;
    --app-border: #d7dfeb;
    --app-text: #162033;
    --app-muted: #64748b;
    --app-primary: #0f5ec7;
    --app-success: #11845b;
    --app-warning: #c77b00;
    --app-danger: #cb3a3a;
    --app-shadow: 0 20px 40px rgba(22, 32, 51, 0.08);
    --app-radius: 22px;
}

body {
    color: var(--app-text);
}

.app-body,
.login-body,
.guard-body,
.card-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(15, 94, 199, 0.14), transparent 32%),
        radial-gradient(circle at top right, rgba(17, 132, 91, 0.12), transparent 28%),
        var(--app-bg);
}

.app-navbar {
    background: linear-gradient(135deg, #132a4d, #173c68);
    box-shadow: 0 12px 24px rgba(22, 32, 51, 0.18);
}

.login-shell,
.guard-shell {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
}

.login-card {
    max-width: 460px;
    border-radius: 28px;
}

.metric-card {
    background: #f4f7fb;
    border: 1px solid var(--app-border);
    border-radius: 18px;
    padding: 14px 16px;
    height: 100%;
}

.metric-label {
    color: var(--app-muted);
    font-size: 0.84rem;
    margin-bottom: 6px;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.table-avatar,
.student-photo-preview {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--app-border);
}

.student-photo-preview {
    width: 120px;
    height: 120px;
}

.avatar-placeholder {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #eff3f9;
    color: var(--app-muted);
    font-size: 0.72rem;
    border: 1px dashed var(--app-border);
}

.guard-panel {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(215, 223, 235, 0.8);
    border-radius: 30px;
    box-shadow: var(--app-shadow);
    padding: 28px;
}

.guard-kicker {
    margin: 0 0 6px;
    color: var(--app-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.77rem;
    font-weight: 700;
}

.guard-header h1 {
    font-size: clamp(2rem, 4vw, 3.1rem);
    margin-bottom: 10px;
    line-height: 1.06;
}

.guard-period {
    font-size: 1.05rem;
    color: var(--app-success);
    font-weight: 600;
}

.guard-period.is-outside {
    color: var(--app-danger);
}

.guard-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 20px 0 16px;
}

.btn-guard {
    min-height: 80px;
    border-radius: 22px;
    font-size: 1.4rem;
    font-weight: 700;
    border: 0;
    color: #fff;
    box-shadow: 0 18px 32px rgba(22, 32, 51, 0.14);
}

.btn-check-in {
    background: linear-gradient(135deg, #11845b, #20a86d);
}

.btn-check-out {
    background: linear-gradient(135deg, #d36a24, #ef8d33);
}

.btn-guard.active {
    outline: 4px solid rgba(15, 94, 199, 0.22);
    transform: translateY(-1px);
}

.scanner-wrapper {
    border: 1px solid var(--app-border);
    border-radius: 24px;
    background: #f7f9fc;
    padding: 14px;
}

.mode-indicator {
    color: var(--app-muted);
    margin-bottom: 12px;
    font-weight: 600;
}

.scanner-surface {
    min-height: 250px;
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(135deg, #132a4d, #173c68);
}

.scan-result-card {
    margin: 0 0 14px;
    border-radius: 24px;
    padding: 16px;
    border: 1px solid transparent;
}

.scan-result-card.status-success {
    background: #e7f8f0;
    border-color: #b7ead0;
}

.scan-result-card.status-duplicate {
    background: #fff4d8;
    border-color: #f0d58d;
}

.scan-result-card.status-error,
.scan-result-card.status-rejected {
    background: #fdeaea;
    border-color: #efb7b7;
}

.scan-result-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.scan-result-status {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.scan-result-photo {
    width: 84px;
    height: 84px;
    border-radius: 20px;
    object-fit: cover;
    border: 1px solid rgba(22, 32, 51, 0.1);
}

.scan-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0;
    color: var(--app-muted);
    font-weight: 600;
}

.qr-card {
    width: min(100%, 360px);
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 28px;
    padding: 24px;
    text-align: center;
    box-shadow: var(--app-shadow);
}

.card-brand {
    color: var(--app-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.76rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.qr-card-photo,
.qr-card-photo-placeholder {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 24px;
    background: #edf2f8;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
}

.qr-card h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.qr-card p {
    color: var(--app-muted);
    margin-bottom: 18px;
}

.qr-card-code {
    width: 180px;
    height: 180px;
}

.qr-card-token {
    margin-top: 12px;
    word-break: break-word;
    font-size: 0.78rem;
    color: var(--app-muted);
}

@media (max-width: 767.98px) {
    .guard-shell {
        width: calc(100% - 16px);
        padding: 6px 0 12px;
    }

    .guard-panel {
        padding: 14px;
        border-radius: 24px;
    }

    .guard-header h1 {
        font-size: 1.55rem;
        margin-bottom: 6px;
    }

    .guard-kicker {
        margin-bottom: 4px;
        font-size: 0.68rem;
    }

    .guard-period {
        font-size: 0.92rem;
    }

    .guard-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin: 14px 0 12px;
    }

    .btn-guard {
        min-height: 64px;
        font-size: 1rem;
        border-radius: 18px;
    }

    .scanner-wrapper {
        padding: 12px;
        border-radius: 20px;
    }

    .mode-indicator {
        margin-bottom: 8px;
        font-size: 0.92rem;
    }

    .scanner-surface {
        min-height: 210px;
        border-radius: 18px;
    }

    .scan-result-card {
        margin-bottom: 10px;
        padding: 14px;
        border-radius: 18px;
    }

    .scan-result-header {
        flex-direction: column;
        gap: 10px;
    }

    .scan-result-header h2 {
        font-size: 1.2rem;
        margin-bottom: 4px;
    }

    .scan-result-meta {
        gap: 8px;
        margin: 10px 0;
        font-size: 0.92rem;
    }

    .scan-result-photo {
        width: 68px;
        height: 68px;
        border-radius: 16px;
    }
}

@media (max-width: 767.98px) and (max-height: 760px) {
    .guard-mode-active .guard-header h1 {
        font-size: 1.35rem;
    }

    .guard-mode-active .btn-guard {
        min-height: 56px;
        font-size: 0.96rem;
    }

    .guard-mode-active .scanner-surface {
        min-height: 180px;
    }
}
