/* 비고는 모든 면에서 같은 폭으로 고정하고 업체~색의 자리(50% - 비고 폭)만 교체한다. 서류 13종도 이 안에서 폭을 나눈다.
   사장님 11-27 "반응형으로 비고를 조금 좁힘" — 가로 이동바를 위한 표 최소 폭 추가 안은 쓰지 않는다.
   설계 창 크롬 실측: 비고 15%면 화면 1024·1080px에서 타견적 머리가 두 줄로 접혀 머리 62.5 → 76.9px, 아래 표가 14.3px 밀렸다.
   1120px부터는 밀림이 없었지만, 비고 12%는 1024·1080·1120·1150·1179·1200px 모두 네 면의 머리 62.5px·표 높이·비고 위치/폭이 같았다.
   1280px은 넓은 화면과 같은 15%로 남기려고 1279px에서 끊는다. 폰의 기존 84em 최소 폭·결제일 13%·색 5%는 그대로다. */
table.bs-table { table-layout: fixed; --bs-note-w: 15%; }
@media (max-width: 1279px) { table.bs-table { --bs-note-w: 12%; } }
/* 폰은 표를 옆으로 밀어서 본다(사장님 11-10). 1쪽 결제일 칸(표 폭의 13%)에 날짜가 한 줄로 들어가야 면마다 줄 높이가 같다 —
   84em = 폰 글꼴(.72rem)에서 968px → 날짜가 쓸 폭 83~86px > 날짜 글자 69px(11-10 실측 크롬·웹킷, 여유 14~17px. 900px 이면 여유 5~8px).
   글자 단위라 브라우저 글자 크기를 키워도 표 폭이 날짜와 같은 비율로 커진다.
   ~~화면 폭에 맞춰 줄이기(min-width: 0, 10-17)~~는 1쪽만 날짜가 글자마다 접혀 표가 면마다 수천 px 달라졌고 회전 때 아래 표가 튀었다.
   공용 예산서 표(bv-tbl)의 폰 최소 폭 620px 은 오른쪽 네 면이 없던 때의 값이라 이 표에는 좁다(날짜가 두 줄). */
@media (max-width: 760px) { table.bs-table { min-width: 84em; } }
/* 서류 머리는 구분의 '전체' 체크 한 줄만 쓴다(11-26). 머리 높이는 기존 값으로 유지해
   각 면과 직원 화면의 표 위치를 바꾸지 않는다. ~~긴 이름은 자연스럽게 더 높아진다(11-26).~~ → 11-27 폐기:
   1024px의 타견적 머리 안 폭 55.8px에 맥 한글 55.4px가 0.4px 차로 한 줄이었다. 맥보다 넓은 리눅스·윈도 한글이나
   글자 간격 .04em만으로 두 줄이 되면 머리 62.55 → 76.86px(+14.31px)로 아래 표가 밀린다(PR #2057 CI).
   서류 13종을 모두 고르면 머리는 1440px에서 86.6px, 1024·390px에서 101.2px로 24~39px 밀렸다(설계 창 실측).
   그래서 2·3·4쪽 머리는 정한 높이(--bs-head-h) 안의 상자 하나에 담고 이름은 두 줄 줄임표·전체 이름은 title로 보인다.
   단추·체크는 줄이지 않고 이름만 줄인다. 상자의 10px는 칸의 위아래 padding 4+4px와 테두리 1+1px 여유이며,
   세로 clip은 브라우저 최소 글자 크기 같은 예외에서도 머리가 커지지 않게 하는 마지막 벽이다.
   앞면(1쪽 업체·결제일·색, app-main.js)은 넓은 칸의 짧은 고정 이름이라 이 상자를 쓰지 않는다. */
table.bs-table[data-bs-settle] {
  --bs-doc-head-font: .7rem;
  --bs-doc-head-lh: 1.3;
  --bs-head-h: calc(var(--bs-doc-head-font) * var(--bs-doc-head-lh) + 48px);
}
table.bs-table[data-bs-settle] thead tr { height: var(--bs-head-h); }
table.bs-table[data-bs-settle] .bs-head {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0;
  max-height: calc(var(--bs-head-h) - 10px); overflow-x: visible; overflow-y: clip;
}
table.bs-table[data-bs-settle] .bs-head-label {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  line-height: 1.2; max-width: 100%; min-height: 0; flex: 0 1 auto; overflow-wrap: anywhere;
}
.bs-col-group { width: 8%; }
.bs-col-name { width: 18%; }
.bs-col-price { width: 8%; }
.bs-col-qty { width: 5%; }
.bs-col-total { width: 11%; }
.bs-col-note { width: var(--bs-note-w); }
.bs-col-right { width: calc((50% - var(--bs-note-w)) / var(--bs-cols)); }
table.bs-table[data-bs-face="0"] col:nth-child(7) { width: calc(32% - var(--bs-note-w)); }
table.bs-table[data-bs-face="0"] col:nth-child(8) { width: 13%; }
table.bs-table[data-bs-face="0"] col:nth-child(9) { width: 5%; }
/* 내용편집의 추가 줄도 같은 행 높이 규칙을 쓴다. 왼쪽 단추·오른쪽 빈 칸이 모든 면에서 같고,
   구분 rowspan만 이 줄을 포함한다. 묶음 소계 rowspan에는 실제 항목만 들어간다. */
table.bs-table tbody td { height: 42px; }
table.bs-table :is(.bv-note-cell, .bv-note-head, [data-bs-right]) { padding: 4px; }
/* 구분 첫 줄(sg-start)은 예산서 공용 규칙이 칸 위 여백을 12px 로 늘린다. 오른쪽(회전하는) 칸은 면마다 내용 높이가 달라
   (1쪽 비고 25px · 2·3쪽 조작칸 30px) 늘린 여백이 면마다 다른 줄 높이(42.5/47.5px)를 만들었다 — 위 표가 구분 경계마다 5px씩
   면마다 길이가 달라져 아래 표가 회전 중 위아래로 어긋났다(11-10 부여). 위아래 합은 다른 줄과 같은 8px 로 두고 왼쪽 칸과 같은
   3px 만 아래로 치우친다. 고정 비고도 같은 여백을 유지하고, 같은 폭의 비고를 재서 모든 면에 같은 줄 높이를 둔다(app-main.js). */
table.bs-table tr.sg-start > :is(.bv-note-cell, [data-bs-right]) { padding-top: 7px; padding-bottom: 1px; }
table.bs-table .bv-name-row { min-width: 0; }
table.bs-table .bv-name-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.bs-table tbody tr { height: var(--bv-note-row-height, auto); }
table.bs-table .bv-note-cell { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
/* 측정 표는 실제 표의 글꼴·열 비율·칸 여백을 그대로 쓰고, 화면 배치에는 참여하지 않는다. */
table.bv-note-measure { position: fixed; top: 0; left: 0; visibility: hidden; pointer-events: none; }
.bv-note-font-probe { position: fixed; top: 0; left: 0; width: max-content; height: auto; white-space: pre; visibility: hidden; pointer-events: none; }
.bv-note-font-probe::before { content: "가나다Mg012"; }
table.bs-table .bs-cell { text-align: center; }
.bs-cell > input[type="text"], .bs-cell > select, .bs-place > input, .bs-place > select {
  width: 100%; min-width: 0; max-width: 100%; height: 30px; padding: 3px;
  border: 1px solid var(--border); border-radius: 4px; box-sizing: border-box;
  background: var(--card-bg); color: var(--text-primary); font: inherit;
}
.bs-cell input:focus, .bs-cell select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.bs-cell input[type="checkbox"], .bs-doc-head input[type="checkbox"], .bs-doc-menu input[type="checkbox"] {
  width: min(14px, 100%); max-width: 100%; height: 14px; min-width: 0; margin: 0; vertical-align: middle; cursor: pointer; accent-color: var(--accent);
}
table.bs-table[data-bs-face="3"] td.bs-cell { padding-inline: 1px; }
.bs-check-hit { display: flex; align-items: center; justify-content: center; min-width: 0; width: 100%; min-height: 30px; cursor: pointer; }
.bs-doc-head input[type="checkbox"] { flex: 0 1 14px; }
.bs-place { display: flex; min-width: 0; }
.bs-place > input { flex: 1; border-radius: 4px 0 0 4px; }
.bs-place > select { flex: 0 0 20px; padding: 0; border-left: 0; border-radius: 0 4px 4px 0; }
.bs-add, .bs-count, .bs-dates, .bs-random, .bs-delete, .bs-modal-head > button {
  border: 1px solid var(--border); border-radius: 4px; background: var(--card-bg);
  color: var(--text-primary); font: inherit; padding: 3px 5px; cursor: pointer;
}
.bs-add, .bs-dates { max-width: 100%; white-space: nowrap; }
.bs-add { font-size: .75rem; }
.bs-attach-tools { display: flex; align-items: center; gap: 4px; min-width: 0; }
.bs-attach-tools > .bs-add { flex: 0 1 auto; min-width: 0; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.bs-deck { display: flex; align-items: center; justify-content: flex-start; flex: 1 1 0;
  min-width: 0; height: 30px; padding: 0; overflow: hidden; border: 0; background: transparent; color: var(--text-secondary); }
.bs-deck:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bs-thumb-strip { display: flex; align-items: center; flex: 0 1 auto; min-width: 0; overflow: hidden; }
.bs-thumb { position: relative; flex: 0 0 28px; width: 28px; height: 28px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 4px; background: var(--card-bg); z-index: calc(4 - var(--i)); }
.bs-thumb + .bs-thumb { margin-left: -20px; }
.bs-thumb.att-tip, .bs-attachment .att-tip { cursor: zoom-in; }
.bs-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 3px; }
.bs-deck-count { flex: 0 0 auto; padding-left: 3px; font-size: .65rem; white-space: nowrap; }
.bs-random { display: block; margin: 0; padding: 1px 4px; font-size: .7rem; line-height: 1.2; flex: none; white-space: nowrap; }
.bs-delete { color: var(--danger-text); }
.bs-muted { color: var(--text-secondary); font-size: .78rem; }
.bs-block-heading { padding-inline: 8px; box-sizing: border-box; display: flex; align-items: flex-start; gap: 8px; flex-wrap: nowrap; }
.bs-block-heading > span { flex: 1 1 auto; min-width: 0; align-self: center; }
.bs-toolbar { display: flex; align-items: flex-start; gap: 8px; flex: 0 1 auto; min-width: 0; margin-left: auto; }
.bs-toolbar-fold { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; min-width: 0; }
/* 회전 버튼은 허용 면 내내 한 자리 — 면 번호마다 글자 폭이 달라 왼쪽 끝이 흔들리지 않게 최소 폭.
   tabular-nums 만으로는 부족하다(한글 글꼴은 숫자 폭 맞춤이 안 먹어 크롬 실측 1.7px 차). */
.bs-rotate { flex: none; min-width: 7em; font-variant-numeric: tabular-nums; }
.bs-toolbar .btn-mid, .bs-principal .btn-mid { display: inline-flex; align-items: center; justify-content: center; height: 32px; box-sizing: border-box; margin: 0; padding: 5px 10px; font: inherit; font-size: .8rem; line-height: 20px; white-space: nowrap; }
.bs-save-status { font-size: .75rem; color: var(--text-secondary); }
.bs-doc-picker { position: relative; }
.bs-doc-picker > summary { cursor: pointer; list-style: none; }
.bs-doc-picker > summary::-webkit-details-marker { display: none; }
.bs-doc-picker > summary::after { content: "▾"; margin-left: 6px; }
.bs-doc-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 100;
  width: max-content; max-width: calc(100vw - 32px); max-height: 50vh; overflow-y: auto;
  display: grid; gap: 2px; padding: 8px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--card-bg); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.bs-doc-menu label { display: flex; align-items: center; gap: 8px; padding: 5px; cursor: pointer; font-size: .8rem; }
.bs-doc-menu label:hover { background: var(--surface-muted); }
.bs-doc-menu .bs-doc-all { border-bottom: 1px solid var(--border); padding-bottom: 8px; font-weight: 600; }
table.bs-table th.bs-doc-head { padding: 4px 1px; vertical-align: bottom; }
table.bs-table[data-bs-settle] .bs-doc-head .bs-head { gap: 8px; }
table.bs-table[data-bs-settle] .bs-doc-head .bs-head-label { font-size: var(--bs-doc-head-font); line-height: var(--bs-doc-head-lh); }
/* 세로 flex의 가운데 정렬에서도 '전체' label을 칸 폭으로 늘려 좁은 서류 칸 안에서 글자가 줄어들게 한다. */
.bs-doc-head .bs-head > label { display: flex; align-self: stretch; align-items: center; justify-content: center; gap: 2px; margin-top: 0; flex: none; cursor: pointer; min-width: 0; }
.bs-doc-head small { font-size: .6rem; line-height: 1.2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-output { display: contents; }
.bs-hidden-count { text-align: right; }
/* 정산주체는 예산서 공통이다. 구분선 글자가 위로 올라가며 남긴 자리와 첫 제목 앞의 기존 여백 안에
   띄워 두어, 출력 면이 하나라도 나타나거나 사라질 때 아래 제목·표의 흐름 좌표는 바뀌지 않는다.
   폰도 같은 한 줄을 쓰고 긴 주체 이름의 선택칸만 줄인다. 테마 색은 기존 토큰을 그대로 따른다. */
.bs-principal { position: absolute; top: calc(100% - 10px); right: 0; max-width: 100%; height: 32px;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-weight: 400; }
.bs-principal[hidden] { display: none; }
.bs-principal > label { min-width: 0; display: flex; align-items: center; gap: 6px; font-size: .85rem; white-space: nowrap; }
.bs-principal > button { flex: none; }
.bs-principal select { min-width: 0; max-width: 220px; height: 32px; box-sizing: border-box; background: var(--card-bg); color: var(--text-primary); border: 1px solid var(--border); border-radius: 4px; padding: 5px; }
.bs-turning [data-bs-right] { visibility: hidden; }
/* 회전 장면 = 오른쪽 열이 지금 보이는 창, 기둥 = 그 뒤의 오른쪽 열 덩어리.
   ~~원근 없이(정사영) 돌면 위아래 변이 늘 수평이라 표·확대마다 같은 모양이고 소실점 계산도 없다~~(11-10 cf6a2621)는
   경계만 가운데를 지나는 느낌이라 폐기(사장님 11-26 q-130: 슈퍼 기둥·직원 카드 둘 다 입체로).
   ~~원근 1600px 고정(10-17)~~ 은 표 폭·확대 비율마다 세기가 달랐고 모서리는 폭의 약 0.21배 표 밖으로 튀어나왔다
   (사장님 11-10 "여전히 좀 비틀어지는 느낌…확대축소 할때도 좀 다르고"). rotationScene 이 장면에 원근 = 기둥 폭의 3배,
   소실점 = 가로 기둥 축·세로 보이는 부분의 가운데를 두고 반지름만큼 뒤로 밀어 처음·끝 크기와 위아래 대칭을 지킨다.
   기둥 모서리가 창 밖(돌지 않는 왼쪽 칸·표 바깥)으로 나오지 않게 창에서 자르고, 내용 층(z-index 1)에
   그린다 — ~~z-index 90~~ 은 표가 붙박이 도구줄 밑으로 스크롤돼 있을 때 도는 면이 도구줄을 덮었다. */
.bs-scene { position: absolute; z-index: 1; overflow: hidden; pointer-events: none; }
.bs-prism { position: absolute; top: 0; height: 100%; transform-style: preserve-3d; }
.bs-prism-face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; background: var(--card-bg); }
.bs-prism-front { transform: translateZ(var(--bs-depth)); }
.bs-prism-next { transform: rotateY(var(--bs-angle)) translateZ(var(--bs-depth)); }
.bs-dialog { width: min(700px, calc(100vw - 24px)); max-width: calc(100vw - 24px); display: flex; flex-direction: column; }
.bs-dialog-wide { width: min(1180px, calc(100vw - 24px)); }
.bs-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 0 14px; border-bottom: 1px solid var(--border); }
.bs-modal-head h3 { margin: 0; font-size: 1rem; }
.bs-modal-head > button { font-size: 1.2rem; }
.bs-modal-body { padding: 16px 0; overflow: auto; min-height: 0; max-height: 72vh; }
.bs-modal-body section { margin-bottom: 16px; }
.bs-modal-body h4 { margin: 0 0 8px; font-size: .9rem; }
.bs-date-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.bs-date-fields label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; }
.bs-date-fields input, .bs-note-label textarea { background: var(--card-bg); color: var(--text-primary); border: 1px solid var(--border); border-radius: 4px; padding: 6px; font: inherit; }
.bs-date-fields input.bs-manual-date { border-color: var(--accent); }
.bs-note-label { display: grid; gap: 6px; font-size: .85rem; }
.bs-attachment-list { display: flex; flex-wrap: wrap; gap: 8px; }
.bs-attachment { display: flex; align-items: center; gap: 6px; max-width: 100%; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 4px; padding: 5px; }
.bs-attachment img { width: 40px; height: 40px; object-fit: cover; display: block; }
.bs-attachment a { color: var(--text-primary); font-size: .8rem; overflow-wrap: anywhere; }
.bs-original-download { color: var(--text-secondary); font-size: .75rem; font-weight: 400; margin-left: 6px; }
.bs-misc-bundle { border: 1px solid var(--border); border-radius: 4px; padding: 8px; margin-bottom: 8px; }
.bs-misc-bundle > label { font-size: .85rem; margin-right: 8px; }
.bs-misc-bundle .bs-attachment-list { margin-top: 8px; }
.bs-frame { width: 100%; height: 68vh; border: 0; background: var(--card-bg); }
.bs-blank-links { display: flex; flex-wrap: wrap; gap: 8px; }
.bs-finding { font-size: .85rem; margin: 6px 0; }
.bs-error { color: var(--danger-text); }
