/* portal.css — 통합 로그인 · 공장 선택 화면 스타일
   ────────────────────────────────────────────────────────────────
   기존 두 공장의 common_header.css 와 같은 결로 맞췄습니다.
     배경 #f5f5f7 · 흰 카드 radius 14px · 글자 #1d1d1f · 강조 #007AFF
   다만 body { zoom: 115% } 는 쓰지 않습니다 — 로그인·선택 화면은
   현장 휴대폰에서도 열리므로 zoom 대신 실제 글자 크기로 키웠습니다.
   ──────────────────────────────────────────────────────────────── */

* , *:before, *:after { box-sizing: border-box; }

body {
    margin: 0;
    padding: 24px 16px;
    min-height: 100vh;
    background-color: #f5f5f7;
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ── 로그인 ─────────────────────────────────────────────────── */

.mkp-login-stage {
    /* 화면 한가운데. 모바일 키보드가 올라올 때 카드가 잘리지 않게
       고정 높이 대신 min-height 로 둡니다. */
    min-height: calc(100vh - 48px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mkp-login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    padding: 44px 32px 32px;
}

/* 로고만 두는 자리. 제목·부제 텍스트는 두지 않습니다. */
.mkp-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 36px;
}
/* assets/logo_mark.png 은 원본 logo.png 의 여백(63%)을 잘라낸 것입니다.
   원본을 그대로 쓰면 240px 로 키워도 M 이 89px 로만 보입니다.
   배경은 투명이라 카드 색이 그대로 비칩니다.
   파일이 없으면 .mkp-logo-fallback 아이콘이 대신 나옵니다. */
.mkp-logo {
    display: block;
    width: 100%;
    max-width: 200px;
    height: auto;
}
.mkp-brand .mkp-logo-fallback {
    display: none;         /* 로고 파일이 없을 때만 JS 가 켭니다 */
    font-size: 76px;
    color: #007AFF;
}

/* 화면에서만 감추는 라벨 (스크린리더·비밀번호 관리자는 계속 읽습니다) */
.mkp-sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.mkp-field { margin-bottom: 12px; }
.mkp-field input {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    font-size: 16px;   /* iOS 는 16px 미만이면 입력 시 화면을 확대합니다 */
    font-family: inherit;
    text-align: center;
    letter-spacing: 1px;
    color: #1d1d1f;
    background: #f5f5f7;
    border: 1px solid #e5e5ea;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s, background-color 0.15s;
}
.mkp-field input::placeholder {
    color: #a1a1a6;
    letter-spacing: 0;
}
.mkp-field input:focus {
    background: #fff;
    border-color: #007AFF;
}

.mkp-submit {
    width: 100%;
    height: 48px;
    margin-top: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: #007AFF;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s;
}
.mkp-submit:hover:not(:disabled) { background: #0056b3; }
.mkp-submit:disabled { background: #b0b0b5; cursor: default; }

/* 오류 문구는 자리를 미리 잡아 두지 않습니다 —
   비어 있을 때 카드에 빈 줄이 생기면 균형이 어색해집니다. */
.mkp-error {
    display: none;
    margin-top: 14px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #b3261e;
    background: #fdecea;
    border-radius: 8px;
}
.mkp-error.show { display: block; }

/* ── 공장 선택 ──────────────────────────────────────────────── */

.mkp-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mkp-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #fff;
    padding: 14px 20px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.mkp-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.mkp-topbar-logo {
    height: 26px;
    width: auto;
    flex-shrink: 0;
}
.mkp-topbar-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.mkp-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mkp-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: #007AFF;
    background: #eaf3ff;
    border-radius: 15px;
}
.mkp-role-badge.readonly { color: #6e6e73; background: #ececf0; }

.mkp-signout {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: #1d1d1f;
    background: #f5f5f7;
    border: 1px solid #e5e5ea;
    border-radius: 8px;
    cursor: pointer;
}
.mkp-signout:hover { background: #ececf0; }

/* 카드 두 장. 휴대폰에서는 세로로 쌓입니다. */
.mkp-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.mkp-choice {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    padding: 28px 24px;
    /* 현장에서 휴대폰·태블릿으로 누르므로 손가락에 넉넉한 크기로 둡니다. */
    min-height: 190px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.mkp-choice:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    border-color: #d6e6ff;
}
.mkp-choice:active { transform: translateY(0); }

.mkp-choice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #eaf3ff;
}
.mkp-choice-icon .material-symbols-outlined {
    font-size: 28px;
    color: #007AFF;
}
.mkp-choice-name {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.mkp-choice-desc {
    font-size: 13px;
    line-height: 1.6;
    color: #86868b;
}
.mkp-choice-go {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #007AFF;
}
.mkp-choice-go .material-symbols-outlined { font-size: 18px; }

/* 세션을 확인하는 동안 화면을 비워 둡니다 —
   로그인 안 된 사람에게 선택 화면이 한 번 번쩍이지 않게 합니다. */
.mkp-gate-hidden { visibility: hidden; }
