/* 견적서 · 발주서 작성 팝업(views/doc-popup.js) — 포털 위 큰 창(PC), 안에 NPMS 작성 화면(iframe). 휴대폰은 화면 전체.
   portal.css 의 dialog.dlg · .toast 를 바탕으로 크기와 안쪽만 다시 잡는다. */
dialog.dlg.np-pop[open] {
  display: flex; flex-direction: column; overflow: hidden;
  width: min(1100px, calc(100vw - 48px)); max-width: none;
  height: calc(100vh - 48px); height: calc(100dvh - 48px); max-height: none;
}
.np-pop-head { flex: none; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.np-pop-head .grow { flex: 1; }
.np-pop-title { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.np-pop-body { position: relative; flex: 1; min-height: 0; background: var(--surface); }
.np-pop-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--surface); }

/* 불러오는 중 · 열리지 않을 때 — 창 안을 덮는다(작성 화면이 뜨면 걷힌다) */
.np-pop-wait { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; background: var(--surface); color: var(--ink3); text-align: center; }
.np-pop-why { max-width: 420px; font-size: 14px; color: var(--ink2); line-height: 1.6; }
.np-pop-acts { display: flex; gap: 8px; }
.np-pop-wait > .ic { color: var(--wrn); }
.np-pop-spin { width: 28px; height: 28px; border: 3px solid var(--hover); border-top-color: var(--npms); border-radius: 50%; animation: np-pop-spin .8s linear infinite; }
@keyframes np-pop-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .np-pop-spin { animation-duration: 2.4s; } }

/* 저장한 뒤의 알림 — 링크가 눌려야 한다(알림 줄 자체는 눌리지 않는다) */
.toast.act { display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.toast.act .sep { color: #9AA6B4; }
.toast.act a { flex: none; padding: 6px 2px; color: #9CCBFF; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.toast.act a:hover { color: #C7E2FF; }
.toast.act a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }

/* 휴대폰 — 화면 전체. 머리 줄은 없다(안쪽 NPMS 작성 화면의 상단 바 — 뒤로 · 제목 · 저장 — 가 대신한다) */
@media (max-width: 720px) {
  dialog.dlg.np-pop[open] { width: 100%; height: 100%; height: 100dvh; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .np-pop-head { display: none; }
  /* 노치 · 아래 막대 자리는 창 틀이 비워 둔다(iframe 은 top · bottom 만으로는 늘어나지 않아 높이를 적는다) */
  .np-pop-frame { top: env(safe-area-inset-top, 0px); bottom: auto; height: calc(100% - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
  .np-pop-wait .btn { min-height: 44px; }
  /* 알림 줄은 가운데 반쪽 폭(left:50% 에서 줄어든다)이 아니라 화면 폭을 쓴다 — 글과 링크가 한 줄로 */
  .toasts:has(.toast.act) { left: 16px; right: 16px; transform: none; }
  .toast.act { width: 100%; max-width: none; justify-content: center; }
  .toast.act a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 6px; }
}
