@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&display=swap');
/* 안동포 PMS 공통 스타일 — gnuboard5와 분리된 독립 에셋 */
/* 전체 글꼴 단일 출처 — 모든 화면/출력/캔버스가 이 스택을 사용 (Noto Sans KR, 폴백 맑은 고딕) */
:root { --pms-font: "Noto Sans KR", "맑은 고딕", "Malgun Gothic", AppleGothic, sans-serif; }
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--pms-font);
  font-size: 14px; color: #222; background: #f4f5f7;
  /* 데스크톱 업무 도구 — 1200px 미만이면 반응형으로 줄지 않고 가로 스크롤 */
  min-width: 1200px;
}
a { color: #2563eb; text-decoration: none; }
button { cursor: pointer; }
/* 모든 폼 컨트롤(input type=date 포함)도 동일 글꼴 — UA 기본 글꼴 방지 */
input, select, textarea, button, optgroup, option { font-family: var(--pms-font); }
input[type=date], input[type=number] { font-family: var(--pms-font); }

/* ---------- 포커스 (전역, 키보드 접근성) ---------- */
/* 또렷한 Action Blue 포커스 링 — 마우스 클릭에는 뜨지 않고 키보드 탐색에만(:focus-visible) */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  border-radius: 4px;
}
/* :focus-visible 미지원 구형 브라우저 폴백 */
input:focus, select:focus, textarea:focus { outline: 2px solid #2563eb; outline-offset: 1px; }
input:focus:not(:focus-visible), select:focus:not(:focus-visible), textarea:focus:not(:focus-visible) { outline: none; }

/* ---------- 로그인 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 340px; background: #fff; padding: 32px 28px;
  border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.12);
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; text-align: center; }
.login-card .sub { text-align: center; color: #888; font-size: 12px; margin-bottom: 24px; }
.login-card label { display: block; font-size: 13px; margin: 12px 0 4px; color: #444; }
.login-card input {
  width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px;
}
.login-card .btn-primary { width: 100%; margin-top: 20px; padding: 11px; }
.login-err { color: #dc2626; font-size: 13px; margin-top: 12px; min-height: 18px; text-align: center; }

/* ---------- 레이아웃 (상단 가로 내비 + 100% 폭 본문) ---------- */
.app { display: block; min-height: 100vh; }
.topnav {
  display: flex; align-items: stretch;
  background: #1f2937; color: #cbd5e1;
  padding: 0 20px; flex-wrap: wrap;
}
.topnav .brand {
  display: flex; align-items: center;
  font-size: 16px; font-weight: 700; color: #fff;
  padding: 14px 20px 14px 0; margin-right: 8px;
}
.topnav-menu { display: flex; align-items: stretch; flex-wrap: wrap; flex: 1; }
.topnav-menu a {
  display: flex; align-items: center; padding: 0 18px;
  color: #cbd5e1; font-size: 14px; line-height: 1;
  border-bottom: 3px solid transparent;
}
.topnav-menu a:hover { background: #374151; color: #fff; }
.topnav-menu a.active { background: #111827; color: #fff; border-bottom-color: #3b82f6; }
.topnav-menu a.disabled { color: #6b7280; cursor: not-allowed; }
.topnav-menu a.disabled:hover { background: transparent; color: #6b7280; }
.topnav .user {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: #cbd5e1; padding-left: 16px;
}

.pagebar {
  background: #fff; border-bottom: 1px solid #e5e7eb; padding: 12px 20px;
}
.page-title { margin: 0; font-size: 17px; font-weight: 700; color: #222; }

.content { padding: 20px; width: 100%; }

/* ---------- 버튼 ---------- */
.btn {
  padding: 7px 14px; border: 1px solid #d1d5db; background: #fff; border-radius: 6px;
  font-size: 13px; color: #333;
}
.btn:hover { background: #f3f4f6; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; }

/* ---------- 생산자관리 ---------- */
.maker-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.maker-tabs .tab {
  padding: 8px 18px; background: #e5e7eb; border-radius: 6px 6px 0 0; font-size: 14px; border: none;
}
.maker-tabs .tab.active { background: #fff; font-weight: 700; color: #2563eb; box-shadow: 0 -2px 6px rgba(0,0,0,.05); }

.toolbar { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search-box { display: flex; gap: 6px; align-items: center; }
.search-box input { padding: 7px 10px; border: 1px solid #ccc; border-radius: 6px; min-width: 200px; }
.search-box select {
  padding: 7px 10px; border: 1px solid #ccc; border-radius: 6px;
  font-size: 13px; font-family: inherit; color: #222; background: #fff;
}
.kbd { font-size: 11px; color: #9ca3af; }

.layout-2col { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }

.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; }
.card .card-hd { padding: 11px 16px; border-bottom: 1px solid #eee; font-weight: 600; font-size: 14px; }
.card .card-bd { padding: 16px; }

/* 폼 */
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; color: #555; margin-bottom: 4px; }
.form-row .req { color: #dc2626; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; font-family: inherit;
}
.form-row textarea { resize: vertical; min-height: 64px; }
.form-row.inline { display: flex; align-items: center; gap: 8px; }
.form-row.inline input[type=checkbox] { width: auto; }
.form-row.inline label { margin: 0; font-size: 13px; }
.field-err { color: #dc2626; font-size: 11px; margin-top: 3px; min-height: 14px; }
/* 내용 없으면 공간 차지 안 함(예약 높이 제거) — 폼 세로 절약 */
.field-err:empty { display: none; }
.hint { font-size: 11px; color: #9ca3af; margin-left: 4px; }

/* 목록 테이블 */
.tbl-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; white-space: nowrap; }
table.list th { background: #e8edf3; color: #374151; font-weight: 600; position: sticky; top: 0; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: #eff6ff; }
/* 선택 행: 배경색(색 의존) + 좌측 굵은 보더(보조 표식)로 이중 신호 */
table.list tbody tr.selected { background: #dbeafe; }
table.list tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 0 0 #2563eb;
  font-weight: 600;
}
table.list tbody tr:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
table.list td.num { text-align: right; }
table.list th.ctr, table.list td.ctr { text-align: center; }
table.list td.mk { font-size: 12px; letter-spacing: -1px; }
/* 홀로그램번호 열: 여러 sid를 줄바꿈으로 표시 */
table.list td.holo { font-size: 11px; line-height: 1.4; white-space: nowrap; color: #444; text-align: center; }
/* 총수량 열의 규격(몇새) 표기 */
.qty-spec { color: #2563eb; font-size: 11px; font-weight: 600; }
/* 조합원 표시 아이콘(생산자 이름 뒤) */
.mk-member { color: #d4a017; margin-left: 2px; font-size: 11px; letter-spacing: 0; vertical-align: 1px; }
.list-empty { padding: 28px; text-align: center; color: #999; }
.list-count { font-size: 12px; color: #666; margin-bottom: 6px; }

/* ---------- 입고관리 ---------- */
.search-box input[type=date] { padding: 7px 8px; border: 1px solid #ccc; border-radius: 6px; min-width: 0; }
.search-box .hint { margin: 0; }

/* ===== 정리된 100vh 셸 — 공용 (body.pms-fixed 스코프) =====================
   각 화면 mount에서 body에 .pms-fixed 부여. 2열 그리드 컨테이너에 .panel-2col 부여.
   좌(상세) 600px 고정 + 우(목록) 나머지, 100vh 셸로 세로 스크롤바 숨김
   (가로는 html/body의 min-width:1200px로 필요 시 허용).
   maker/stock/qa/qr 4개 화면 공통. 화면별 고유 규칙은 별도 스코프(예: body.pms-stock). */

/* 좌 600px 고정 / 우 나머지 — 미디어쿼리 없이 고정 */
body.pms-fixed .panel-2col { grid-template-columns: 600px 1fr; }

/* 100vh 셸: topnav + pagebar 고정 높이, content가 남은 높이 채우고 자체는 overflow:hidden */
/* 세로 바만 숨김(패널 내부 스크롤이 담당), 가로는 1200px 미만일 때 스크롤 허용 */
body.pms-fixed { overflow-x: auto; overflow-y: hidden; }
body.pms-fixed .app { height: 100vh; display: flex; flex-direction: column; }
body.pms-fixed .topnav,
body.pms-fixed .pagebar { flex: 0 0 auto; }
/* content를 세로 flex로: 탭/툴바는 제 높이만, 2열 그리드가 '남은' 높이를 차지 */
body.pms-fixed .content {
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
body.pms-fixed .content > .toolbar,
body.pms-fixed .content > .maker-tabs { flex: 0 0 auto; }
/* 2열 그리드가 탭/툴바를 뺀 잔여 높이를 꽉 채우게 (height:100%는 툴바를 무시해 하단이 잘렸음) */
body.pms-fixed .panel-2col { flex: 1 1 auto; min-height: 0; align-items: stretch; }

/* 좌/우 카드 모두 세로로 꽉 차고, 카드 본문이 내부 스크롤을 책임진다.
   min-width:0 필수 — 없으면 1fr 트랙이 nowrap 테이블 너비만큼 늘어나(기본 min-width:auto)
   컨테이너를 무시하고 tbl-wrap 가로 스크롤이 안 생긴다. */
body.pms-fixed .panel-2col > .card {
  display: flex; flex-direction: column; min-height: 0; max-height: 100%; min-width: 0;
}
body.pms-fixed .panel-2col > .card > .card-hd { flex: 0 0 auto; }

/* 좌 상세 패널: 본문이 100vh에 맞춰지고 넘치면 내부 스크롤(최후수단) */
body.pms-fixed .panel-2col > .form-card > .card-bd {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
}

/* 우 목록 패널: 카드 본문을 세로 플렉스로. 목록 테이블만 스크롤, 페이저는 하단 고정 */
body.pms-fixed .panel-2col > .card:not(.form-card) > .card-bd {
  flex: 1 1 auto; min-height: 0; min-width: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
body.pms-fixed .panel-2col > .card:not(.form-card) > .card-bd > .tbl-wrap {
  flex: 1 1 auto; min-height: 0; min-width: 0; overflow: auto;
}
/* 목록 헤더(th)는 스크롤돼도 상단 고정 (sticky는 기존 규칙 유지) */
body.pms-fixed .panel-2col > .card:not(.form-card) #pager { flex: 0 0 auto; }

/* 강조 카드: 좌 입력 폼 카드 헤더를 살짝 더 또렷하게 */
body.pms-fixed .form-card .card-hd { font-size: 15px; }

/* ----- 좌 패널 무스크롤 우선: 입고(stock) 폼 한정 여백 압축 (DESIGN.md 차분한 명료함 유지) ----- */
body.pms-stock .form-group { margin-bottom: 12px; }
body.pms-stock .form-group + .form-group { padding-top: 10px; }
body.pms-stock .form-group-hd { margin-bottom: 7px; }
body.pms-stock .form-row { margin-bottom: 9px; }
body.pms-stock .form-grid-2 { gap: 4px 12px; margin-bottom: 0; }
body.pms-stock .form-grid-3 { gap: 4px 10px; margin-bottom: 0; }
body.pms-stock #f_memo { min-height: 40px; }
body.pms-stock .form-row textarea { min-height: 40px; }
/* 규격 그리드 더 조밀하게 (전치 그리드: 가로 패딩 좁게 11컬럼이 좌패널에 들어가게) */
body.pms-stock table.qty-grid th,
body.pms-stock table.qty-grid td { padding: 3px 4px; }
body.pms-stock table.qty-grid input.qty-in { width: 35px; padding: 4px 5px; }
/* 하단 품목/검사 내역 구획 여백 압축 */
body.pms-stock .card-sub { margin-top: 10px; padding-top: 9px; }
body.pms-stock .card-sub-hd { margin-bottom: 6px; }

/* 폼 의미 그룹 구획: 소제목 + 점선 상단 구분선 (DESIGN.md Sub-block 규범) */
.form-group { margin-bottom: 18px; }
.form-group + .form-group { border-top: 1px dashed #e5e7eb; padding-top: 14px; }
.form-group-hd {
  font-size: 12px; font-weight: 600; color: #555; letter-spacing: .02em;
  margin-bottom: 10px; text-transform: none;
}
.form-group .form-row:last-child { margin-bottom: 0; }

/* 2열 배치 — 생산자 6역할(세로 6→3줄), 기본정보 일부 */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 12px; }
.form-grid-2 .form-row { margin-bottom: 0; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 12px; margin-bottom: 12px; }
.form-grid-3 .form-row { margin-bottom: 0; }

/* 목록 영역 로딩 표시 (과한 애니메이션 없이 텍스트) */
.list-loading { padding: 24px; text-align: center; color: #6b7280; font-size: 13px; }

table.qty-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.qty-grid th, table.qty-grid td { padding: 4px 8px; border-bottom: 1px solid #eee; text-align: center; }
table.qty-grid thead th { background: #f9fafb; color: #444; font-weight: 600; }
table.qty-grid tfoot th { background: #f3f4f6; font-weight: 700; }
table.qty-grid td.num, table.qty-grid th.num { text-align: right; }
table.qty-grid input.qty-in { width: 100%; padding: 5px 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; text-align: right; }
/* 규격별 수량 — 전치(가로=규격 5~15새, 세로=필/자) WinForm 스타일.
   세로로 짧고(헤더+2행) 가로로 넓다(좁으면 tbl-wrap 가로 스크롤). */
table.qty-grid-h th, table.qty-grid-h td { padding: 3px 4px; white-space: nowrap; }
table.qty-grid-h thead th { font-size: 12px; }
table.qty-grid-h th.qty-corner,
table.qty-grid-h th.qty-rowhd {
  background: #f9fafb; color: #444; font-weight: 600; text-align: left;
  position: sticky; left: 0; z-index: 1;
}
table.qty-grid-h input.qty-in { width: 44px; padding: 4px 5px; text-align: right; }
.qty-total-line { font-size: 12px; color: #555; margin-top: 6px; }
.qty-total-line strong { color: #222; }

.card-sub { margin-top: 16px; border-top: 1px dashed #e5e7eb; padding-top: 12px; }
.card-sub-hd { font-weight: 600; font-size: 13px; margin-bottom: 8px; }

/* ---------- 검사관리 ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-pending { background: #f3f4f6; color: #6b7280; }
.badge-partial { background: #fef3c7; color: #92400e; }
/* 검사여부 버튼 — 뱃지 색 유지 + 버튼처럼 보이게(테두리·라운드·입체감) */
.badge-btn {
  cursor: pointer; font: inherit; font-size: 11px; font-weight: 600;
  padding: 4px 12px; border-radius: 5px;
  border: 1px solid rgba(0,0,0,.18);
  box-shadow: 0 1px 1px rgba(0,0,0,.08);
  line-height: 1.3;
}
.badge-btn:hover { filter: brightness(0.96); }
.badge-btn:active { transform: translateY(1px); box-shadow: none; }

/* ── 범용 다이얼로그 (인라인 HTML 본문) ── */
.dialog-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(17,24,39,.55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.dialog-box {
  background: #fff; border-radius: 10px; overflow: hidden;
  width: 720px; max-width: 94vw; max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.dialog-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid #e5e7eb;
}
.dialog-bar .dialog-title { font-weight: 600; font-size: 14px; }
.dialog-bar .spacer { flex: 1; }
.dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 14px; }
/* 다이얼로그 인라인 검사 편집 */
table.qa-edit input.qa-in { border: 1px solid #ccc; border-radius: 4px; padding: 4px 6px; font-size: 12px; }
table.qa-edit input.qa-date { width: 130px; }
table.qa-edit input.qa-name { width: 78px; }
table.qa-edit input.qa-sid  { width: 90px; }
table.qa-edit input.qa-score { width: 44px; text-align: center; display: block; margin: 0 auto; }
table.qa-edit td, table.qa-edit th { padding: 5px 6px; vertical-align: middle; }
table.qa-edit .qa-grade { font-weight: 600; }
table.qa-edit input.qa-score { width: 56px; }
/* 다이얼로그 상단 공통 입력 + 하단 일괄저장 바 */
.qa-common { margin-bottom: 12px; }
.qa-common-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.qa-common-row label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #555; }
.qa-common-row input { border: 1px solid #ccc; border-radius: 6px; padding: 7px 8px; font-size: 13px; color: #222; }
.qa-common-row label.qa-common-memo { flex: 1 1 220px; }
.qa-common-row label.qa-common-memo input { width: 100%; box-sizing: border-box; }
.qa-common .hint { margin-top: 6px; font-size: 11px; color: #9ca3af; }
.qa-edit-bar { margin-top: 14px; display: flex; justify-content: flex-end; }
.qa-scores { display: flex; gap: 10px; flex-wrap: wrap; }
.qa-score { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.qa-score label { font-size: 11px; color: #555; }
.qa-score input.qa-num { width: 64px; padding: 5px 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; text-align: right; }
input[readonly] { background: #f9fafb; color: #444; }

/* ---------- 검사관리 워크리스트(단일 전폭 목록) ----------
   검사관리는 2열(panel-2col)이 아니라 단일 목록 카드가 100vh 셸의 잔여 높이를 채운다.
   목록 테이블만 내부 스크롤, 페이저는 하단 고정. (편집은 공용 다이얼로그로 분리됨) */
body.pms-qa.pms-fixed .content > .qa-list-card {
  flex: 1 1 auto; min-height: 0; min-width: 0;
  display: flex; flex-direction: column; max-height: 100%;
}
body.pms-qa.pms-fixed .qa-list-card > .card-hd { flex: 0 0 auto; }
body.pms-qa.pms-fixed .qa-list-card > .card-bd {
  flex: 1 1 auto; min-height: 0; min-width: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
body.pms-qa.pms-fixed .qa-list-card > .card-bd > .tbl-wrap {
  flex: 1 1 auto; min-height: 0; min-width: 0; overflow: auto;
}
body.pms-qa.pms-fixed .qa-list-card > .card-bd > #pager { flex: 0 0 auto; }
body.pms-qa .qa-list-card tbody tr[data-seq] { cursor: pointer; }
.qa-hint { font-weight: 400; }

/* ---------- QR코드 출력 ---------- */
.qr-layout { display: grid; grid-template-columns: 420px 1fr; gap: 18px; align-items: start; }
.qr-toggle { float: right; font-weight: 400; font-size: 12px; color: #555; }
.qr-toggle input { vertical-align: middle; margin-right: 4px; }

/* QR 화면 셸 미세조정 (body.pms-fixed + .panel-2col 공용 규칙 위에 덧입힘).
   QR은 좌=입고건 선택 목록(고정 폭), 우=라벨 출력. 좌는 600px이 과하므로 420px 유지.
   우 라벨 출력 카드는 form-card가 아니라 일반 .card → 공용 규칙상 .tbl-wrap만 스크롤하지만
   라벨 영역(.qr-labels-bd)이 직접 스크롤되도록 별도 지정. */
body.pms-fixed .qr-layout { grid-template-columns: 420px 1fr; }
/* 우 라벨 출력 카드 본문: 카드 본문이 곧 라벨 영역(.qr-labels-bd)이다.
   공용 .card:not(.form-card) > .card-bd 규칙(flex-direction:column; overflow:hidden)을
   되돌려, 라벨 타일이 가로로 wrap 되고 영역 자체가 세로 스크롤되게 한다. */
body.pms-fixed .qr-output-card > .card-bd.qr-labels-bd {
  flex: 1 1 auto; min-height: 0; min-width: 0;
  flex-direction: row; flex-wrap: wrap; align-content: flex-start;
  overflow-y: auto; overflow-x: hidden;
}

.qr-labels-bd { display: flex; flex-wrap: wrap; gap: 12px; align-content: flex-start; }
.qr-label {
  display: flex; gap: 10px; align-items: flex-start;
  width: 320px; padding: 10px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff;
}
.qr-label .qr-img {
  width: 96px; height: 96px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #f3f4f6; color: #9ca3af; font-size: 11px;
}
.qr-label .qr-img img { display: block; }
.qr-text { flex: 1; min-width: 0; font-size: 11px; line-height: 1.35; }
.qr-text .qr-head { font-weight: 700; font-size: 11px; }
.qr-text .qr-url { color: #2563eb; font-size: 10px; margin-bottom: 4px; }
.qr-text .qr-title { font-weight: 700; font-size: 12px; margin-bottom: 4px; }
table.qr-fields { width: 100%; border-collapse: collapse; }
table.qr-fields th, table.qr-fields td { padding: 1px 0; text-align: left; vertical-align: top; font-weight: 400; }
table.qr-fields th { width: 52px; color: #555; white-space: nowrap; }
table.qr-fields td { color: #222; word-break: break-all; }

/* 인쇄: 메뉴/툴바/선택영역 숨기고 라벨만 그리드로. 페이지 나눔 고려. */
@media print {
  html, body { background: #fff; }
  /* 100vh 셸(body.pms-fixed) 높이/오버플로 제약을 인쇄 시 모두 해제 — 라벨 전체가 출력되도록 */
  body.pms-fixed { overflow: visible !important; }
  body.pms-fixed .app { height: auto !important; display: block !important; overflow: visible !important; }
  body.pms-fixed .content { display: block !important; overflow: visible !important; min-height: 0 !important; }
  body.pms-fixed .panel-2col { display: block !important; }
  body.pms-fixed .qr-output-card,
  body.pms-fixed .qr-output-card > .card-bd.qr-labels-bd {
    display: block !important; overflow: visible !important; max-height: none !important; min-height: 0 !important;
  }
  .topnav, .pagebar, .toolbar, .no-print, .qr-output-card > .card-hd { display: none !important; }
  .app { display: block; }
  .main, .content { padding: 0; margin: 0; }
  .qr-layout { display: block; }
  .qr-layout > .card.no-print { display: none !important; }
  .qr-output-card { border: none; }
  .qr-labels-bd { display: block; padding: 0; }
  .qr-output-card > .card-bd.qr-labels-bd { display: flex !important; flex-wrap: wrap; gap: 6mm; }
  .qr-label { width: 80mm; border: 1px solid #000; padding: 3mm; page-break-inside: avoid; break-inside: avoid; }
  .qr-label .qr-img { background: #fff; }
}

/* ---------- 공용 페이저 ---------- */
/* 목록 카드 하단. 좌측 총건수/범위·페이지당 건수, 우측 번호 페이저.
   One Action Rule: 현재 페이지/이동만 블루, 그 외 중립 그레이. Flat-By-Default. */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid #e5e7eb;
}
.pager-info { display: flex; align-items: center; gap: 14px; font-size: 12px; color: #555; }
.pager-range { white-space: nowrap; }
.pager-size { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pager-size-sel {
  padding: 4px 6px; border: 1px solid #ccc; border-radius: 6px;
  font-size: 12px; font-family: inherit; color: #222; background: #fff;
}
.pager-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-btn {
  min-width: 30px; padding: 5px 8px; border: 1px solid #d1d5db; background: #fff;
  border-radius: 6px; font-size: 13px; color: #333; line-height: 1;
}
.pager-btn:hover:not(:disabled):not(.active) { background: #f3f4f6; }
.pager-btn:disabled { opacity: .45; cursor: not-allowed; }
.pager-btn.active {
  background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; cursor: default;
}
.pager-ellipsis { padding: 0 4px; color: #9ca3af; font-size: 13px; }

/* ---------- 입고목록 체크박스열 · 목록표출력 버튼 ---------- */
.card-hd-flex { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-hd-flex .btn { font-weight: 400; }
table.list th.chk-col, table.list td.chk-col { width: 34px; text-align: center; padding-left: 6px; padding-right: 6px; }
table.list td.chk-col input, table.list th.chk-col input { cursor: pointer; margin: 0; }

/* ---------- 인증서 미리보기 레이어 (HTML layer + iframe) ---------- */
.cert-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(17,24,39,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.cert-modal {
  background: #fff; border-radius: 10px; overflow: hidden;
  width: 900px; max-width: 96vw; height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.cert-modal-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid #e5e7eb; background: #fff;
}
.cert-modal-bar .cert-modal-title { font-weight: 600; font-size: 14px; }
.cert-modal-bar .spacer { flex: 1; }
.cert-frame { flex: 1 1 auto; width: 100%; border: 0; background: #f4f5f7; }
/* 부모(목록) 화면을 실수로 인쇄해도 오버레이는 출력 안 함 (인증서는 iframe에서 인쇄) */
@media print { .cert-overlay { display: none !important; } }

/* 토스트 */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 1000;
  background: #111827; color: #fff; padding: 11px 18px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.25); opacity: 0;
  transform: translateY(-10px); transition: all .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: #dc2626; }

/* 콤보박스(생산자 검색·선택) — 입력은 기존 .form-row input과 동일 룩 */
.combo-input {
  width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 6px;
  font-size: 13px; font-family: inherit; background: #fff; color: #222;
}
.combo-input::placeholder { color: #9ca3af; }
.combo-input:focus-visible { outline: 2px solid #3b82f6; outline-offset: 0; border-color: #3b82f6; }

/* 드롭다운 패널: body로 portal + position:fixed (좌 패널 overflow 클리핑 회피).
   z-index는 토스트(1000)·모달(1100)보다 아래의 의미적 스케일. */
.combo-panel {
  position: fixed; z-index: 900;
  background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  overflow-y: auto; overflow-x: hidden; padding: 4px;
}
.combo-item {
  padding: 7px 10px; border-radius: 4px; font-size: 13px; color: #222;
  cursor: pointer; white-space: nowrap;  /* 잘림 방지: 패널이 내용 폭에 맞게 확장 */
}
.combo-item:hover { background: #eff6ff; }
.combo-item.active { background: #2563eb; color: #fff; }  /* One Action Rule: 강조는 Action Blue, Flat */
.combo-empty { padding: 8px 10px; font-size: 12px; color: #9ca3af; }

/* 입고목록 "출력" 컬럼: 인증서 + 지원신청서 버튼 묶음 (한 셀 내 가로 배치) */
.list td.print-btns { white-space: nowrap; }
.list td.print-btns .btn { padding: 3px 8px; font-size: 12px; }
.list td.print-btns .btn + .btn { margin-left: 4px; }

/* ---------- 우상단 정보수정 다이얼로그 폼 ---------- */
.dialog-body .dlg-form .form-row:last-of-type { margin-bottom: 0; }
.dialog-body .dlg-form input[readonly] { background: #f3f4f6; color: #6b7280; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- 역할 게이팅: 서브관리자 쓰기 컨트롤 숨김 (이중 안전, 백엔드 403과 병행) ----------
   서브(role=sub)는 데이터(생산자·입고·검사·공예품)에 대해 목록·상세·인쇄만 가능.
   신규/저장/삭제(공통 id: btnNew/btnSave/btnDelete)와 검사 일괄저장(.qa-saveall-btn)을 숨긴다.
   조회·인쇄(조회 btnSearch, 목록표출력 btnReport, 인증서/지원신청서 cert-btn/subsidy-btn,
   입고목록 체크박스·QR 라벨 등)는 유지한다. */
body.pms-role-sub #btnNew,
body.pms-role-sub #btnSave,
body.pms-role-sub #btnDelete,
body.pms-role-sub .qa-saveall-btn {
  display: none !important;
}

/* ---------- 대시보드 ---------- */
/* 카드 사이 자연 간격. 셸/페이저 없음 — 자연 스크롤. */
.dash-section { margin-bottom: 16px; }
.dash-loading { padding: 28px; text-align: center; color: #9ca3af; font-size: 13px; }
.dash-error { color: #dc2626; font-size: 14px; margin: 0; }

/* A. KPI — 작은 카드 가로 묶음. 카드 중첩 금지: 흰 카드 본문 안에서 보더로 구획. */
.dash-kpis { display: flex; gap: 0; }
.dash-kpi {
  flex: 1 1 0; padding: 4px 20px;
  border-left: 1px solid #e5e7eb;
}
.dash-kpi:first-child { padding-left: 0; border-left: none; }
.dash-kpi-label { font-size: 12px; color: #555; margin-bottom: 6px; }
/* Weight-Not-Size: 수치 위계는 굵기·색으로. */
.dash-kpi-value { font-size: 28px; font-weight: 700; color: #222; line-height: 1.1; }
.dash-kpi-unit { font-size: 14px; font-weight: 400; color: #555; margin-left: 3px; }
.dash-kpi-sub { font-size: 12px; color: #555; margin-top: 6px; }

/* B. 미검사 알림 */
.dash-alert { display: flex; align-items: center; gap: 16px; }
.dash-alert-text { font-size: 15px; color: #222; }
.dash-alert-num { font-size: 20px; font-weight: 700; color: #dc2626; }
.dash-alert-ok .dash-alert-text { color: #166534; font-weight: 600; }

/* C. 최근 입고 — 기존 table.list 재사용. 행 클릭 이동. */

/* 년도별 통계 차트 — 헤더에 제목 + 바로 옆 연도 select, 본문 반응형 3그리드 */
.dash-charts-hd {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
}
.dash-year-select {
  font-size: 13px; padding: 4px 8px; line-height: 1.3;
  border: 1px solid #d1d5db; border-radius: 6px; background: #fff; color: #222;
  cursor: pointer; min-width: 84px;
}
.dash-year-select:focus { outline: none; border-color: #2563eb; }

/* 안동포통계: 2패널 그리드 + 최종생산자 필터 select + 기간 input 바 */
.stats-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.stats-maker-select { min-width: 220px; }
.stat-sum { font-size: 12px; font-weight: 600; color: #2563eb; margin-left: 6px; }
.stats-period { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stats-period input[type=date] { padding: 5px 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; }
.stats-period .hint { margin: 0; }
/* 생산자별 통계: 전폭 차트(생산자명 회전 라벨 잘림 방지 + 충분한 높이) */
/* .dash-chart-box(240px)가 뒤에 선언돼 우선순위 동률→나중규칙 승. 복합선택자로 명시적 override */
.dash-chart-box.stats-chart-wide { height: 440px; }

.dash-charts-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.dash-chart-cell { min-width: 0; }
.dash-chart-title {
  font-size: 12px; color: #555; font-weight: 600; margin-bottom: 6px;
}
.dash-chart-box { height: 240px; }
/* 좁은 화면 → 세로 스택 */
@media (max-width: 860px) {
  .dash-charts-grid { grid-template-columns: 1fr; }
}
/* billboard 기본 폰트를 앱 톤에 맞춤 */
.dash-chart-box .bb svg { font-size: 11px; }

/* D. 빠른 작업 — 액션 버튼 가로 묶음 */
.dash-quick { display: flex; gap: 8px; }
