/* 공정서 온라인 — 작업대형 화면
   바탕: 실리카겔 박층판처럼 차가운 흰색, 글자: 흑연색. 강조색은 공정서마다: 약전 = 시약 라벨 코발트, 생규집 = 생약 녹색
   (공정서를 바꾸면 앱 전체의 강조색이 바뀐다) */
:root {
  --ground: #eef1f4; --surface: #fff; --panel: #e3e8ed; --panel-2: #d6dde4;
  --ink: #17212b; --ink-2: #4a5664; --ink-3: #66717e; --line: #d3dae1; --line-2: #e6eaee;
  --add: #1c7a3e; --add-bg: #dff2e5; --del: #a8322a; --del-bg: #fbe4e0; --chg: #7d5300; --chg-bg: #fcefd2;
  --r-s: 6px; --r-m: 10px;
  --shadow-1: 0 1px 2px rgb(23 33 43 / .06), 0 2px 8px rgb(23 33 43 / .05);
  --shadow-2: 0 2px 4px rgb(23 33 43 / .08), 0 14px 36px rgb(23 33 43 / .16);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --bar-h: 56px; --rail-w: 84px;
  --font: "Pretendard Variable", Pretendard, -apple-system, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}
html[data-book="KP"] { --acc: #2350a0; --acc-2: #1a3d7c; --acc-soft: #e2e9f6; --acc-line: #b7c8e8; }
html[data-book="KHP"] { --acc: #1f6e46; --acc-2: #175536; --acc-soft: #dff0e6; --acc-line: #b2d8c2; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--ground); color: var(--ink); font-size: 14.5px; line-height: 1.6;
  word-break: keep-all; overflow-wrap: break-word; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
p, li, .doc-text, .cell-text { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; margin: 0; line-height: 1.3; letter-spacing: -.012em; }
h1 { font-size: 21px; font-weight: 700; } h2 { font-size: 16.5px; font-weight: 700; } h3 { font-size: 14.5px; font-weight: 650; }
a { color: var(--acc); text-underline-offset: 3px; text-decoration-thickness: 1px; }
::selection { background: var(--acc-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }
/* 스크롤바: 크롬·엣지는 13px, 홈(트랙)·위아래 화살표까지 다 보이게, 손잡이는 진한 회색. 파이어폭스는 폭을 고를 수 없어 기본 폭에 색만.
   크롬은 scrollbar-width·color를 주면 아래 ::-webkit-scrollbar를 무시하므로 그 둘은 파이어폭스에만 */
@supports (-moz-appearance: none) { * { scrollbar-color: #8f9aa6 #e7eaee; } }
::-webkit-scrollbar { width: 13px; height: 13px; }
::-webkit-scrollbar-track { background: #e7eaee; }
::-webkit-scrollbar-corner { background: #e7eaee; }
::-webkit-scrollbar-thumb { background: #8f9aa6; border-radius: 7px; border: 3px solid #e7eaee; }
::-webkit-scrollbar-thumb:hover { background: #6f7b88; }
::-webkit-scrollbar-thumb:active { background: #5a6572; }
::-webkit-scrollbar-button:single-button { display: block; width: 13px; height: 13px; background: #e7eaee no-repeat center / 7px 7px; }
::-webkit-scrollbar-button:single-button:hover { background-color: #d6dbe1; }
::-webkit-scrollbar-button:single-button:vertical:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M4 1.5 7.5 6.5h-7z' fill='%236f7b88'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:vertical:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M4 6.5 .5 1.5h7z' fill='%236f7b88'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1.5 4 6.5 .5v7z' fill='%236f7b88'/%3E%3C/svg%3E"); }
::-webkit-scrollbar-button:single-button:horizontal:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M6.5 4 1.5 .5v7z' fill='%236f7b88'/%3E%3C/svg%3E"); }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--ink-2); } .small { font-size: 13px; }

/* ── 틀: 왼쪽 세로 메뉴 + 오른쪽 작업대 */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; background: var(--ink); color: #c9d2db; display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; z-index: 30; }
.rail a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 12px; line-height: 1.2; transition: background .15s, color .15s; }
.rail a:hover { background: rgb(255 255 255 / .07); color: #fff; }
.rail a.on { background: var(--acc); color: #fff; }
.rail a .i { width: 22px; height: 22px; }
.rail .count { position: absolute; top: 4px; right: 12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.rail .count:empty { display: none; }
.rail-ext { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 8px; border-top: 1px solid rgb(255 255 255 / .12); }
/* 관련 사이트: 상자 대신 아이콘 둘레에만 밝은 테두리 */
.rail-ext a { font-size: 11px; text-align: center; padding: 7px 2px; }
.rail-ext img { outline: 1.5px solid rgb(255 255 255 / .5); outline-offset: 2px; }
.rail-ext a:hover img { outline-color: rgb(255 255 255 / .85); }
.rail-ext img { width: 24px; height: 24px; border-radius: 6px; background: #fff; object-fit: contain; }
@media (min-width: 861px) { .rail { overflow-y: auto; } }
@media (min-width: 861px) and (max-height: 880px) { .rail-ext span { display: none; } .rail-ext a { padding: 6px 2px; } } /* 화면이 낮으면 아이콘만 (이름은 마우스를 올리면) */

.stage { min-width: 0; display: flex; flex-direction: column; }
.bar { position: sticky; top: 0; z-index: 20; height: var(--bar-h); display: flex; align-items: center; gap: 12px; padding: 0 18px; background: rgb(238 241 244 / .94); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; }
.book-switch { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--panel); }
.book-switch button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: color .15s, background .2s; }
.book-switch button[aria-pressed="true"] { background: var(--surface); color: var(--acc); box-shadow: var(--shadow-1); }
/* 판 선택은 오른쪽 찾기 칸 바로 옆 (아래 본문 칸에 줄 맞추던 방식은 글꼴·스크롤바에 따라 어긋나서 그만둠) */
.bar-ed { display: flex; align-items: center; gap: 8px; min-width: 0; margin-left: auto; }
.finder { display: flex; align-items: center; gap: 8px; height: 32px; min-width: 260px; padding: 0 8px 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-3); font: inherit; font-size: 13.5px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.finder:hover { border-color: var(--acc-line); box-shadow: 0 0 0 3px var(--acc-soft); }
.finder span { flex: 1; text-align: left; }
kbd { font: 600 11px/1 var(--font); padding: 4px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--ground); color: var(--ink-2); }
main { flex: 1; padding: 18px; min-width: 0; outline: none; }
.foot { padding: 14px 18px 26px; color: var(--ink-3); font-size: 12.5px; border-top: 1px solid var(--line-2); }
.foot a { color: var(--ink-2); }
.statusbar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 4px 22px; padding: 5px 18px; background: var(--surface); border-top: 1px solid var(--line); color: var(--ink-2); font-size: 12px; }
.statusbar b { color: var(--ink); font-weight: 600; margin-right: 4px; }
.loading { color: var(--ink-3); }

/* ── 공통 부품 (같은 줄 버튼·입력칸: 높이 32px, 글씨 13.5px) */
.btn, select, input[type=search], input[type=text], input[type=number] { height: 32px; font: inherit; font-size: 13.5px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 0 10px; }
select { padding-right: 26px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5664' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 7px center / 14px; max-width: 100%; text-overflow: ellipsis; }
input:focus, select:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .1s; }
.btn:hover { border-color: var(--acc-line); background: var(--acc-soft); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.primary:hover { background: var(--acc-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel); }
.btn[aria-pressed="true"] { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }
.btn[aria-pressed="true"] .i { fill: currentColor; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn .i { width: 16px; height: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; background: var(--panel); color: var(--ink-2); white-space: nowrap; }
.tag.added, .tag.ok { background: var(--add-bg); color: var(--add); } .tag.removed, .tag.out { background: var(--del-bg); color: var(--del); } .tag.changed, .tag.low { background: var(--chg-bg); color: var(--chg); }
.tag.acc { background: var(--acc-soft); color: var(--acc); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.seg a:hover, .seg button:hover { border-color: var(--acc-line); color: var(--ink); }
.seg .on { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg .on:hover { color: #fff; }
.seg .n { font-size: 11.5px; opacity: .7; }
.seg.jpf { display: flex; flex-wrap: nowrap; gap: 2px; overflow-x: auto; scrollbar-width: none; } /* 일본 비교 거르기: 한 줄 (넘치면 옆으로) */
.seg.jpf a { padding: 0 6px; gap: 3px; flex: none; font-size: 12.5px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.pad { padding: 16px 18px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.head p { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }
.stack { display: grid; gap: 16px; }
.empty { padding: 28px 18px; color: var(--ink-2); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 7px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-2); }
th { font-weight: 600; color: var(--ink-2); background: var(--ground); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
th button { all: unset; cursor: pointer; } th button:hover { color: var(--acc); }
td.n, th.n { text-align: right; }
tbody tr { transition: background .12s; } tbody tr:hover td { background: #f6f8fa; }
.scroll-x { overflow-x: auto; }
mark { background: #fbe9a6; color: inherit; border-radius: 2px; padding: 0 1px; }

/* ── 열람: 목록 | 원문 두 칸 */
.desk { display: grid; grid-template-columns: minmax(270px, 330px) minmax(0, 1fr); gap: 16px; align-items: start; }
.shelf { position: sticky; top: calc(var(--bar-h) + 18px); height: calc(100vh - var(--bar-h) - 36px); display: flex; flex-direction: column; overflow: hidden; }
.shelf-top { padding: 12px; border-bottom: 1px solid var(--line-2); display: grid; gap: 8px; }
.shelf-top select, .shelf-top input { width: 100%; }
.shelf-top .row select { flex: 1; width: auto; min-width: 0; }
.shelf-list { overflow-y: auto; flex: 1; list-style: none; margin: 0; padding: 4px; }
.shelf-list a { display: block; padding: 7px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; transition: background .12s; }
.shelf-list a:hover { background: var(--ground); }
.shelf-list a.on { background: var(--acc-soft); }
.shelf-list a.on .nm { color: var(--acc); }
.shelf-list .nm { font-weight: 600; font-size: 14px; }
.shelf-list .sub { display: block; color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelf-count { padding: 6px 12px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line-2); }

.doc { min-width: 0; }
.doc.swap { animation: docIn .22s var(--ease); }
@keyframes docIn { from { opacity: 0; transform: translateY(6px); } }
.doc-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line-2); }
.doc-head h1 { font-size: 24px; }
.doc-head h1 .hanja { color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.doc-names { color: var(--ink-2); margin-top: 2px; }
.doc-tools { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.doc-body { display: grid; grid-template-columns: minmax(0, 1fr) 270px; }
.doc-main { padding: 6px 20px 20px; min-width: 0; }
.doc-side { border-left: 1px solid var(--line-2); padding: 16px; display: grid; gap: 20px; align-content: start; position: sticky; top: calc(var(--bar-h) + 18px); max-height: calc(100vh - var(--bar-h) - 36px); overflow-y: auto; }
.doc-side h3 { font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
/* 생약 대표사진 (국가생약정보): 품목명 머리 오른쪽에 작게, 누르면 확대창 */
/* 사진 높이 = 품목명 머리 글 칸 높이 (fitHerbPhoto가 맞춤, 너비는 4:3) */
.doc-head.has-photo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.herb-photo { margin: 0; height: 132px; aspect-ratio: 4 / 3; max-width: 30vw; }
.herb-photo a { display: block; height: 100%; overflow: hidden; border-radius: 8px; }
.herb-photo img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); transition: transform .2s var(--ease); }
@media (max-width: 560px) { .herb-photo { height: auto !important; width: 112px; } } /* 휴대폰: 글 칸이 길어 높이 맞춤 대신 작은 4:3 */
.herb-photo a:hover img { transform: scale(1.03); }
.herb-photo a { cursor: zoom-in; }
dialog.zoom { border: 0; padding: 12px; border-radius: 12px; background: var(--surface); max-width: min(92vw, 900px); max-height: 92vh; cursor: zoom-out; text-align: center; animation: palIn .2s var(--ease); }
dialog.zoom::backdrop { background: rgb(15 20 26 / .6); }
dialog.zoom img { display: block; max-width: 100%; max-height: calc(92vh - 110px); margin: 0 auto; border-radius: 8px; }
dialog.zoom p { margin: 8px 0; font-size: 13px; color: var(--ink-2); text-align: left; text-wrap: pretty; }
/* 확대창 맨 아래: 출처(왼쪽)와 닫기(오른쪽) */
.zoom-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--ink-3); }
.herb-photo figcaption { margin-top: 4px; font-size: 11.5px; color: var(--ink-3); }
.toc { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.toc a { display: block; padding: 4px 8px; border-radius: 6px; color: var(--ink-2); font-size: 13px; text-decoration: none; transition: background .12s, color .12s; }
.toc a:hover { background: var(--ground); color: var(--ink); }
.toc a.on { background: var(--acc-soft); color: var(--acc); font-weight: 600; }
.sec { padding: 16px 0 10px; border-bottom: 1px solid var(--line-2); scroll-margin-top: calc(var(--bar-h) + 12px); }
.sec:last-child { border-bottom: 0; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; min-height: 26px; }
.sec-h h3 { color: var(--acc); }
.sec-h .btn { height: 26px; padding: 0 8px; font-size: 12px; opacity: 0; transition: opacity .15s, background .15s; }
.sec:hover .sec-h .btn, .sec-h .btn:focus-visible { opacity: 1; }
.doc-text { white-space: pre-wrap; font-size: 15px; line-height: 1.8; }
.std-mark { text-decoration: underline 2px; text-underline-offset: 4px; cursor: help; }
.std-mark.ok { text-decoration-color: #7cc196; } .std-mark.low { text-decoration-color: #e0b44f; } .std-mark.out { text-decoration-color: #e08a80; }
.refs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.refs li { display: grid; gap: 3px; padding: 8px 10px; border-radius: 8px; background: var(--ground); font-size: 13px; }
.refs .r-top { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.refs .r-for { color: var(--ink-3); font-size: 12px; }

/* 품목 변천 (판마다 한 칸) */
.timeline { display: flex; gap: 3px; align-items: flex-end; flex-wrap: wrap; }
.timeline a { width: 13px; height: 24px; border-radius: 3px; display: block; transition: transform .15s var(--ease); transform-origin: bottom; }
.timeline a:hover { transform: scaleY(1.2); }
.timeline .first, .timeline .same { background: var(--panel-2); } .timeline .absent { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.timeline .added { background: var(--add); } .timeline .changed { background: #d39b23; } .timeline .removed { background: var(--del); }
.timeline .cur { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.tl-note { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }

/* ── 빈 화면(처음): 최근·즐겨찾기·개정 */
.welcome { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.quick { list-style: none; margin: 0; padding: 0; }
.quick li a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none; }
.quick li a:hover .nm { color: var(--acc); }
.quick .sub { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; flex: none; }
.quick .nm { min-width: 0; overflow-wrap: anywhere; } /* 띄어쓰기 없는 긴 품목명도 칸 안에서 줄바꿈 */
/* 휴대폰에서만 보이는 'PC 권장' 안내 */
.pc-tip { display: none; margin: 8px 0 0; padding: 7px 10px; border-radius: 8px; background: var(--line-2); font-size: 12.5px; color: var(--ink-2, var(--ink)); text-wrap: pretty; }
@media (max-width: 860px) { .pc-tip { display: block; } }
/* 실시간 인기 품목: 순위 숫자 + 이름 + 오르내림 */
.trend li a { justify-content: flex-start; align-items: baseline; }
.trend .nm { flex: 1; }
.trend .rk { flex: none; width: 20px; font-weight: 700; color: var(--acc); font-variant-numeric: tabular-nums; }
.trend li:nth-child(n+4) .rk { color: var(--ink-3); font-weight: 600; }
.trend .mv { flex: none; font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.trend .mv.up, .trend .mv.new { color: #c0392b; }
.trend .mv.down { color: #2463b4; }
.trend .mv.new { font-weight: 700; font-size: 10.5px; }

/* ── 조건 검색 */
.builder { display: grid; gap: 8px; }
.cond { display: grid; grid-template-columns: 170px 140px minmax(0, 1fr) 32px; gap: 8px; align-items: center; animation: condIn .2s var(--ease); }
@keyframes condIn { from { opacity: 0; transform: translateY(-4px); } }
.cond .vals { display: flex; gap: 6px; align-items: center; }
.cond .vals input { width: 100%; min-width: 0; }
.cond .btn.ghost { width: 32px; justify-content: center; padding: 0; }
.result-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.big-n { font-size: 22px; font-weight: 700; color: var(--acc); margin-right: 4px; }
td .cell-text { color: var(--ink-2); font-size: 12.5px; max-width: 46ch; display: block; }
td .val { font-weight: 700; }
td input[type=checkbox] { accent-color: var(--acc); width: 16px; height: 16px; }

/* ── 비교 */
.cmp { overflow-x: auto; }
.cmp-grid { display: grid; min-width: max-content; }
.cmp-grid > div { padding: 10px 12px; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); min-width: 0; }
.cmp-grid .rh { position: sticky; left: 0; background: var(--ground); font-weight: 600; color: var(--ink-2); font-size: 13px; z-index: 1; }
.cmp-grid .ch { background: var(--surface); }
.cmp-grid .ch h2 { font-size: 15.5px; }
.cmp-grid .ch .row { margin-top: 6px; }
.cell-text { white-space: pre-wrap; font-size: 13.5px; line-height: 1.65; }
.cell-text.clip { display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.cell-miss { color: var(--ink-3); font-size: 13px; }
.cmp-row .cell-miss, .jprow .cell-miss { display: block; padding: 10px 12px; border: 1px dashed #c9b79a; border-radius: 6px; color: var(--chg); font-weight: 600; text-align: center; background: repeating-linear-gradient(135deg, #fffaf0 0 7px, #f6ead2 7px 8px); }
.cmp-row.solo > .only { box-shadow: inset 3px 0 0 #d39b23; background: #fffaf0; }
a.xref.rg { color: #0d7468; text-decoration: underline 1.5px dotted #0d7468; text-underline-offset: 3px; } /* 시약·시액: 다른 링크(파랑)와 구분되는 청록 */
a.xref.rg:hover { background: #e0f3ef; text-decoration-style: solid; }
.cell-val { display: inline-block; font-weight: 700; margin-bottom: 4px; padding: 0 6px; border-radius: 4px; background: var(--ground); }
.cell-val.hi { background: var(--del-bg); color: var(--del); } .cell-val.lo { background: var(--add-bg); color: var(--add); }
.fly { position: fixed; z-index: 100; pointer-events: none; padding: 4px 10px; border-radius: 14px; background: var(--acc); color: #fff; font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow-2); white-space: nowrap; }
.bump { animation: bump .45s var(--ease); }
@keyframes bump { 40% { transform: scale(1.4); } }

/* ── 매트릭스 */
.mx-wrap { overflow: auto; max-height: calc(100vh - var(--bar-h) - 170px); border-top: 1px solid var(--line-2); }
.mx { border-collapse: separate; border-spacing: 0; font-size: 12.5px; width: 100%; } /* 남는 폭은 항목 칸이 나눠 가짐 */
.mx th, .mx td { padding: 0; border-bottom: 1px solid var(--line-2); }
.mx thead th { position: sticky; top: 0; z-index: 3; background: var(--surface); vertical-align: bottom; }
.mx thead th.it { writing-mode: vertical-rl; padding: 8px 0 6px; width: 26px; min-width: 26px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.mx thead th.it:hover, .mx thead th.it.on { color: var(--acc); background: var(--acc-soft); }
.mx thead th .cnt { writing-mode: horizontal-tb; display: block; font-size: 10.5px; color: var(--ink-3); margin: 4px auto 0; text-align: center; font-weight: 500; }
.mx th.nm, .mx td.nm { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; padding: 4px 10px; width: 250px; min-width: 200px; max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line); vertical-align: middle; }
.mx thead th.nm { z-index: 4; vertical-align: bottom; padding-bottom: 8px; }
.mx td.nm a { color: var(--ink); text-decoration: none; } .mx td.nm a:hover { color: var(--acc); }
.mx td.c { width: 26px; height: 26px; text-align: center; vertical-align: middle; }
.mx td.c i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--acc); vertical-align: middle; }
.mx td.c.ch { background: var(--chg-bg); } .mx td.c.ch i { background: #c48a12; }
.mx td.c.col { background: var(--acc-soft); }
.mx tr.added td.nm, .mx tr.added td.nm a { color: var(--add); font-weight: 600; }
.mx tbody tr:hover td { background: #f3f6f9; } .mx tbody tr:hover td.nm { background: var(--acc-soft); }
.mx-legend { display: flex; gap: 14px; align-items: center; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.mx-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--acc); margin-right: 5px; vertical-align: -1px; }
.mx-legend i.ch { background: #c48a12; } .mx-legend i.add { background: var(--add); border-radius: 2px; }

/* ── 개정: 판 이력 막대 + 목록 | 신구 대비 */
.history { display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; padding: 14px 16px 10px; }
.history a { flex: none; width: 56px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink-2); text-decoration: none; font-size: 11.5px; border-radius: 7px; padding: 6px 0 4px; transition: background .15s; }
.history a:hover { background: var(--ground); }
.history a.on { background: var(--acc-soft); color: var(--acc); font-weight: 700; }
.history .col { width: 18px; height: 96px; display: flex; flex-direction: column-reverse; border-radius: 3px; overflow: hidden; background: var(--line-2); }
.history .col span { display: block; transform-origin: bottom; animation: rise .5s var(--ease) both; }
.history .col .a { background: var(--add); } .history .col .c { background: #d39b23; } .history .col .r { background: var(--del); }
.history .whole { font-size: 10.5px; color: var(--acc); font-weight: 700; height: 14px; }
@keyframes rise { from { transform: scaleY(0); } }
.pair { display: grid; grid-template-columns: minmax(300px, 410px) minmax(0, 1fr); gap: 16px; align-items: start; }
.chlist { position: sticky; top: calc(var(--bar-h) + 18px); max-height: calc(100vh - var(--bar-h) - 36px); overflow-y: auto; }
.chlist a { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 7px 12px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.chlist a:hover { background: var(--ground); } .chlist a.on { background: var(--acc-soft); color: var(--acc); font-weight: 600; }
.chlist .tags { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.chlist .tags .tag { height: 19px; font-size: 11px; padding: 0 6px; }
.chlist .filter { padding: 10px 12px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.chlist .filter select { width: 100%; }
.part-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line-2); border-top: 1px solid var(--line-2); border-radius: 0 0 var(--r-m) var(--r-m); overflow: hidden; }
.part-sum a { background: var(--surface); padding: 10px 14px; color: var(--ink); text-decoration: none; display: grid; gap: 4px; transition: background .12s; }
.part-sum a:hover { background: var(--ground); } .part-sum a.on { background: var(--acc-soft); }
.part-sum .t { font-size: 12.5px; color: var(--ink-2); }
.part-sum .ns { display: flex; gap: 8px; font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.part-sum .ns .a { color: var(--add); } .part-sum .ns .r { color: var(--del); } .part-sum .ns .c { color: var(--chg); }
.diff ins { background: var(--add-bg); color: var(--add); text-decoration: none; border-radius: 3px; animation: settleAdd 1.2s var(--ease) both; }
.diff del { background: var(--del-bg); color: var(--del); border-radius: 3px; animation: settleDel 1.2s var(--ease) both; }
@keyframes settleAdd { from { background: #93d6a8; } }
@keyframes settleDel { from { background: #f1aa9f; } }

/* ── 통계 */
.kpis { display: flex; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.kpi { padding: 14px 20px; border-right: 1px solid var(--line-2); }
.kpi b { display: block; font-size: 24px; color: var(--acc); line-height: 1.2; }
.kpi span { font-size: 12.5px; color: var(--ink-2); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid2 > .panel h2 { margin-bottom: 10px; }
.bars { display: grid; gap: 2px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 36%) 1fr 84px; gap: 8px; align-items: center; padding: 3px 6px; border-radius: 6px; font-size: 13px; cursor: pointer; border: 0; background: none; font: inherit; text-align: left; color: inherit; width: 100%; }
.bar-row:hover, .bar-row.on { background: var(--ground); }
.bar-row .track { display: block; height: 12px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
/* 막대가 자라는 모습이 눈에 보이게: --ease(.16,1,.3,1)는 0.2초 안에 거의 다 자라 안 보여서 완만한 곡선으로 0.9초 */
.bar-row .fill { display: block; height: 100%; background: var(--acc); transform-origin: left; animation: grow .9s cubic-bezier(.33, 1, .68, 1) both; }
@keyframes grow { from { transform: scaleX(0); } }
.bar-row .v { text-align: right; white-space: nowrap; font-size: 12.5px; }
.bar-row .v small { color: var(--ink-3); margin-left: 4px; }
.names-box { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--ground); font-size: 13px; max-height: 220px; overflow: auto; }
.names-box .row { margin-bottom: 6px; }
.names-box a { margin-right: 10px; white-space: nowrap; }
.up { color: var(--add); } .down { color: var(--del); }

/* ── 바로가기 검색(Ctrl+K) */
.palette { border: 0; padding: 0; background: transparent; width: min(640px, calc(100vw - 32px)); margin: 12vh auto auto; }
.palette::backdrop { background: rgb(23 33 43 / .38); }
.palette[open] .palette-box { animation: palIn .2s var(--ease); }
@keyframes palIn { from { opacity: 0; transform: translateY(-8px) scale(.985); } }
.palette-box { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-2); overflow: hidden; }
.palette-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line-2); color: var(--ink-3); }
.palette-in input[type=search] { flex: 1; height: 54px; border: 0; font-size: 16px; outline: none; box-shadow: none; padding: 0; background: transparent; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette-list .grp { padding: 8px 10px 4px; font-size: 12px; color: var(--ink-3); }
.palette-list .opt { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.palette-list .opt[aria-selected="true"] { background: var(--acc-soft); }
.palette-list .opt .nm { font-weight: 600; } .palette-list .opt .sub { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-hint { margin: 0; padding: 8px 14px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line-2); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; padding: 9px 16px; border-radius: 9px; background: var(--ink); color: #fff; font-size: 13.5px; box-shadow: var(--shadow-2); pointer-events: none; transition: opacity .2s, transform .25s var(--ease); z-index: 200; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* 공정서 전환: 버튼 자리에서 새 색이 원으로 번진다 (View Transitions) */
::view-transition-old(root) { animation: none; }
::view-transition-new(root) { animation: bookSweep .6s var(--ease); }
@keyframes bookSweep { from { clip-path: circle(0 at var(--vx, 50%) var(--vy, 0)); } to { clip-path: circle(160% at var(--vx, 50%) var(--vy, 0)); } }

/* ── 좁은 화면: 메뉴는 아래, 한 칸씩 */
@media (max-width: 1180px) { .doc-body { grid-template-columns: 1fr; } .doc-side { position: static; max-height: none; border-left: 0; border-top: 1px solid var(--line-2); } }
@media (max-width: 860px) {
  :root { --rail-w: 0px; --bar-h: 52px; }
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); overflow-x: auto; }
  .rail a { flex: 1 0 50px; padding: 6px 2px; font-size: 11px; }
  .rail .count { right: 4px; }
  .rail-ext { display: none; } /* 휴대폰 아래 메뉴는 자리가 좁아 관련 사이트는 뺀다 */
  .stage { padding-bottom: 64px; }
  .bar { padding: 0 12px; gap: 8px; }
  .brand span, .finder span, .finder kbd { display: none; }
  .finder { min-width: 0; width: 36px; justify-content: center; padding: 0; margin-left: 0; }
  .bar-ed { flex: 1; } .bar-ed select { width: 100%; }
  main { padding: 12px; }
  .desk, .pair { grid-template-columns: 1fr; }
  .shelf, .chlist { position: static; height: auto; max-height: 60vh; }
  .desk.reading .shelf, .pair.reading .chlist { display: none; }
  .cond { grid-template-columns: 1fr 1fr 32px; } .cond .vals { grid-column: 1 / -1; grid-row: 2; }
  .doc-head, .doc-main { padding-left: 14px; padding-right: 14px; }
  .doc-head h1 { font-size: 21px; }
  .grid2 { grid-template-columns: 1fr; }
  .kpi { padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ── 원문 줄: 항목 번호 단계마다 들여쓰기, 번호가 있는 줄은 내어쓰기(줄이 넘어가면 번호 뒤에 맞춤) */
.doc-text { white-space: normal; }
.doc-text .ln { white-space: pre-wrap; padding-left: var(--in, 0); }
.doc-text .ln.mk { padding-left: calc(var(--in, 0em) + var(--mw)); text-indent: calc(-1 * var(--mw)); }
.doc-text .ln.mk > .m { display: inline-block; min-width: var(--mw); text-indent: 0; }
.doc-text .ln + .ln { margin-top: .15em; }
/* 수식: 분수는 위아래로, 아래·위첨자가 함께 붙으면 겹친다 ([α]²⁰_D) */
.eq { white-space: nowrap; font-family: "Cambria Math", "Times New Roman", var(--font); font-size: 1.04em; }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 .18em; text-indent: 0; line-height: 1.25; }
.frac > .num { padding: 0 .25em .05em; }
.frac > .den { padding: .05em .25em 0; border-top: 1px solid currentColor; }
.ss { display: inline-flex; flex-direction: column; vertical-align: -.45em; line-height: 1; font-size: .74em; margin-left: .05em; }
.ss sup, .ss sub { font-size: 1em; vertical-align: baseline; }
sub, sup { font-size: .74em; line-height: 0; }
.eq-sq { border-top: 1px solid currentColor; padding: 0 .1em; }
/* 본문 링크와 미리보기 */
a.xref { color: var(--acc); text-decoration: underline 1px dotted; text-underline-offset: 3px; }
a.xref:hover { text-decoration-style: solid; background: var(--acc-soft); border-radius: 2px; }
.peek { position: fixed; z-index: 150; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow-2); max-height: min(60vh, 460px); display: flex; flex-direction: column; animation: peekIn .16s var(--ease); }
@keyframes peekIn { from { opacity: 0; transform: translateY(-4px); } }
.peek-h { padding: 10px 14px 8px; border-bottom: 1px solid var(--line-2); }
.peek-b { padding: 6px 14px 8px; overflow: auto; font-size: 13.5px; line-height: 1.65; }
.peek-b h4 { margin: 8px 0 2px; font-size: 12.5px; color: var(--acc); }
.peek-f { display: flex; gap: 6px; padding: 8px 14px 10px; border-top: 1px solid var(--line-2); }
.prods { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.prods a { color: var(--ink); text-decoration: none; } .prods a:hover { color: var(--acc); }
.prods .sub { color: var(--ink-3); font-size: 12px; }

/* 전부개정 판 표시 */
.history a.full .col { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--acc); }
.history .whole { white-space: nowrap; letter-spacing: -.02em; }
.history a.full .yr { color: var(--acc); font-weight: 700; }
.tag.full { background: var(--acc); color: #fff; height: 20px; font-size: 11.5px; }
.full-note { margin: 0; padding: 8px 16px; background: var(--acc-soft); color: var(--ink); font-size: 13px; border-top: 1px solid var(--line-2); }
.timeline a.full { position: relative; }
.timeline a.full::before { content: ''; position: absolute; left: 3px; right: 3px; top: -6px; height: 3px; border-radius: 2px; background: var(--acc); }
.legend .full-i { background: var(--acc); height: 3px; vertical-align: 2px; }

/* 표준품 링크: 분양 중인 생약표준품(재고 확인 사이트로)은 상태색 밑줄, 찾는 이름 강조 */
a.std-mark { color: inherit; text-decoration: underline 2px; text-underline-offset: 4px; }
a.std-mark.ok { text-decoration-color: #5cb37c; } a.std-mark.low { text-decoration-color: #e0b44f; } a.std-mark.out { text-decoration-color: #e08a80; }
a.std-mark:hover { background: var(--add-bg); border-radius: 2px; }
mark.hl { background: #fbe9a6; }
mark.hl.flash, .ln.flash { animation: hlFlash 1.6s var(--ease) 2; }
/* 한반도 아이콘: 글자 높이에 맞춘 초록 실루엣 */
.ko-icon { height: 1.2em; width: auto; flex: none; fill: #3f8f5f; stroke: #2d6e47; stroke-width: .5; stroke-linejoin: round; }
/* 시험항목 머리의 시험법 링크: 제목 모양은 그대로, 점선 밑줄로만 */
.sec-h h3 a.xref { color: inherit; text-decoration: underline dotted var(--acc); text-underline-offset: 4px; }
.sec-h h3 a.xref:hover { color: var(--acc); }
/* 생약시험법 세부 시험으로 들어왔을 때 그 부분 */
.ln.sub-hl { background: #fdf6df; box-shadow: -6px 0 0 #fdf6df, 6px 0 0 #fdf6df; }
@keyframes hlFlash { 50% { background: #f5c842; box-shadow: 0 0 0 3px #f5c84255; } }

/* 계정 */
.btn.acct { flex: none; max-width: 160px; }
.btn.acct span { overflow: hidden; text-overflow: ellipsis; }
.btn.acct.on { color: var(--acc); border-color: var(--acc-line); }
.acct-box { width: min(440px, calc(100vw - 32px)); }
.acct-box input[type=text], .acct-box input[type=password] { width: 100%; height: 36px; font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: var(--r-s); padding: 0 10px; }
.acct-box input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.mx thead th .cnt { margin: 0 auto 4px; }
@media (max-width: 860px) { .btn.acct span { display: none; } .btn.acct { width: 36px; justify-content: center; padding: 0; } }

/* 조건 검색: 한 줄 배치, 같은 크기 */
.qbox { padding: 12px 14px; display: grid; gap: 8px; }
.qbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qbar select { width: auto; }
.qbar #runQ { margin-left: auto; }
.cond { grid-template-columns: 44px 190px 120px minmax(0, 1fr) 32px; }
.cond .join { font-size: 12.5px; color: var(--ink-3); text-align: right; }
.cond select, .cond input { width: 100%; min-width: 0; }
.cond input:disabled { background: var(--ground); }
.btn.sq { width: 32px; justify-content: center; padding: 0; }
.presets { align-items: center; }
/* 예시 조건: 조건 만들기 단추와 구분되게 연한 강조색 바탕 */
.presets button { height: 28px; font-size: 12.5px; background: var(--acc-soft); border-color: transparent; color: var(--acc); }
.presets button:hover { border-color: var(--acc); color: var(--acc); }
.presets .pre-lab { font-size: 12.5px; color: var(--ink-3); margin-right: 2px; }
@media (max-width: 860px) { .cond { grid-template-columns: 1fr 1fr 32px; } .cond .join { display: none; } .cond .vals { grid-column: 1 / -1; grid-row: 2; } .qbar #runQ { margin-left: 0; } }

/* 일본 비교: 항목마다 세 칸 (항목 | 우리 | 일본), 기준값이 다르면 노란 바탕 */
.jpcmp { display: grid; }
.jprow { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--line-2); }
.jprow > div { padding: 10px 12px; min-width: 0; }
.jprow > div + div { border-left: 1px solid var(--line-2); }
.jprow.head > div { font-weight: 700; color: var(--ink-2); background: var(--ground); font-size: 13px; }
.jprow .h { font-weight: 600; color: var(--acc); display: grid; gap: 2px; align-content: start; }
.jprow .vals { font-size: 12.5px; color: var(--ink); font-weight: 400; }
.jprow.differ .h { background: var(--chg-bg); }
.jprow .doc-text { font-size: 13.5px; line-height: 1.7; }
@media (max-width: 860px) { .jprow { grid-template-columns: 1fr; } .jprow > div + div { border-left: 0; border-top: 1px dashed var(--line-2); } .jprow.head { display: none; } }
.peek-h { position: relative; padding-right: 44px; }
.peek-x { position: absolute; top: 6px; right: 6px; }

/* 비교 두 칸: 화면 폭 안에서 (항목 | 왼쪽 | 오른쪽) */
.cmp2 { display: grid; overflow: hidden; }
.cmp-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--line-2); }
.cmp-row:first-child { border-top: 0; }
.cmp-row > div { padding: 10px 12px; min-width: 0; overflow-wrap: anywhere; }
.cmp-row > div + div { border-left: 1px solid var(--line-2); }
.cmp-row.head { background: var(--ground); position: sticky; top: var(--bar-h); z-index: 2; }
.cmp-row .rh { font-weight: 600; color: var(--acc); font-size: 13px; display: grid; gap: 2px; align-content: start; }
.cmp-row .vals { color: var(--ink); font-weight: 400; font-size: 12px; }
.cmp-row.differ .rh, .cmp-row.changed .rh { background: var(--chg-bg); }
/* 비교 칸 머리: 품목명과 비우기(×) 단추를 한 줄에 (이름이 길면 이름만 줄바꿈) */
.cmp-h .spread { display: flex; align-items: flex-start; gap: 4px; }
.cmp-h .spread h2 { min-width: 0; overflow-wrap: anywhere; }
.cmp-h .spread .btn { flex: none; margin-top: -4px; }
.cmp-h h2 { font-size: 15.5px; }
.cmp-h .row { margin-top: 6px; }
.cmp-h select { max-width: 100%; }
.empty-col { display: grid; gap: 8px; align-content: start; }
@media (max-width: 860px) { .cmp-row { grid-template-columns: 1fr 1fr; } .cmp-row .rh { grid-column: 1 / -1; padding-bottom: 0; } .cmp-row > div + div { border-left: 0; } .cmp-row > div:last-child { border-left: 1px solid var(--line-2); } }
/* 좁은 화면: 판 선택은 둘째 줄에서 아래 내용 칸과 같은 왼쪽·오른쪽 선에 맞춘다 */
@media (max-width: 860px) {
  :root { --bar-h: 90px; }
  .bar { height: auto; flex-wrap: wrap; row-gap: 6px; padding-top: 8px; padding-bottom: 8px; }
  .bar .finder { margin-left: auto; }
  .bar-ed { order: 10; flex: 1 0 100%; margin-left: 0; }
  .bar-ed:empty { display: none; }
  .bar-ed select { width: 100%; max-width: none; }
}

/* 조건 검색: 범위·묶기·조건·단추를 한 흐름으로 (넓으면 한 줄, 좁으면 두 줄) */
.qbox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qbox > select { flex: 0 1 auto; width: auto; }
.qbox .builder { display: contents; }
.qbox .cond { display: flex; gap: 6px; align-items: center; flex: 1 1 460px; min-width: 0; animation: condIn .2s var(--ease); }
.qbox .cond > select[data-f="h"] { flex: 0 1 170px; min-width: 110px; }
.qbox .cond > select[data-f="op"] { flex: 0 1 120px; min-width: 96px; }
.qbox .cond .vals { flex: 1 1 140px; display: flex; gap: 6px; min-width: 0; }
.qbox .cond .join { flex: none; font-size: 12.5px; color: var(--ink-3); }
.qbox .presets { flex: 1 0 100%; }
@media (max-width: 860px) { .qbox .cond { flex-basis: 100%; flex-wrap: wrap; } .qbox .cond .vals { flex-basis: 100%; order: 5; } }
/* 비교: 머리줄은 고정하지 않는다 (내용 첫 줄을 가리지 않게), 오른쪽 다른 낱말 음영 */
.cmp-row.head { position: static; }
.cmp2 { overflow: visible; }
mark.dif { background: #fde7a6; color: inherit; border-radius: 2px; padding: 0 1px; }
.btn.swap { width: 100%; justify-content: center; }
/* 매트릭스 머리칸: 숫자는 가로로 맨 위 한 줄, 항목 이름은 그 아래 세로로 */
.mx thead th.it { writing-mode: horizontal-tb; text-align: center; padding: 6px 0; vertical-align: top; }
.mx thead th.it .cnt { display: block; margin: 0 0 4px; font-size: 10.5px; }
.mx thead th.it .vt { display: inline-block; writing-mode: vertical-rl; white-space: nowrap; letter-spacing: -.02em; }
/* 열람 목록 ㄱㄴㄷ·ABC 바로가기 */
.jump { display: flex; flex-wrap: wrap; gap: 2px; }
.jump { gap: 3px; }
.jump button { min-width: 24px; height: 24px; padding: 0 4px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink-2); font: inherit; font-size: 12px; cursor: pointer; }
.jump button:hover:not(:disabled) { background: var(--acc-soft); color: var(--acc); border-color: var(--acc); }
.jump button.on { background: var(--acc); color: #fff; border-color: var(--acc); }
.jump button:disabled { color: var(--line); border-color: var(--line-2); background: transparent; cursor: default; }
/* 신구 대비: 변경 전·변경 후 상자 */
.ba { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 4px 0 6px; }
.ba-box { border-radius: 8px; padding: 8px 10px; font-size: 13.5px; line-height: 1.7; min-width: 0; }
.ba-box > b { display: block; font-size: 12px; margin-bottom: 4px; }
.ba-box.old { background: #fdf1ef; border: 1px solid #f1c7c1; } .ba-box.old > b { color: var(--del); }
.ba-box.new { background: #eef8f1; border: 1px solid #bfe1ca; } .ba-box.new > b { color: var(--add); }
.ba-box mark.dif { background: #9fdcb2; } .ba-box mark.dif.old { background: #f3b3a9; text-decoration: line-through; text-decoration-color: #a8322a88; }
.peek .ba { gap: 6px; } /* 개정 팝업: 개정 전·후를 좌우로 (좁은 화면은 아래 860px 규칙으로 위아래) */
@media (max-width: 860px) { .ba { grid-template-columns: 1fr; } }

.peek[hidden] { display: none; } /* display:flex가 hidden을 덮지 않게 */

/* 팝업에서 옮겨 온 화면의 이전 단추 */
.backbtn { margin-bottom: 10px; }
.backbtn .muted { font-weight: 400; }
/* 매트릭스 거르기: 시험항목 이름 × (여러 개) */
.mx-chip { gap: 4px; padding: 0 8px 0 10px; }
.mx-chip .i { width: 14px; height: 14px; color: var(--ink-3); }
.mx-chip:hover .i { color: var(--ink); }
/* 통째로 신설·삭제된 시험항목은 낱말 음영 없이 (상자 색으로 구분) */
.ba-box.whole mark { background: none; color: inherit; text-decoration: none; }
/* 본문 표·그림 (hwpx 원문 그대로) */
.doc-text .tbl-wrap { overflow-x: auto; margin: 6px 0 10px; }
.doc-text table.dtbl { border-collapse: collapse; font-size: 13.5px; line-height: 1.55; min-width: 40%; }
.doc-text table.dtbl td { border: 1px solid var(--line); padding: 4px 8px; vertical-align: middle; }
.doc-text table.dtbl td .ln { white-space: normal; }
.doc-text table.dtbl td .ln + .ln { margin-top: 0; }
.doc-text img.fig { max-width: 100%; height: auto; vertical-align: middle; margin: 4px 0; background: #fff; }
.fig-miss { color: var(--ink-3); font-size: 12.5px; }
/* 같은 그래프를 다시 그릴 때는 애니메이션 없이 */
.still .col span, .still .fill { animation: none !important; }
.mono-hdr .doc-text { font-size: 13.5px; color: var(--ink-2); }
.mono-hdr img.fig { display: block; margin: 0 0 6px; }
/* 일본 공정서 기계 번역 (브라우저 안) */
.jp-tr { margin-top: 8px; padding: 8px 10px; border-radius: var(--r-s, 6px); background: var(--surface-2, #f3f5f7); color: var(--ink-2); font-size: 13.5px; }
.jp-tr b { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.btn[hidden] { display: none; }
/* 통계 묶음 고르기 */
.stat-tabs { margin: 0 0 16px; flex-wrap: wrap; }
.stat-tabs .cnt { font-size: 12px; color: var(--ink-3); }

/* 관리자 화면 */
/* 관리자: 위 두 표가 화면 폭을 반씩 채우고(넓으면 표 안에서 옆으로 밀기), 기록은 전체 폭. 좁으면 한 줄에 하나 */
.adm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.adm-grid > * { min-width: 0; }
.adm-grid .adm-wide { grid-column: 1 / -1; }
.adm-grid .tbl-wrap { overflow-x: auto; }
@media (max-width: 1100px) { .adm-grid { grid-template-columns: minmax(0, 1fr); } }
table.adm th:last-child, table.adm td:last-child { width: 100%; } /* 앞 칸은 내용만큼, 남는 폭은 마지막 칸에 */
.adm-grid h3 { margin: 0 0 10px; font-size: 15px; }
table.adm { width: 100%; border-collapse: collapse; font-size: 13px; }
table.adm th, table.adm td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; white-space: nowrap; }
table.adm td.small { white-space: normal; }
table.adm th { color: var(--ink-3); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
table.adm td.n { text-align: right; font-variant-numeric: tabular-nums; }
table.adm tr.bad td { color: var(--del); }
@media (max-width: 860px) { .statusbar { position: static; } } /* 휴대폰: 아래 메뉴가 화면 밑에 붙어 있어 바는 본문 끝에 */

/* 제형별 요건: 고르는 줄 + archify 트리 그림 */
.fm-tree { padding: 12px 16px; }
.fm-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.fm-bar select { height: 32px; font-size: 13.5px; max-width: 100%; }
.fm-hits { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 8px; }
.fm-hits a.tag { text-decoration: none; }
.fm-frame { display: block; width: 100%; height: max(560px, calc(100vh - 250px)); border: 1px solid var(--line); border-radius: 8px; background: #0f1218; }
.fm-note { margin: 8px 0 0; }
@media (max-width: 560px) { .fm-tree { padding: 10px; } .fm-bar select { flex: 1 1 100%; } .fm-frame { height: 78vh; } }
