/* WellRiskKeeper S-GDS UI & PDF 보존 스타일 */

.app-wrapper {
  max-width: 600px;
  margin: 0 auto;
  padding: 14px 16px 60px 16px;
}

/* ========================================================
   게이트키퍼 표준 5단계 프로그레시브 네비게이션 탭 (PWA Step Tabs)
   ======================================================== */
.pwa-step-tabs {
  display: flex;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 3px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  gap: 3px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.pwa-step-tabs::-webkit-scrollbar {
  display: none;
}

.pwa-tab-item {
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  padding: 7px 6px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.pwa-tab-item:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.tab-num-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

/* 1. 완료된 단계: 따뜻한 오렌지 동그라미로 콤팩트하게 압축 */
.pwa-tab-item.completed {
  flex: 0 0 30px;
  min-width: 30px;
  padding: 5px 0;
  background: #fffbeb;
  border-color: #fde68a;
}
.pwa-tab-item.completed .tab-num-badge {
  background: #d97706;
  color: #ffffff;
  font-weight: 800;
}
.pwa-tab-item.completed .tab-label {
  display: none;
}

/* 2. 현재 활성 단계: 다크 네이비 반전 및 명칭 온전 노출 */
.pwa-tab-item.active {
  flex: 1;
  min-width: 85px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  padding: 7px 8px;
}
.pwa-tab-item.active .tab-num-badge {
  background: #0f172a;
  color: #ffffff;
  font-weight: 800;
}
.pwa-tab-item.active .tab-label {
  display: inline;
  color: #0f172a;
  font-weight: 700;
  font-size: 12px;
}

/* 3. 앞으로 남은 단계: 번호 뱃지만 정갈하게 압축 (글자 잘림 원천 차단) */
.pwa-tab-item.upcoming {
  flex: 0 0 30px;
  min-width: 30px;
  padding: 5px 0;
}
.pwa-tab-item.upcoming .tab-num-badge {
  background: #e2e8f0;
  color: #64748b;
}
.pwa-tab-item.upcoming .tab-label {
  display: none;
}

/* ========================================================
   페이지 컨테이너
   ======================================================== */
.page-container {
  display: none;
  flex-direction: column;
  gap: 14px;
}
.page-container.active {
  display: flex;
}

/* 카드 박스 (게이트키퍼 스타일) */
.card-box {
  background: #ffffff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--navy-950);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 인풋 및 폼 컨트롤 */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.form-label {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.form-input {
  width: 100%;
  height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 13.5px;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}
.form-input:focus {
  border-color: #0f172a;
}
.form-helper {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

/* 게이트키퍼 표준 듀얼 스위치 및 터치 칩 버튼 (OSMU 모바일 최적화) */
.obs-btn-switch {
  padding: 6px 12px;
  min-height: 40px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.obs-btn-switch.selected-clean,
.obs-btn-switch.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
  font-weight: 800;
}

.chip-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 4px;
}
.chip-group.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.form-chip {
  padding: 8px 6px;
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  text-align: center;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  word-break: keep-all;
  line-height: 1.2;
  transition: all 0.15s ease;
}
.form-chip:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}
.form-chip.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  font-weight: 700;
}

/* 탭 전환 (기존 대상자 검색 vs 현장 신규 등록) */
.tab-switch {
  display: flex;
  background: var(--navy-300);
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 4px;
  margin-bottom: 12px;
}
.tab-btn {
  flex: 1;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-700);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab-btn.active {
  background: #ffffff;
  color: var(--navy-950);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* 검색결과 리스트 */
.search-results-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  background: #ffffff;
}
.search-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border-subtle);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.search-item:hover {
  background: var(--navy-100);
}

/* 하단 버튼 바 (게이트키퍼 표준 5:5 그리드) */
.action-row,
.btn-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.btn-primary {
  width: 100%;
  height: 44px;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-primary:hover {
  background: #1e293b;
  border-color: #1e293b;
}
.btn-secondary {
  width: 100%;
  height: 44px;
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-secondary:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
}
.btn-blue {
  background: var(--c-primary);
  color: #ffffff;
}
.btn-blue:hover {
  background: var(--c-primary-hover);
}

/* 라디오 & 체크 아이템 */
.check-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--navy-850);
}
.check-item input {
  cursor: pointer;
  accent-color: var(--c-primary);
}

.flex-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  margin-bottom: 8px;
}
.p2-underline, .input-underline {
  border: none;
  border-bottom: 1px solid var(--navy-500);
  padding: 3px 6px;
  outline: none;
  font-size: 13px;
  background: transparent;
  color: var(--navy-950);
}

/* ========================================================
   [절대보존 영역] PDF 및 동의서, GDS 15문항 테이블 원본 스타일
   ======================================================== */
.agreement-box {
  border: 1.5px solid #000;
  padding: 20px;
  font-size: 12.5px;
  line-height: 1.7;
  background: #fff;
  color: #000;
}
.agreement-title {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 20px;
  border-bottom: 2px solid #000;
  padding-bottom: 10px;
}
.sig-canvas-area {
  width: 100%;
  height: 140px;
  background-color: #fff;
  border: 1px solid #000;
  cursor: crosshair;
}
.section-title {
  font-weight: bold;
  margin-top: 15px;
  display: block;
}
.indent {
  padding-left: 10px;
  display: block;
}
.gds-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12px;
  table-layout: fixed;
  word-break: break-all;
}
.gds-table th:nth-child(1), .gds-table td:nth-child(1) { width: 10%; }
.gds-table th:nth-child(2), .gds-table td:nth-child(2) { width: 70%; }
.gds-table th:nth-child(3), .gds-table td:nth-child(3) { width: 10%; }
.gds-table th:nth-child(4), .gds-table td:nth-child(4) { width: 10%; }
.gds-table th, .gds-table td {
  border: 1px solid #A6A6A6;
  padding: 8px 2px;
  text-align: center;
}
.gds-table tr.uncheck-row,
.uncheck-row {
  background-color: #FFEBEE;
}
.date-input-wide {
  border: none;
  border-bottom: none;
  width: 210px;
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  outline: none;
  background: transparent;
}
.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  font-size: 12px;
}
.pdf-table td {
  border: 1px solid #000;
  padding: 4px;
}
.pdf-label {
  background: #f2f2f2;
  font-weight: bold;
  width: 80px;
  text-align: center;
}

/* ========================================================
   인앱 토스트 및 모달 알림 스타일 (게이트키퍼 규격 동일)
   ======================================================== */
.wrk-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 480px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.wrk-toast {
  background: var(--navy-950);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: auto;
  border: 1px solid #334155;
  border-left: 3px solid var(--navy-400);
}
.wrk-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.wrk-toast-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 2px;
  flex-shrink: 0;
}
.wrk-toast-badge-info { background: var(--navy-700); color: #ffffff; }
.wrk-toast-badge-success { background: #166534; color: #dcfce7; }
.wrk-toast-badge-warning { background: #9a3412; color: #ffedd5; }
.wrk-toast-badge-error { background: #991b1b; color: #fee2e2; }
.wrk-toast-text {
  flex: 1;
  line-height: 1.4;
  word-break: keep-all;
}

.wrk-modal-container {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.wrk-modal-container.active {
  display: flex;
}
.wrk-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.wrk-modal-card {
  position: relative;
  background: #ffffff;
  width: 100%;
  max-width: 420px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  overflow: hidden;
}
.wrk-modal-header {
  padding: 13px 16px;
  background: #f8fafc;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
}
.wrk-modal-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.wrk-modal-body {
  padding: 16px;
}
.wrk-modal-desc {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: #334155;
  line-height: 1.5;
}
.wrk-modal-footer {
  padding: 12px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
}

/* ========================================================
   서명 전용 팝업 모달 스타일 (게이트키퍼 규격 동일)
   ======================================================== */
.sig-modal-container {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.sig-modal-container.active {
  display: flex;
}
.sig-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}
.sig-modal-card {
  position: relative;
  background: #ffffff;
  width: 100%;
  max-width: 400px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  overflow: hidden;
}
.sig-modal-header {
  padding: 12px 16px;
  background: #f8fafc;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sig-modal-title {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0;
}
.sig-btn-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0;
}
.sig-modal-body {
  padding: 16px;
  background: #ffffff;
}
.sig-canvas-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: crosshair;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sig-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.sig-guide-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  color: #94a3b8;
  pointer-events: none;
  font-weight: 500;
}
.sig-modal-footer {
  padding: 12px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
