h1:focus {
    outline: none;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "오류가 발생했습니다."
    }

/* ===== NPOS 운영자 셸 (매장 콘솔과 구분: 보라 액센트) ===== */
:root {
    --npos-bg: #f5f6f8;
    --npos-sidebar: #2b2540;
    --npos-sidebar-active: #7c3aed;
    --npos-border: #e2e5ea;
    --npos-text: #1f2733;
    --npos-muted: #6b7480;
    --npos-accent: #7c3aed;
    --npos-danger: #d64545;
    --npos-pos: #2d6cdf;
    --npos-neg: #d64545;
    --npos-svc: #1a9d63;
}

html, body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", "Malgun Gothic", Roboto, sans-serif;
    background: var(--npos-bg);
    color: var(--npos-text);
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--npos-sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
}

.sidebar .brand {
    padding: 1.1rem 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sidebar .brand span {
    font-weight: 400;
    opacity: 0.7;
    font-size: 0.9rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
}

.nav-menu .nav-item {
    padding: 0.7rem 1.25rem;
    color: #c7ced9;
    text-decoration: none;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
}

.nav-menu .nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.nav-menu .nav-item.active {
    background: rgba(124, 58, 237, 0.22);
    border-left-color: var(--npos-sidebar-active);
    color: #fff;
    font-weight: 600;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--npos-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 0 1.5rem;
}

.topbar .store-name {
    font-weight: 600;
}

.logout-form {
    margin: 0;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--npos-border);
    border-radius: 6px;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    color: var(--npos-muted);
    font-size: 0.9rem;
}

.logout-btn:hover {
    border-color: var(--npos-danger);
    color: var(--npos-danger);
}

.content {
    padding: 1.75rem 2rem;
}

.content h1 {
    margin: 0 0 1.25rem;
    font-size: 1.5rem;
}

.hint {
    color: var(--npos-muted);
    font-size: 0.95rem;
}

.alert {
    background: #fdecec;
    border: 1px solid #f5c2c2;
    color: var(--npos-danger);
    border-radius: 8px;
    padding: 0.85rem 1rem;
}

.section {
    margin-bottom: 1.75rem;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.section-head h2,
.content h2 {
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
}

.muted {
    color: var(--npos-muted);
    font-size: 0.9rem;
    font-weight: 400;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.card {
    background: #fff;
    border: 1px solid var(--npos-border);
    border-radius: 10px;
    padding: 1rem 1.15rem;
}

.card-label {
    color: var(--npos-muted);
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.card-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.info-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    background: #fff;
    border: 1px solid var(--npos-border);
    border-radius: 10px;
    padding: 0.85rem 1.15rem;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.ok { background: #e3f5ec; color: #157a4a; }
.badge.stop { background: #fbe7e7; color: var(--npos-danger); }

/* ===== 로그인 ===== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--npos-bg);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border: 1px solid var(--npos-border);
    border-radius: 12px;
    padding: 2rem 1.75rem;
    box-shadow: 0 8px 30px rgba(31, 39, 51, 0.08);
    display: flex;
    flex-direction: column;
}

.login-brand {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
}

.login-brand span {
    font-weight: 400;
    opacity: 0.6;
    font-size: 1rem;
}

.login-sub {
    text-align: center;
    color: var(--npos-muted);
    font-size: 0.9rem;
    margin: 0.25rem 0 1.25rem;
}

.login-card label {
    font-size: 0.85rem;
    color: var(--npos-muted);
    margin-bottom: 0.3rem;
}

.login-card input {
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--npos-border);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.login-card input:focus {
    outline: none;
    border-color: var(--npos-accent);
}

.login-card button {
    background: var(--npos-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.7rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.25rem;
}

.login-card button:hover {
    background: #6d31d0;
}

.login-error {
    background: #fdecec;
    border: 1px solid #f5c2c2;
    color: var(--npos-danger);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.text-danger {
    color: var(--npos-danger);
}

/* 성공 알림(비밀번호 변경 완료 등). 관리자 웹 .login-ok와 동일 값 — 두 콘솔의 상태색 규약을 갈라놓지 않는다. */
.login-ok {
    background: #e3f5ec;
    border: 1px solid #b6e2ca;
    color: #157a4a;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* 폼(비밀번호 변경 등). 관리자 웹 .form-grid/.form-actions 미러 — 단 액센트는 운영자 보라(var)를 따른다.
   auto-fit minmax라 좁은 화면에서 자동으로 1열이 되므로 별도 반응형 규칙이 필요 없다. */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem 1.1rem;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--npos-muted);
}

.form-grid input {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--npos-border);
    border-radius: 6px;
    font-size: 0.95rem;
    color: var(--npos-text);
    min-width: 0;
}

.form-grid input:focus {
    outline: none;
    border-color: var(--npos-accent);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.1rem;
}

.form-actions button {
    background: var(--npos-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.55rem 1.1rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.form-actions button:hover {
    background: #6d31d0;
}

/* ===== 반응형(모바일) =====
   데스크톱 레이아웃은 그대로 두고, 좁은 화면(≤768px)에만 규칙을 얹는다.
   핵심 변경은 고정 사이드바를 오프캔버스 드로어로 전환하는 것. 카드 그리드(auto-fill)와
   요약줄(flex-wrap)은 이미 자동으로 세로 재배치되지만, 매장 콘솔과 달리 기간연장 화면의
   필터 행·신청 표는 스스로 접히지 않으므로(각각 flex-wrap·nowrap 부재) 여기서 함께 보정한다.
   로그인은 BlankLayout이라 셸 규칙과 무관하고, .login-card가 max-width라 이미 좁은 화면에 맞는다. */
.nav-toggle { display: none; }
.nav-overlay { display: none; }

@media (max-width: 768px) {
    /* 사이드바 → 오프캔버스 드로어 */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 60;
        width: 78vw;
        max-width: 300px;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 2px 0 14px rgba(0, 0, 0, 0.25);
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    /* 드로어는 뷰포트 높이에 갇히므로, 항목이 늘거나 글꼴이 커지면 하단이 잘린다 */
    .nav-menu {
        overflow-y: auto;
    }

    /* 드로어 뒤 어둡게(탭하면 닫힘) */
    .nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 50;
        background: rgba(0, 0, 0, 0.42);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
    }

    body.nav-open .nav-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    /* 상단바 햄버거(왼쪽 정렬, 나머지는 오른쪽 유지) */
    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: auto;
        width: 40px;
        height: 40px;
        background: transparent;
        border: 1px solid var(--npos-border);
        border-radius: 8px;
        cursor: pointer;
        font-size: 1.2rem;
        line-height: 1;
        color: var(--npos-text);
    }

    .topbar {
        padding: 0 0.9rem;
        gap: 0.5rem;
    }

    /* 상단바는 height 고정이라 계정명이 줄바꿈되면 삐져나온다. 긴 ID는 상단바를 밀어
       body 전체를 가로 스크롤시키므로 한 줄로 묶어 말줄임 처리한다. */
    .topbar .store-name {
        font-size: 0.88rem;
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* 본문 여백·제목 축소. 셀렉터를 .admin-shell 하위로 좁히면 안 된다 —
       Error는 BlankLayout이라 .content가 셸 바깥에 있는 유일한 화면이다. */
    .content {
        padding: 1.1rem 0.9rem;
    }

    .content h1 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    /* 필터 행(기간연장): flex-wrap이 없어 버튼 6개가 한 줄에 갇히고 360px에서 넘친다.
       spacer는 flex:1로 잔여 폭을 삼켜 '새로고침'만 떨어뜨리므로, 폭 대신 줄바꿈 지점이 되게 한다.
       페이지 <style>이 <body>에 있어 문서 순서상 나중이므로 특정성을 한 단계 높여야 이긴다. */
    div.filter-row {
        flex-wrap: wrap;
        gap: 0.6rem 0.75rem;
    }

    div.filter-row .spacer {
        flex-basis: 100%;
        height: 0;
    }

    /* .table-wrap의 overflow-x는 표가 컨테이너보다 넓어야 발동한다. nowrap이 없으면 9개 열이
       스크롤 대신 압착되어 한글이 음절 단위로 쪼개지고 액션 버튼도 두 줄로 접힌다. */
    table.grid th,
    table.grid td {
        white-space: nowrap;
    }

    /* 메모·결과메모만 예외. 길이 제한 없는 자유 텍스트라 nowrap을 상속하면 표 폭이 폭주한다.
       폭 제약은 반드시 셀이 아니라 셀 '안의 박스'에 건다 — auto table layout에서 td의 min/max-width는
       스펙상 미정의라 브라우저가 무시한다(td에 걸면 계산값은 224px로 보이지만 효과가 없다).
       min-width가 필수: 나머지 열이 nowrap이라 잉여 폭이 0이 되고, 그러면 auto layout은 wrap 허용 열에
       min-content 폭만 준다 → 메모가 50px로 붕괴해 한 줄에 2~3자씩 흐른다(실측: 높이 239px).
       table.grid 하위로 묶어 공용 .muted/.small 정의에는 닿지 않게 한다. */
    table.grid td .note-cell,
    table.grid td .small {
        white-space: normal;
        min-width: 10rem;
        max-width: 14rem;
    }

    /* 표가 가로 스크롤되면 colspan 셀의 폭은 표 전체 폭이 된다. 승인/거절 버튼은 맨 오른쪽 열이라
       그대로 두면 폼이 화면 밖 왼쪽에서 열린다. 스크롤 위치와 무관하게 뷰포트에 붙여둔다. */
    .edit-form {
        position: sticky;
        left: 0;
        max-width: calc(100vw - 1.8rem);
    }

    .edit-form input {
        min-width: 0;
    }
}
