/* 전자서명 — 서명 페이지·검증 페이지·관리자 콘솔 '전자서명' 탭 공용 (2026-10-15)
   색은 tokens.css 의 --mu-* 만 사용. 한 줄 보장이 필요한 곳은 전역 flex-wrap 간섭 때문에 grid 사용 */

/* display 를 지정한 요소도 hidden 속성이면 숨김 (es-step·es-inline 등이 [hidden] 기본값을 덮어쓰는 것 방지) */
.es-wrap [hidden], #panel-esign [hidden] { display: none !important; }

.es-wrap { max-width: 860px; margin: 0 auto; padding: 0 16px 48px; display: grid; gap: 16px; }
.es-lead { font-size: 15px; color: var(--mu-ink); margin: 0; line-height: 1.6; }
.es-hint { font-size: 12.5px; color: var(--mu-ink-soft); margin: 4px 0 0; line-height: 1.6; }
.es-docnames { margin: 0; padding-left: 18px; color: var(--mu-ink); font-size: 14px; line-height: 1.7; }

/* 단계 카드 (본인 확인 → 문서 확인 → 서명: 실제 순서) */
.es-step { display: grid; gap: 12px; }
.es-step__title { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; font-size: 17px; font-weight: 800; color: var(--mu-ink); margin: 0; }
.es-step__no { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; color: #fff; background: var(--mu-teal); }
.es-step.is-done .es-step__no { background: var(--mu-dew); color: var(--mu-teal-deep); }
.es-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.es-inline .mu-btn { white-space: nowrap; }
.es-field-label { display: block; font-size: 14px; font-weight: 700; color: var(--mu-ink); margin-bottom: 6px; }
.es-done-note { color: var(--mu-teal-deep); font-weight: 700; font-size: 14px; margin: 0; }

/* 문서 탭 */
.es-doctabs { display: flex; gap: 6px; }
.es-doctab { border: 1px solid var(--mu-dew); background: #fff; color: var(--mu-ink-soft); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; cursor: pointer; }
.es-doctab.active { background: var(--mu-teal); border-color: var(--mu-teal); color: #fff; }
.es-docmeta { display: grid; gap: 6px; font-size: 12.5px; color: var(--mu-ink-soft); }
.es-hash { font-family: Consolas, "D2Coding", monospace; font-size: 11.5px; word-break: break-all; color: var(--mu-ink-soft); }
.es-docmeta a { color: var(--mu-teal-deep); font-weight: 700; }

/* 페이지 + 칸 겹쳐 보이기 (칸 좌표는 페이지 대비 % — 화면 크기와 무관) */
.es-pages { display: grid; gap: 14px; }
.es-page { position: relative; width: 100%; height: 0; background: #fff; box-shadow: 0 2px 10px rgba(16, 32, 30, 0.12); border-radius: 4px; overflow: hidden; }
.es-page__img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.es-page__no { position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: var(--mu-ink-soft); background: rgba(255, 255, 255, 0.85); padding: 1px 6px; border-radius: 999px; }
.es-box { position: absolute; display: grid; place-items: center; border: 2px dashed; border-radius: 4px; overflow: hidden; font-size: clamp(9px, 1.5vw, 12px); line-height: 1.2; text-align: center; color: var(--mu-ink); }
.es-box--signer { border-color: var(--mu-teal); background: rgba(30, 156, 141, 0.12); }
.es-box--admin { border-color: #9aaba8; background: rgba(154, 171, 168, 0.12); }
.es-box--date { border-color: var(--mu-gold); background: rgba(255, 249, 236, 0.96); } /* 완료본에서 흰 바탕으로 덮이는 칸 — 미리보기도 원본 글자를 가림 */
.es-box__label { padding: 0 4px; font-weight: 700; }
.es-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.es-box__text { font-weight: 700; font-size: clamp(10px, 2vw, 16px); }
.es-box.has-value { border-style: solid; background: rgba(255, 255, 255, 0.35); }

/* 관리자 칸 편집 */
.es-page.is-editing { cursor: crosshair; }
.es-page.is-editing .es-box { cursor: move; touch-action: none; }
/* 지우기는 왼쪽 위, 크기 조절은 오른쪽 아래 — 낮은 칸(계약일 등)에서도 서로 겹치지 않게 */
.es-box__del { position: absolute; top: 0; left: 0; z-index: 1; width: 18px; height: 18px; border: none; border-radius: 0 0 4px 0; background: var(--mu-coral); color: #fff; font-size: 12px; line-height: 18px; padding: 0; cursor: pointer; }
.es-box__handle { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; background: var(--mu-teal-deep); cursor: nwse-resize; touch-action: none; }
.es-tools { display: flex; gap: 6px; align-items: center; }
.es-tool { border: 2px dashed; background: #fff; border-radius: 8px; padding: 5px 10px; font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--mu-ink); }
.es-tool--signer { border-color: var(--mu-teal); }
.es-tool--admin { border-color: #9aaba8; }
.es-tool--date { border-color: var(--mu-gold); }
.es-tool.active { border-style: solid; box-shadow: 0 0 0 3px rgba(30, 156, 141, 0.25); }

/* 서명 패드 */
.es-pad { position: relative; height: 180px; border: 1px solid var(--mu-dew); border-radius: 10px; background: #fff; }
.es-pad canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; border-radius: 10px; }
.es-pad__guide { position: absolute; left: 16px; right: 16px; bottom: 38px; border-bottom: 1px dashed var(--mu-dew); pointer-events: none; }
.es-pad__clear { position: absolute; top: 8px; right: 8px; border: 1px solid var(--mu-dew); background: #fff; color: var(--mu-teal-deep); border-radius: 6px; font-size: 12px; padding: 3px 9px; cursor: pointer; }
.es-consent { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; font-size: 13.5px; color: var(--mu-ink); line-height: 1.6; cursor: pointer; }
.es-consent input { margin-top: 4px; width: 16px; height: 16px; }
.es-submit { justify-self: center; min-width: 220px; }

/* 상태 안내·결과 */
.es-notice { text-align: center; display: grid; gap: 10px; padding: 28px 18px; }
.es-notice__title { font-size: 18px; font-weight: 800; color: var(--mu-ink); margin: 0; }
.es-notice p { margin: 0; color: var(--mu-ink-soft); font-size: 14px; line-height: 1.7; }
.es-result { display: grid; gap: 6px; padding: 14px 16px; border-radius: 10px; font-size: 14px; line-height: 1.6; }
.es-result--ok { background: #e2f3ee; color: var(--mu-teal-deep); }
.es-result--warn { background: #fbf1df; color: #7a5a12; }
.es-result--bad { background: #f6e2df; color: #a5432f; }
.es-result b { font-size: 15px; }

/* 관리자 상세 */
.es-admin-head { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.es-admin-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13px; color: var(--mu-ink); }
.es-admin-meta dt { color: var(--mu-ink-soft); }
.es-admin-meta dd { margin: 0; word-break: break-all; }
.es-actions { display: flex; gap: 8px; align-items: center; }
.es-linkbox { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.es-section-title { font-size: 15px; font-weight: 800; color: var(--mu-ink); margin: 6px 0 0; }
.es-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.es-split__side { position: sticky; top: 90px; display: grid; gap: 12px; }

/* 회원 화면 /esign — 표·폼·작은 버튼 (관리자 콘솔의 adm-* 는 admin.jsp 안에만 있어 따로 둠) */
.es-wrap--wide { max-width: 1120px; }
.es-stack { display: grid; gap: 16px; }
.es-step__title--plain { grid-template-columns: 1fr; }
.es-quota { font-size: 13px; color: var(--mu-ink-soft); margin: 0; }
.es-quota b { color: var(--mu-teal-deep); }
.es-formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.es-formgrid .full { grid-column: 1 / -1; }
.es-formgrid .mu-input { width: 100%; }
.mu-btn.es-btn-sm { padding: 5px 11px; font-size: 12.5px; min-height: 0; }
.es-table-scroll { overflow-x: auto; }
.es-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.es-table th, .es-table td { border-bottom: 1px solid var(--mu-dew); padding: 8px 10px; text-align: left; white-space: nowrap; vertical-align: middle; }
.es-table th { color: var(--mu-ink-soft); font-weight: 700; }
.es-table td.wrap { white-space: normal; min-width: 160px; }
.es-empty { color: var(--mu-ink-soft); font-size: 13px; padding: 18px; text-align: center; }
.es-pager { display: grid; grid-template-columns: auto auto auto; gap: 10px; justify-content: center; align-items: center; font-size: 13px; color: var(--mu-ink-soft); margin-top: 10px; }

@media (max-width: 900px) {
    .es-split { grid-template-columns: 1fr; }
    .es-split__side { position: static; }
}
@media (max-width: 768px) {
    .es-wrap { padding: 0 12px 40px; }
    .es-formgrid { grid-template-columns: 1fr; }
    .es-inline { grid-template-columns: 1fr; }
    .es-submit { width: 100%; min-width: 0; }
    .es-pad { height: 160px; }
}
