* {
    box-sizing: border-box;
}

:root {
    --bg: #f3f6fb;
    --panel: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #0f62fe;
    --primary-dark: #0043ce;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
    --radius: 22px;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
    background:
        radial-gradient(circle at top left, rgba(15, 98, 254, .18), transparent 32%),
        linear-gradient(135deg, #f7fbff, #eef2ff);
}

.login-shell {
    width: min(100%, 460px);
}

.login-card,
.content-card,
.action-card,
.hero-card,
.status-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.login-card {
    padding: 30px;
}

.login-brand,
.public-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.login-brand {
    margin-bottom: 26px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #38bdf8);
    color: #fff;
    font-weight: 900;
    letter-spacing: -.05em;
}

.brand-mark.large {
    width: 60px;
    height: 60px;
    border-radius: 21px;
}

.login-brand h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: -.04em;
}

.login-brand p,
.public-brand em {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    font-style: normal;
}

.public-brand strong {
    display: block;
    font-size: 17px;
    letter-spacing: -.04em;
}

.public-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 68px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.public-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 800;
}

.public-user a {
    padding: 8px 11px;
    border-radius: 999px;
    background: #eef2f7;
}

.public-main {
    width: min(100%, 840px);
    margin: 0 auto;
    padding: 20px 16px 60px;
}

.hero-card {
    padding: 24px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    background: linear-gradient(135deg, #0f172a, #1d4ed8);
    color: #fff;
}

.hero-card h1 {
    margin: 6px 0 0;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -.05em;
}

.eyebrow {
    margin: 0;
    color: rgba(255,255,255,.76);
    font-weight: 800;
    font-size: 13px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.status-card {
    padding: 18px;
}

.status-card.primary {
    background: linear-gradient(135deg, var(--primary), #38bdf8);
    color: #fff;
    border: 0;
}

.status-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.status-card.primary span {
    color: rgba(255,255,255,.82);
}

.status-card strong {
    display: block;
    margin-top: 8px;
    font-size: 20px;
    letter-spacing: -.04em;
}

.content-card,
.action-card {
    padding: 22px;
    margin-bottom: 16px;
}

.action-card {
    text-align: center;
}

.action-card h2,
.content-card h2 {
    margin: 0;
    font-size: 21px;
    letter-spacing: -.04em;
}

.action-card p,
.content-card p {
    color: var(--muted);
    line-height: 1.6;
}

.card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.card-head h2 {
    margin: 0;
}

.card-head p {
    margin: 6px 0 0;
    font-size: 14px;
}

.info-list {
    display: grid;
    gap: 10px;
}

.info-list div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.info-list span {
    color: var(--muted);
    font-weight: 800;
    min-width: 110px;
}

.info-list strong {
    text-align: right;
}

.form-grid {
    display: grid;
    gap: 15px;
}

label {
    display: grid;
    gap: 8px;
}

label span {
    font-weight: 800;
    font-size: 14px;
    color: #374151;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    padding: 13px 14px;
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(15,98,254,.55);
    box-shadow: 0 0 0 4px rgba(15,98,254,.12);
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fafc;
}

.check-row input {
    width: auto;
    margin-top: 3px;
}

.check-row span {
    line-height: 1.5;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 14px;
    padding: 13px 16px;
    font-weight: 900;
    min-height: 46px;
    cursor: pointer;
}

.btn.primary {
    background: var(--primary);
    color: #fff;
}

.btn.primary:hover {
    background: var(--primary-dark);
}

.btn.light {
    background: #eef2f7;
    color: #111827;
}

.btn.full {
    width: 100%;
}

.alert {
    padding: 13px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
    font-weight: 800;
}

.alert.danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.notice-box {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.notice-box p,
.muted {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.center {
    text-align: center;
}

.empty-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: #fff7ed;
    color: #c2410c;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
    font-weight: 900;
    font-size: 24px;
}

.contract-box {
    margin: 0;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #f8fafc;
    color: #111827;
    white-space: pre-wrap;
    word-break: keep-all;
    line-height: 1.7;
    font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

.badge {
    display: inline-flex;
    padding: 7px 10px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 12px;
    background: #eef2f7;
    color: #374151;
}

.badge.success {
    background: #ecfdf5;
    color: #047857;
}

.badge.warning {
    background: #fffbeb;
    color: #b45309;
}

@media (max-width: 720px) {
    .status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-card {
        display: grid;
    }

    .hero-card h1 {
        font-size: 25px;
    }

    .info-list div {
        display: grid;
    }

    .info-list strong {
        text-align: left;
    }

    .public-user span {
        display: none;
    }
}

@media (max-width: 420px) {
    .status-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 24px;
    }
}
/* 실시간 카메라 촬영 영역 */
.camera-box {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #f8fafc;
}

.camera-box h2 {
    margin: 0;
}

.camera-preview-wrap {
    width: 100%;
    overflow: hidden;
    border-radius: 18px;
    background: #0f172a;
    border: 1px solid #d1d5db;
}

.camera-preview-wrap video,
.camera-preview-wrap img {
    display: none;
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    background: #0f172a;
}

.camera-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

#capturePhotoBtn,
#retakePhotoBtn {
    display: none;
}

@media (max-width: 520px) {
    .camera-actions {
        grid-template-columns: 1fr;
    }
}
/* 카메라 전환 버튼 포함 시 4버튼 정렬 */
.camera-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

#switchCameraBtn,
#capturePhotoBtn,
#retakePhotoBtn {
    display: none;
}

@media (max-width: 720px) {
    .camera-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .camera-actions {
        grid-template-columns: 1fr;
    }
}
/* 카메라 좌우반전 강제 보정 제거 */
.camera-preview-wrap video,
.camera-preview-wrap img,
.camera-preview-wrap video.camera-front-fix,
.camera-preview-wrap img.camera-front-fix,
.camera-preview-wrap video.camera-back-normal,
.camera-preview-wrap img.camera-back-normal {
    transform: none !important;
}
/* 전면/안쪽 카메라 좌우 보정 최종 적용 */
.camera-preview-wrap video.camera-front-correct {
    transform: scaleX(-1) !important;
}

.camera-preview-wrap img.camera-front-correct,
.camera-preview-wrap video.camera-normal,
.camera-preview-wrap img.camera-normal {
    transform: none !important;
}
