/* =============================================================
   PlanManager 디자인 토큰

   ★ 케어톡(어두운 남색)과 확연히 구분되는 톤을 쓴다.
     PM 담당자와 케어톡 관리자는 COI 때문에 다른 사람일 수 있고,
     두 사이트가 비슷하게 생기면 "지금 어느 시스템인지" 착각한다.
     남의 돈을 다루는 화면에서 그 착각은 비싸다. 색이 곧 안전장치다.

   베이스는 차분하게, 액센트는 강하게 —
   PM 은 예외 큐·이상치·COI 플래그 같은 경고를 자주 띄워야 한다.
   ============================================================= */
:root {
    --pm-teal-900: #0d3b45;
    --pm-teal-800: #12505d;
    --pm-teal-700: #17667660;
    --pm-teal-600: #1a7f8f;
    --pm-amber:    #d97706;
    --pm-amber-bg: #fef3c7;
    --pm-red:      #b91c1c;
    --pm-red-bg:   #fee2e2;
    --pm-green:    #15803d;
    --pm-green-bg: #dcfce7;

    --pm-bg:       #f2f5f6;
    --pm-surface:  #ffffff;
    --pm-border:   #d8e0e2;
    --pm-text:     #12303a;
    --pm-muted:    #5f7681;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--pm-text);
    background: var(--pm-bg);
}

a { color: var(--pm-teal-600); }

/* ── 상단 바 ───────────────────────────────────────────── */
.pm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 52px;
    background: var(--pm-teal-900);
    color: #fff;
}

.pm-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: .2px;
    text-decoration: none;
}

/* 케어톡이 아니라는 것을 한눈에 알리는 표식 */
.pm-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: 6px;
    background: var(--pm-amber);
    color: #1c1207;
    font-size: 13px;
    font-weight: 700;
}

.pm-header-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.pm-user { color: #c7dde2; }
.pm-user strong { color: #fff; }
.pm-header a.pm-logout { color: #c7dde2; text-decoration: none; }
.pm-header a.pm-logout:hover { color: #fff; text-decoration: underline; }

/* ── 레이아웃 ──────────────────────────────────────────── */
.pm-shell { display: flex; min-height: calc(100vh - 52px); }

.pm-nav {
    flex: 0 0 220px;
    background: var(--pm-teal-800);
    padding: 14px 0;
}

/* 그룹 제목 — 하위 메뉴보다 먼저 눈에 들어오게(진하게·밝게), 그룹 사이는 얇은 구분선 */
.pm-nav-section {
    padding: 16px 20px 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .9px;
    color: #8fe8d6;   /* 연한 민트 — 흰색 하위 메뉴와 구분 */
}

.pm-nav-section:not(:first-child) {
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,.14);
}

/* 하위 메뉴 — 그룹 제목 아래로 한 단계 들여쓰기 */
.pm-nav a {
    display: block;
    padding: 8px 20px 8px 32px;
    font-size: 13.5px;
    color: #d3e6ea;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.pm-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }

.pm-nav a.active {
    background: rgba(255,255,255,.10);
    border-left-color: var(--pm-amber);
    color: #fff;
    font-weight: 600;
}

.pm-main { flex: 1; padding: 22px 26px; min-width: 0; }

.pm-page-title { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.pm-page-desc { margin: 0 0 20px; color: var(--pm-muted); }

/* ── 카드 ──────────────────────────────────────────────── */
.pm-card {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.pm-card h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }

.pm-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

/* QuickClaim cards also fit when the available detail column is narrow. */
#quickclaim-budgets { overflow-wrap: anywhere; }
#quickclaim-budgets .pm-card-grid { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
#quickclaim-budgets .pm-btn, #quickclaim-budgets .pm-expand { max-width: 100%; white-space: normal; }

@media (max-width: 640px) {
    .pm-shell:has(.pm-qc-lookup) .pm-nav { display: none; }
    .pm-shell:has(.pm-qc-lookup) .pm-main { padding: 18px 12px; }
    .pm-shell:has(.pm-qc-lookup) #quickclaim-budgets .pm-table { min-width: 520px; }
}

.pm-stat { font-size: 26px; font-weight: 600; margin: 2px 0 0; }
.pm-stat-label { color: var(--pm-muted); font-size: 12px; }
/* 인보이스 상세 요약 — 값은 크게, 금액·날짜는 더 크게 */
.pm-facts { gap: 16px 20px; }
.pm-facts .pm-stat-label { font-size: 13px; margin-bottom: 3px; }
.pm-fact { font-size: 17px; }
.pm-fact-key { font-size: 22px; font-weight: 700; color: var(--pm-teal-900); }

/* ── 배지 ──────────────────────────────────────────────── */
.pm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.pm-badge-warn   { background: var(--pm-amber-bg); color: #92400e; }
.pm-badge-danger { background: var(--pm-red-bg);   color: var(--pm-red); }
.pm-badge-ok     { background: var(--pm-green-bg); color: var(--pm-green); }
.pm-badge-muted  { background: #e8eef0; color: var(--pm-muted); }

/* ── 폼 ────────────────────────────────────────────────── */
.pm-field { margin-bottom: 14px; }
.pm-field label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; }

.pm-input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--pm-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--pm-text);
}
.pm-input:focus { outline: 2px solid var(--pm-teal-600); outline-offset: -1px; border-color: var(--pm-teal-600); }

/* 파일 선택 — 브라우저 기본 회색 버튼 대신 점선 영역 + 테일 버튼. 파일을 끌어다 놓아도 된다 */
input[type="file"].pm-input {
    padding: 14px;
    border: 2px dashed var(--pm-border);
    background: var(--pm-bg);
    color: var(--pm-muted);
    cursor: pointer;
}
input[type="file"].pm-input:hover { border-color: var(--pm-teal-600); }
input[type="file"].pm-input::file-selector-button {
    margin-right: 12px;
    padding: 7px 16px;
    border: 0;
    border-radius: 6px;
    background: var(--pm-teal-600);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
input[type="file"].pm-input::file-selector-button:hover { background: var(--pm-teal-800); }

.pm-btn {
    display: inline-block;
    padding: 9px 18px;
    border: 0;
    border-radius: 6px;
    background: var(--pm-teal-600);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.pm-btn:hover { background: var(--pm-teal-800); }
.pm-btn:disabled { opacity: .45; cursor: not-allowed; background: var(--pm-teal-600); }
.pm-qc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pm-qc-sync { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pm-btn-block { width: 100%; }

.pm-error {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--pm-red-bg);
    color: var(--pm-red);
    font-size: 13px;
}
.pm-error ul { margin: 0; padding-left: 18px; }

/* ★ 오류가 없으면 자리를 차지하지 않는다.
   asp-validation-for / asp-validation-summary 는 오류가 없을 때도 요소를 남기므로,
   배경과 여백만 그려져 빈 빨간 조각이 떠 있었다.
   :empty 는 공백이 들어가면 안 먹으므로 ASP.NET 이 붙이는 'valid' 클래스도 함께 본다. */
.pm-error:empty,
.pm-error.field-validation-valid,
.pm-error.validation-summary-valid { display: none; }

.pm-note {
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--pm-amber-bg);
    color: #92400e;
    font-size: 13px;
}

/* ── 도움말 ? 버튼 + 모달(<dialog>) ───────────────────── */
.pm-help {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--pm-border);
    border-radius: 50%;
    background: var(--pm-surface);
    color: var(--pm-teal-600);
    font-size: 13px;
    font-weight: 700;
    line-height: 20px;
    cursor: pointer;
}
.pm-help:hover { background: var(--pm-teal-600); color: #fff; }
.pm-modal {
    width: min(640px, calc(100vw - 32px));
    padding: 20px 24px;
    border: 1px solid var(--pm-border);
    border-radius: 10px;
    color: var(--pm-text);
}
.pm-modal::backdrop { background: rgba(13, 59, 69, .45); }
.pm-modal h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.pm-modal ol { margin: 0 0 16px; padding-left: 20px; line-height: 1.8; font-size: 14px; color: var(--pm-muted); }
.pm-modal .pm-step-now { font-weight: 700; color: var(--pm-teal-800); }
.pm-modal h4 { margin: 4px 0 6px; padding-top: 12px; border-top: 1px solid var(--pm-border); font-size: 14px; font-weight: 600; }
.pm-modal p { margin: 0 0 8px; font-size: 13px; color: var(--pm-muted); }
.pm-modal ul { margin: 0 0 10px; padding-left: 20px; line-height: 1.7; font-size: 13px; color: var(--pm-muted); }
.pm-modal ul strong { color: var(--pm-text); }

/* ── 선택지 카드(인보이스 상세: Send again · Reopen · Delete) ───── */
.pm-choice-title {
    margin: 18px 0 10px;
    padding-top: 14px;
    border-top: 1px solid var(--pm-border);
    font-size: 14px;
    font-weight: 600;
}
.pm-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 14px;
}
.pm-choice {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 14px 16px 16px;
    border: 1px solid var(--pm-border);
    border-top: 4px solid var(--pm-border);
    border-radius: 8px;
    background: var(--pm-surface);
}
.pm-choice h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.pm-choice p { margin: 0 0 12px; color: var(--pm-muted); font-size: 13px; line-height: 1.5; }
.pm-choice .pm-field { margin-bottom: 12px; }
.pm-choice .pm-btn { margin-top: auto; }

/* ── 로그인/셋업 화면 ──────────────────────────────────── */
.pm-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, var(--pm-teal-900) 0%, #17545f 100%);
}

.pm-auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--pm-surface);
    border-radius: 10px;
    padding: 28px 28px 24px;
    box-shadow: 0 12px 32px rgba(0,0,0,.22);
}

.pm-auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    font-size: 18px;
    font-weight: 700;
}

.pm-auth-sub { margin: 0 0 20px; color: var(--pm-muted); font-size: 13px; }

/* ── 테이블 ────────────────────────────────────────────── */
.pm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pm-table th, .pm-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--pm-border); }
.pm-table th { background: #eef3f4; font-weight: 600; color: var(--pm-muted); }
/* 칸 안 보조 정보(번호·ID·시각) — 박스 없이 본문 아래 작은 글씨. 두 줄 칸이 섞인 표는 위쪽 정렬로 첫 줄을 맞춘다 */
.pm-table-top td { vertical-align: top; }
.pm-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--pm-muted); }
.pm-table tbody tr:hover { background: #f7fafb; }
.pm-table-empty { padding: 26px; text-align: center; color: var(--pm-muted); }

/* 넓은 표는 페이지가 아니라 표가 스크롤되게 한다 */
.pm-table-wrap { overflow-x: auto; }

/* 인보이스 라인 삭제 — 표 안에서만 쓰는 작은 버튼 */
.pm-line-remove {
    border: 0; background: transparent; cursor: pointer;
    color: var(--pm-muted); font-size: 18px; line-height: 1; padding: 2px 6px;
}
.pm-line-remove:hover { color: var(--pm-red); }

/* 표 안의 입력은 행 높이를 키우지 않는다 */
.pm-table .pm-input { padding: 5px 7px; font-size: 13px; }

/* 스테이트먼트 — 묶음 머리줄·소계·합계, 음수 잔액 */
.pm-table .pm-statement-group td { background: #eef3f4; font-weight: 700; color: var(--pm-teal-900); }
.pm-table .pm-statement-subgroup td { font-weight: 600; }
.pm-table .pm-statement-total td { font-weight: 600; border-top: 1px solid var(--pm-border); }
.pm-table .pm-statement-grand td { border-top: 2px solid var(--pm-text); }
.pm-neg { color: var(--pm-red); }
/* 칸이 많은 표(스테이트먼트 청구 11칸) — PC 너비에서 금액 칸까지 한 화면에 들어오게 */
.pm-table-compact { font-size: 12px; }
.pm-table-compact th, .pm-table-compact td { padding: 7px 6px; }
.pm-table td.pm-nowrap { white-space: nowrap; }           /* 날짜·금액은 쪼개지 않는다 */
.pm-table-compact td.pm-break { overflow-wrap: anywhere; } /* 긴 인보이스 번호만 아무 데서나 줄바꿈 */
/* 스테이트먼트 청구 — 카테고리별 More + (최근 50건 다음을 펼친다) */
.pm-table .pm-more-row td { text-align: center; padding: 8px; }
.pm-more-btn {
    border: 1px solid var(--pm-border); background: var(--pm-surface); color: var(--pm-teal-800);
    border-radius: 999px; padding: 6px 16px; font: inherit; font-weight: 600; cursor: pointer;
}
.pm-more-btn:hover { background: #eef3f4; }
.pm-more-btn span { color: var(--pm-muted); font-weight: 400; }
.pm-portal .pm-more-btn { color: var(--pm-od); }
.pm-portal .pm-more-btn:hover { background: var(--pm-od-bg); }

/* 같은 화면의 보기 전환(링크 탭) */
.pm-tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--pm-border); flex-wrap: wrap; }
.pm-tabs a { padding: 8px 14px; color: var(--pm-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pm-tabs a:hover { color: var(--pm-text); }
.pm-tabs a.active { color: var(--pm-teal-800); border-bottom-color: var(--pm-teal-600); font-weight: 600; }

/* ── 참가자·업체 포털 (One Dream) ─────────────────────────
   ★ 관리자(짙은 청록 + 주황 PM)와 한눈에 다르게 — 흰 상단 바 + 로고 초록 포인트. 사이드바 없이 가운데 한 단. */
.pm-portal { --pm-od: #0b8a4e; --pm-od-dark: #076b3c; --pm-od-bg: #e8f6ee; }
.pm-portal-header {
    display: flex; align-items: center; gap: 28px;
    padding: 0 26px; min-height: 60px;
    /* 옅은 초록 — 로고 쪽이 조금 더 짙고 오른쪽으로 옅어진다 */
    background: linear-gradient(90deg, #cdeedb 0%, #def4e7 50%, #ecf8f0 100%);
    border-bottom: 1px solid #bfe4cd;
    box-shadow: 0 1px 3px rgba(11, 138, 78, .08);
}
.pm-portal-brand { display: flex; align-items: center; gap: 10px; color: var(--pm-text); text-decoration: none; font-size: 17px; white-space: nowrap; }
.pm-portal-brand img { display: block; border-radius: 9px; }
.pm-portal-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.pm-portal-brand-text strong { color: var(--pm-od); font-size: 17px; }
.pm-portal-brand-text small { color: var(--pm-muted); font-size: 10.5px; letter-spacing: .9px; text-transform: uppercase; }
.pm-portal-nav { display: flex; gap: 4px; align-self: stretch; }
.pm-portal-nav a {
    display: flex; align-items: center; padding: 0 14px;
    color: var(--pm-muted); text-decoration: none; font-weight: 600;
    border-bottom: 3px solid transparent;
}
.pm-portal-nav a:hover { color: var(--pm-od); }
.pm-portal-nav a.active { color: var(--pm-od); border-bottom-color: var(--pm-od); }
.pm-portal-account { margin-left: auto; position: relative; min-width: 0; font-size: 13px; }
.pm-portal-account summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
    padding: 7px 12px; border-radius: 999px; border: 1px solid transparent; min-width: 0;
}
.pm-portal-account summary::-webkit-details-marker { display: none; }
.pm-portal-account summary::after { content: ""; width: 7px; height: 7px; margin-top: -3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); color: var(--pm-muted); flex: none; }
.pm-portal-account[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
.pm-portal-account summary:hover, .pm-portal-account[open] summary { background: rgba(255, 255, 255, .7); border-color: #bfe4cd; }
.pm-portal-account summary.active { color: var(--pm-od); }
.pm-portal-user { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pm-portal-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 190px;
    background: #fff; border: 1px solid var(--pm-border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(18, 48, 58, .14); padding: 6px;
}
.pm-portal-menu a { display: block; padding: 9px 12px; border-radius: 6px; color: var(--pm-text); text-decoration: none; white-space: nowrap; }
.pm-portal-menu a:hover { background: var(--pm-od-bg); color: var(--pm-od); }
.pm-portal-menu a.active { color: var(--pm-od); font-weight: 600; }
.pm-portal-menu .pm-portal-menu-signout { border-top: 1px solid var(--pm-border); margin-top: 4px; padding-top: 10px; border-radius: 0 0 6px 6px; color: var(--pm-muted); }
.pm-portal .pm-btn { background: var(--pm-od); }
.pm-portal .pm-btn:hover { background: var(--pm-od-dark); }
.pm-portal-main { max-width: 1200px; margin: 0 auto; padding: 22px 26px; }
@media (max-width: 640px) {
    /* 폰: 1줄 = 브랜드 + 계정, 2줄 = 메뉴 */
    .pm-portal-header { flex-wrap: wrap; gap: 0 12px; padding: 0 16px; }
    .pm-portal-brand { min-height: 52px; }
    .pm-portal-nav { order: 3; width: 100%; border-top: 1px solid var(--pm-border); }
    .pm-portal-nav a { padding: 12px 14px; }
    .pm-portal-main { padding: 16px; }
    /* 요약 카드는 폰에서 2열 */
    .pm-portal .pm-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 수량·단가·금액이 비어 저장이 막힌 행. 어느 줄을 봐야 하는지 바로 보여야 한다 */
.pm-line-incomplete > td { background: var(--pm-red-bg); }

/* ── 뒤로가기 ──────────────────────────────────────────── */
/* 목록에서 열고 들어온 화면에는 되돌아갈 자리가 있어야 한다.
   브라우저 히스토리(history.back)가 아니라 부모 목록을 가리킨다 —
   저장 후 리다이렉트로 들어온 경우 히스토리는 엉뚱한 곳을 가리킨다. */
.pm-back {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 13px;
    text-decoration: none;
}
.pm-back:hover { text-decoration: underline; }

/* ── 날짜 입력(영문 달력) ──────────────────────────────── */
/* 네이티브 date 입력은 표기 형식을 브라우저 언어에서 가져와 한국어 크롬에서
   '연도-월-일' 로 보인다. pm-datefield.js 가 이 팝업으로 대체한다. */
.pm-datepop {
    display: none;
    position: absolute;
    z-index: 1000;
    width: 252px;
    padding: 10px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(18, 48, 58, .16);
}

.pm-datepop-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.pm-datepop-title { font-size: 13px; font-weight: 600; color: var(--pm-text); }
.pm-datepop-nav {
    border: 0; background: transparent; cursor: pointer;
    padding: 2px 8px; font-size: 17px; line-height: 1; color: var(--pm-teal-600);
}
.pm-datepop-nav:hover { color: var(--pm-teal-900); }

.pm-datepop-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

.pm-datepop-dow {
    text-align: center; font-size: 11px; font-weight: 600;
    color: var(--pm-muted); padding-bottom: 4px;
}

.pm-datepop-day {
    border: 0; border-radius: 5px; background: transparent; cursor: pointer;
    padding: 6px 0; font-size: 13px; font-family: inherit; color: var(--pm-text);
}
.pm-datepop-day:hover { background: #e8eef0; }
.pm-datepop-day.is-today { box-shadow: inset 0 0 0 1px var(--pm-border); font-weight: 600; }
.pm-datepop-day.is-selected { background: var(--pm-teal-600); color: #fff; font-weight: 600; }

.pm-datepop-foot {
    display: flex; justify-content: space-between;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--pm-border);
}
.pm-datepop-link {
    border: 0; background: transparent; cursor: pointer;
    font-size: 12px; font-family: inherit; color: var(--pm-teal-600); padding: 0;
}
.pm-datepop-link:hover { text-decoration: underline; }

/* ── 원본 문서 미리보기 ────────────────────────────────── */
/* 접수 화면에서는 값 입력이 주인공이다. 미리보기는 "맞게 읽었나"를 확인할 만큼만 차지하고,
   자세히 봐야 할 때는 눌러서 원본 크기로 연다. */
.pm-doc-thumb {
    max-width: 100%;
    border: 1px solid var(--pm-border);
    border-radius: 4px;
    cursor: zoom-in;
    display: block;
}

.pm-doc-hint { margin-top: 8px; font-size: 12px; color: var(--pm-muted); }

/* 원본 크기로 띄우는 겹창. 브라우저 기본 대화상자가 아니라 페이지 안의 요소다 */
.pm-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(12, 32, 39, .82);
    overflow: auto;
    padding: 28px;
    cursor: zoom-out;
}
.pm-lightbox.is-open { display: block; }

.pm-lightbox img {
    display: block;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 12px 40px rgba(0,0,0,.4);
    cursor: default;
}

.pm-lightbox-bar {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    color: #eaf2f4;
    font-size: 13px;
}

.pm-lightbox-close {
    border: 0;
    border-radius: 6px;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    padding: 6px 14px;
    cursor: pointer;
}
.pm-lightbox-close:hover { background: rgba(255,255,255,.24); }

/* ── 접었다 펴는 동작 유도 ─────────────────────────────── */
/* 새 플랜·선점·계약을 여는 자리다. 카드 안에 묻히면 있는 줄 모른다 —
   본문 링크(틸)와 구분되도록 액센트 색을 쓰고 배경으로 눌러지는 자리임을 보인다. */
.pm-expand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 12px;
    border: 1px solid var(--pm-amber);
    border-radius: 6px;
    background: var(--pm-amber-bg);
    color: #92400e;
    font-size: 13px;
    font-weight: 600;
    list-style: none;
}
.pm-expand::-webkit-details-marker { display: none; }
.pm-expand::before { content: "＋"; font-weight: 700; line-height: 1; }
.pm-expand:hover { background: var(--pm-amber); color: #fff; }

details[open] > .pm-expand { background: var(--pm-amber); color: #fff; }
details[open] > .pm-expand::before { content: "−"; }

/* ── 검색형 선택 ───────────────────────────────────────── */
/* 참가자·제공기관처럼 목록이 수백 개가 되는 칸. pm-searchselect.js 가 붙인다. */
.pm-ss { position: relative; }
.pm-ss-hidden { display: none; }

.pm-ss-panel {
    display: none;
    position: absolute;
    z-index: 1500;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 4px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(18, 48, 58, .16);
}
.pm-ss-panel.is-open { display: block; }

.pm-ss-item {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 8px 11px;
    font-size: 13px;
    font-family: inherit;
    color: var(--pm-text);
    cursor: pointer;
}
.pm-ss-item:hover,
.pm-ss-item.is-active { background: #e8eef0; }
.pm-ss-item.is-selected { font-weight: 600; color: var(--pm-teal-600); }
.pm-ss-none { color: var(--pm-muted); border-bottom: 1px solid var(--pm-border); }

.pm-ss-empty { padding: 12px; font-size: 13px; color: var(--pm-muted); text-align: center; }

/* 페이지를 불러오는 동안 — 화면 맨 위에 흐르는 막대 + 대상 영역 흐리게(body.pm-loading) */
.pm-loading-bar {
    display: none; position: fixed; top: 0; left: 0; right: 0; height: 4px;
    overflow: hidden; z-index: 1000; background: var(--pm-teal-700);
}
/* 흐르는 막대 — 상단 로딩 막대와 QuickClaim 진행 박스가 함께 쓴다 */
.pm-loading-bar::before, .pm-qc-progress::after {
    content: ""; position: absolute; left: -40%; width: 40%;
    background: var(--pm-teal-600); animation: pm-loading-slide 1.1s ease-in-out infinite;
}
.pm-loading-bar::before { top: 0; bottom: 0; }
.pm-loading .pm-loading-bar { display: block; }
.pm-loading [data-pm-loading-dim] { opacity: .5; pointer-events: none; transition: opacity .15s; }
@keyframes pm-loading-slide { from { left: -40%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
    .pm-loading-bar::before, .pm-qc-progress::after { animation: none; left: 0; width: 100%; }
}

/* QuickClaim 조회·Sync 진행 중 — 버튼은 흐려지지 않고(꺼진 것처럼 보이면 멈춘 줄 안다) 스피너,
   옆에는 흐르는 막대가 있는 안내 박스. 30초~1분 걸릴 수 있다. */
.pm-btn.is-busy, .pm-btn.is-busy:disabled { opacity: 1; cursor: progress; background: var(--pm-teal-800); }
.pm-btn.is-busy::before {
    content: ""; display: inline-block; width: 14px; height: 14px; margin: 0 8px -2px 0;
    border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%;
    animation: pm-spin .7s linear infinite;
}
.pm-qc-progress:not([hidden]) {
    position: relative; overflow: hidden;
    display: inline-flex; flex-direction: column; justify-content: center; vertical-align: middle;
    padding: 5px 14px 8px; border: 1px solid var(--pm-teal-600); border-radius: 6px;
    background: #e6f3f5; color: var(--pm-teal-900); font-weight: 600; line-height: 1.35;
}
.pm-qc-progress small { font-size: 12px; font-weight: 400; color: var(--pm-muted); }
.pm-qc-progress::after { bottom: 0; height: 3px; }
@keyframes pm-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .pm-btn.is-busy::before { animation: none; }
}

/* ── 계약서(관리자·포털) ───────────────────────────── */
.pm-pdf { max-width: 860px; background: #e8eef0; padding: 8px; border-radius: 8px; max-height: 70vh; overflow-y: auto; }
.pm-pdf-page { display: block; width: 100%; height: auto; margin: 0 auto 8px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.pm-sign-box { position: relative; border: 1px dashed var(--pm-border); border-radius: 8px; background: #fff; }
.pm-sign-box canvas { display: block; width: 100%; height: 180px; touch-action: none; }
.pm-sign-box [data-pm-signature-clear] { position: absolute; top: 6px; right: 6px; }
.pm-sign-hint { margin: 4px 0 0; font-size: 12px; color: var(--pm-muted); }
.pm-portal-notice { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.pm-consent { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.pm-consent input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
#pm-sign-confirm { width: min(420px, calc(100vw - 32px)); }
@media (max-width: 640px) { .pm-sign-box canvas { height: 160px; } .pm-pdf { max-height: 60vh; } }
/* First agreement intake */
.pm-onboarding { max-width: 940px; margin: 0 auto 48px; }
.pm-onboarding-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0; margin: 24px 0; list-style: none; }
.pm-onboarding-steps a { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 10px; border: 1px solid var(--pm-border); border-radius: 8px; color: inherit; text-decoration: none; font-size: 13px; }
.pm-onboarding-steps span { display: inline-grid; place-items: center; flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--pm-bg); font-weight: 700; }
.pm-onboarding-steps .current a { border-color: var(--pm-green, #26845b); font-weight: 700; }
.pm-onboarding-steps .current span, .pm-onboarding-steps .done span { background: var(--pm-green, #26845b); color: white; }
.pm-onboarding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.pm-onboarding-wide { grid-column: 1 / -1; }
.pm-onboarding .pm-card h3 { margin: 24px 0 8px; font-size: 16px; }
.pm-onboarding-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin: 18px 0; }
.pm-onboarding-summary { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; }
.pm-onboarding-summary dt { color: var(--pm-muted); }
.pm-onboarding-summary dd { margin: 0; overflow-wrap: anywhere; }
.pm-field-error { display: block; color: var(--pm-red, #b42318); font-size: 12px; margin-top: 4px; }
.pm-field-error:empty { display: none; }
#pm-budget-table .pm-input { min-width: 110px; }
@media (max-width: 700px) {
    .pm-onboarding-steps { grid-template-columns: repeat(2, 1fr); }
    .pm-onboarding-grid { grid-template-columns: 1fr; }
    .pm-onboarding-summary { grid-template-columns: 1fr; gap: 2px; }
    .pm-onboarding-summary dd { margin-bottom: 10px; }
    .pm-onboarding .pm-table-wrap { overflow-x: auto; }
}

/* ── 인보이스 대기열(Upload invoices · Holding · Ready to send · CareTalk claims · 홀딩 상세) ── */
/* 메뉴 건수 배지 — 0 이면 그리지 않는다. 사람이 손대야 하는 대기열(홀딩·CareTalk claims)은 주황 */
.pm-nav-badge {
    float: right;
    min-width: 20px;
    margin-top: 1px;
    padding: 0 7px;
    border-radius: 10px;
    background: rgba(255,255,255,.18);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}
.pm-nav-badge-warn { background: var(--pm-amber); color: #1c1207; }

/* 요약 숫자 카드 — 카드마다 테두리, 급한 숫자(청구 기한 10일 안)는 빨간 테두리 */
.pm-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.pm-stat-row .pm-card { margin: 0; }
.pm-stat-sub { margin-top: 2px; color: var(--pm-muted); font-size: 12px; }
.pm-card-urgent { border: 2px solid var(--pm-red); }
.pm-card-urgent .pm-stat { color: var(--pm-red); }

/* 사유 칩 필터 */
.pm-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.pm-chip {
    padding: 5px 12px;
    border: 1px solid var(--pm-border);
    border-radius: 999px;
    background: var(--pm-surface);
    color: var(--pm-text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.pm-chip:hover { border-color: var(--pm-teal-600); }
.pm-chip span { margin-left: 5px; font-weight: 400; opacity: .8; }
.pm-chip.is-active { background: var(--pm-teal-600); border-color: var(--pm-teal-600); color: #fff; }
.pm-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* 보조 버튼(흰 바탕) · 표 안의 작은 버튼 */
.pm-btn-secondary { background: var(--pm-surface); color: var(--pm-teal-800); border: 1px solid var(--pm-teal-600); }
.pm-btn-secondary:hover { background: #eef3f4; }
.pm-btn-secondary:disabled { background: var(--pm-surface); }
.pm-btn-sm { padding: 5px 12px; font-size: 13px; text-decoration: none; }

/* 끌어다 놓기 업로드 영역 */
.pm-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 34px 20px;
    border: 2px dashed var(--pm-border);
    border-radius: 8px;
    background: var(--pm-bg);
    color: var(--pm-muted);
    text-align: center;
    cursor: pointer;
}
.pm-dropzone strong { color: var(--pm-teal-800); font-size: 15px; }
.pm-dropzone:hover, .pm-dropzone.is-over { border-color: var(--pm-teal-600); background: #e6f3f5; }

/* 하단 고정 바(선택 n · 합계 · 보내기) */
.pm-sendbar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 16px;
    border: 1px solid var(--pm-border);
    border-radius: 8px;
    background: var(--pm-surface);
    box-shadow: 0 -4px 16px rgba(18, 48, 58, .08);
}
.pm-sendbar-text { flex: 1 1 260px; font-weight: 600; }

/* 홀딩 상세(A3) — 왼쪽 원본, 오른쪽 대조표. 좁으면 한 단 */
.pm-hold-bar { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: -8px 0 16px; font-size: 13px; }
.pm-hold-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .pm-hold-grid { grid-template-columns: 1fr; } }
.pm-doc-frame { display: block; width: 100%; height: 720px; border: 1px solid var(--pm-border); border-radius: 4px; }
.pm-compare td { vertical-align: top; }
.pm-compare td:first-child { font-weight: 600; white-space: nowrap; }
.pm-compare tr.is-bad td { background: var(--pm-red-bg); color: var(--pm-red); }
.pm-compare tr.is-bad .pm-sub { color: var(--pm-red); }
.pm-mark { font-size: 16px; font-weight: 700; }
.pm-mark-ok { color: var(--pm-green); }
.pm-mark-bad { color: var(--pm-red); }

/* ── 데모(그림자 운영) — 테스트 서버에서만 보인다 ─────────────── */
/* 맨 위 띠 — 운영 화면과 한눈에 다르게 */
.pm-demo-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    padding: 8px 20px;
    background: repeating-linear-gradient(135deg, #facc15 0 18px, #fbbf24 18px 36px);
    color: #1c1207;
    font-size: 13px;
}
.pm-demo-banner a { margin-left: auto; color: #1c1207; font-weight: 700; }
/* 판정 카드 — 실서버 기준(Ready 인데 실제 청구와 다름) 0건이면 초록 */
.pm-card-ok { border: 2px solid var(--pm-green); }
.pm-card-ok .pm-stat { color: var(--pm-green); }
/* 진행 막대(참가자 일괄 Sync) */
.pm-progress { height: 8px; border-radius: 4px; background: #e8eef0; overflow: hidden; }
.pm-progress span { display: block; height: 100%; width: 0; background: var(--pm-teal-600); transition: width .3s; }
#pm-demo-list tr.is-bad td { background: var(--pm-red-bg); }
