/* 결산 묶음(정산 대사 · 월 마감 · 신고 패키지 · 내 양식 · 원가 가져오기 · 연 결산 · 결산 규칙 · 리포트) 화면 서식 — 시안 테마(2026-11-05, 2단계).
 * html.rail-pre 안에서만 일한다(서버가 레일 터넌트 화면에만 단다) — 다른 인스턴스는 계산 스타일이 그대로다.
 * 값은 tokens.css 토큰, 부품은 rail.css 의 wk-*. 여기서는 이 화면들의 마크업(구역·표·단추)을 그 부품 모양으로 맞추는 규칙만 둔다.
 *   ① 한 화면 틀 풀기 — 구역마다 따로 스크롤하던 것(잘려 보이지 않던 아래 내용)을 작업 영역 하나의 스크롤로
 *   ② 점검 12항목 = 타임라인(완료 파랑 ✓ · 막힘 빨강 ✕ · 사유 등록 주황 !)
 *   ③ 표 = 카드 안의 표(머리글 옅은 바탕 · 행 높이 · 선 옅게) · 주 단추는 하단 바 하나(구역 안의 주 단추는 보조 모양) */

/* ── ① 한 화면 틀 풀기 ── */
html.rail-pre #cwork > .panel:not(#head) { flex: 0 0 auto; overflow: visible; }
html.rail-pre #cwork > #head { flex: 0 0 auto; min-height: 0; overflow: visible; }
html.rail-pre #cwork > #annualPanel, html.rail-pre #cwork > #extPanel { flex: 0 0 auto !important; }
html.rail-pre #cwork > .cl-low { flex: 0 0 auto; min-height: 0; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; gap: var(--dense-gap); }
html.rail-pre #cwork .cl-low > .panel { overflow: visible; }
html.rail-pre .cl-low thead th, html.rail-pre #cwork .tablebox thead th { position: static; }
@media (max-width: 1100px) { html.rail-pre #cwork > .cl-low { grid-template-columns: minmax(0, 1fr); } html.rail-pre .cl-low > #calPanel, html.rail-pre .cl-low > #histPanel, html.rail-pre .cl-low > #snapPanel { grid-column: 1; grid-row: auto; } }

/* 하단 작업 바 — 좁은 화면(레일 없음)에서도 화면 아래에 붙어 있다 */
@media (max-width: 1100px) { html.rail-pre main.wk > .wk-bar { position: sticky; bottom: 0; z-index: 5; margin: 0; } }
html.rail-pre main.wk > .wk-bar .wk-bar-s:empty { display: none; }
.wk-bar > #msg, .wk-bar > #rlMsg { flex: 1 1 auto; min-width: 0; font-size: 13.5px; }
.wk-bar > .wk-bar-s { flex: 1 1 auto; }

/* ── 입력·단추 ── */
html.rail-pre #cwork :is(input[type="month"], input[type="date"]), html.rail-pre .wk-top :is(input[type="month"], input[type="date"]), html.rail-pre .f :is(input[type="date"]) { height: 40px; padding: 0 14px; border-radius: 999px; }
html.rail-pre :is(#cwork, .wk-top, .f) .toolbar > label, html.rail-pre .f > label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--sub); font-size: 13px; }
html.rail-pre :is(#cwork, .wk-top) .btn.primary, html.rail-pre .f .btn.primary { border-color: var(--brand); background: var(--card); color: var(--brand-dark); }
html.rail-pre :is(#cwork, .wk-top) .btn.primary:hover, html.rail-pre .f .btn.primary:hover { background: var(--brand-soft); color: var(--brand-dark); }
html.rail-pre #cwork .btn.tiny { min-height: 30px; padding: 0 12px; border-radius: 999px; }
html.rail-pre .wk-bar .btn.primary { border-color: var(--brand); background: var(--brand); color: #fff; }
html.rail-pre .wk-bar .btn.primary:hover { border-color: var(--brand-dark); background: var(--brand-dark); color: #fff; }
html.rail-pre .wk-bar .btn.primary:disabled { opacity: .5; cursor: not-allowed; }
html.rail-pre .wk-bar .btn.outline { background: var(--card); }
html.rail-pre .wk-bar a.btn { text-decoration: none; display: inline-flex; align-items: center; }
html.rail-pre #cwork .toolbar { gap: 10px; margin-bottom: 14px; }
html.rail-pre #cwork .panel > h3 { margin: 18px 0 8px !important; padding-top: 14px; border-top: 1px solid var(--line); font-size: 15px !important; font-weight: 800; }
html.rail-pre #cwork .an-cap { padding-top: 0; border-top: 0; }
html.rail-pre #cwork div[style*="overflow:auto"]:has(> table:empty) { display: none; }

/* 안내 상자 — 테두리 없는 옅은 면(okbox · cautionbox · warnbox 는 이 화면 파일에 서식이 없었다) */
html.rail-pre #cwork :is(.okbox, .cautionbox, .warnbox) { margin: 8px 0; padding: 12px 16px; border: 0; border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.7; }
html.rail-pre #cwork .okbox { background: var(--ok-bg); color: var(--ink); }
html.rail-pre #cwork .okbox > b:first-child { color: var(--ok); }
html.rail-pre #cwork .cautionbox { background: var(--warn-bg); color: var(--warn); }
html.rail-pre #cwork .warnbox { background: var(--danger-bg); color: var(--danger); }
html.rail-pre #cwork #rpReady > .warnbox { background: var(--warn-bg); color: var(--ink); }
html.rail-pre #rpReady > div > div { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
html.rail-pre #rpMissing > .warnbox { background: var(--warn-bg); color: var(--ink); }
html.rail-pre #cwork .bad { color: var(--danger); }

/* ── ② 월 마감: 지표 띠 · 점검 12항목 타임라인 ── */
html.rail-pre #head > .wk-kpi { margin: 0 0 16px; }
html.rail-pre #head .toolbar { margin-bottom: 14px; }
html.rail-pre #cwork #head.closed { border-color: var(--ok-line); background: var(--card); }
html.rail-pre #blockers { max-height: none; overflow: visible; margin: 6px 0 0; }
html.rail-pre #blockers > details { --tl: var(--line-strong); position: relative; margin: 0; padding: 0 0 18px 46px; background: linear-gradient(var(--tl), var(--tl)) no-repeat 13px 32px / 2px calc(100% - 34px); overflow-x: auto; }
html.rail-pre #blockers > details:last-child { background: none; padding-bottom: 4px; }
html.rail-pre #blockers > details:has(> summary .light.ok) { --tl: var(--brand); }
html.rail-pre #blockers > details > summary { position: relative; display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 14.5px; font-weight: 700; color: var(--ink); cursor: pointer; list-style: none; }
html.rail-pre #blockers > details > summary::-webkit-details-marker { display: none; }
html.rail-pre #blockers > details > summary::after { content: '›'; margin-left: auto; color: var(--faint); font-size: 22px; line-height: 1; transition: transform .12s; }
html.rail-pre #blockers > details[open] > summary::after { transform: rotate(90deg); }
html.rail-pre #blockers > details > summary .light { position: absolute; left: -46px; top: 0; z-index: 1; display: grid; place-items: center; box-sizing: border-box; width: 28px; height: 28px; margin: 0; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--card); color: #fff; font-size: 14px; font-weight: 800; }
html.rail-pre #blockers > details > summary .light::before { content: ''; }
html.rail-pre #blockers .light.ok { border-color: var(--brand); background: var(--brand); }
html.rail-pre #blockers .light.ok::before { content: '✓'; }
html.rail-pre #blockers .light.ng { border-color: var(--danger); background: var(--danger); }
html.rail-pre #blockers .light.ng::before { content: '✕'; }
html.rail-pre #blockers .light.wv { border-color: var(--warn); background: var(--warn); }
html.rail-pre #blockers .light.wv::before { content: '!'; }
/* 항목 안의 줄 — 표를 카드 안 행으로(글이 길면 줄바꿈, 가로로 넘치지 않는다) */
html.rail-pre #blockers > details > table, html.rail-pre #blockers > details > table > tbody { display: block; width: auto; min-width: 0; }
html.rail-pre #blockers > details > table { margin: 10px 0 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); overflow: hidden; }
html.rail-pre #cwork #blockers tr { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.3fr); align-items: center; gap: 4px 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
html.rail-pre #cwork #blockers tr:last-child { border-bottom: 0; }
html.rail-pre #cwork #blockers tr:hover { background: var(--bg); }
html.rail-pre #cwork #blockers tr:hover > td { background: none; }
html.rail-pre #cwork #blockers td { display: block; padding: 0; border: 0; white-space: normal; overflow: visible; text-overflow: clip; min-width: 0; font-size: 13.5px; }
html.rail-pre #cwork #blockers td { background: none; }
html.rail-pre #cwork #blockers td.waive .wk-fl > span { display: none; }
html.rail-pre #cwork #blockers td.waive { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
html.rail-pre #cwork #blockers td.waive input { flex: 1 1 180px; width: auto; min-width: 0; height: 36px; }
html.rail-pre #cwork #blockers td:only-child { grid-column: 1 / -1; }
@media (max-width: 760px) { html.rail-pre #cwork #blockers tr { grid-template-columns: minmax(0, 1fr); } }
html.rail-pre #notDue { margin-top: 6px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg); }
html.rail-pre #notDue > summary { cursor: pointer; font-size: 13.5px; font-weight: 700; }

/* ── ③ 표 — 카드 안의 표 ── */
html.rail-pre #cwork div[style*="overflow:auto"], html.rail-pre #cwork .cl-low > .panel > table, html.rail-pre .wk-pane > div[style*="overflow:auto"], html.rail-pre .wk-work > .panel > div[style*="overflow:auto"] { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
html.rail-pre #cwork table :is(th, td), html.rail-pre .wk-work > .panel table :is(th, td) { padding: 12px 12px; border-bottom: 1px solid var(--line); }
html.rail-pre #cwork table th, html.rail-pre .wk-work > .panel table th { background: var(--bg); color: var(--sub); font-size: 12.5px; font-weight: 700; }
html.rail-pre #cwork table tbody tr:hover > td { background: var(--bg); }
html.rail-pre #cwork table tbody tr:last-child > td, html.rail-pre #cwork table tfoot tr:last-child > :is(td, th) { border-bottom: 0; }
html.rail-pre #cwork table td:first-child:not(.num) { font-weight: 700; }
html.rail-pre #cwork tfoot :is(th, td) { background: var(--brand-soft); color: var(--ink); font-weight: 800; }
html.rail-pre #cwork .num.neg, html.rail-pre #cwork td.neg { color: var(--danger); }
html.rail-pre #cwork .muted { color: var(--sub); }
html.rail-pre #cwork .chip.ok::before, html.rail-pre #cwork .chip.warn::before, html.rail-pre #cwork .chip.bad::before { content: none; }
html.rail-pre #cwork td.ok { color: var(--ok); font-weight: 700; }

/* ── 신고 패키지: 빠진 값 바로 입력 · 내려받기 줄 ── */
.cl-fix { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 8px 0 14px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--warn-bg); }
.cl-fix label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--warn); }
.cl-fix input { width: 190px; height: 40px; background: var(--card); color: var(--ink); }
.cl-fix #rpFixMsg { flex: 1 1 100%; font-size: 13px; color: var(--ink); }
.cl-fix #rpFixMsg:empty { display: none; }
html.rail-pre #rpButtons { margin: 14px 0 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
html.rail-pre #rpButtons[inert] { opacity: .5; }
html.rail-pre #rpButtons .btn { text-decoration: none; display: inline-flex; align-items: center; border-color: var(--brand); color: var(--brand-dark); }
html.rail-pre #rpPackMsg:not(:empty) { margin-top: 10px; }
html.rail-pre #rpReconcile table { margin-top: 12px; }

/* ── 내 양식으로 결산: 등록한 양식 = 행 카드 ── */
html.rail-pre #fmtList .toolbar { margin: 0 0 8px; min-height: 56px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); justify-content: space-between; }
html.rail-pre #fmtList .toolbar:has(.btn.primary) { border-color: var(--brand); background: var(--brand-soft); }
html.rail-pre #fmtList .toolbar .btn, html.rail-pre #fmtList .toolbar .btn.primary { min-height: 0; padding: 0; border: 0; background: none; color: var(--ink); font-size: 14.5px; font-weight: 800; }
html.rail-pre #fmtList .toolbar .btn.primary { color: var(--brand-dark); }
html.rail-pre .fmt2 { gap: var(--dense-gap); }
html.rail-pre #fmtDetail { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
html.rail-pre #fmGen[href="#"], html.rail-pre .wk-bar:has(> #fmGen[href="#"]) { display: none; }
html.rail-pre #fmtMap select { min-width: 200px; height: 36px; }
html.rail-pre #fmtMap tr.un td:first-child { color: var(--warn); }

/* ── 연 결산 · 독일 정산 대조: 한 줄 입력은 줄바꿈 격자 ── */
html.rail-pre #annualPanel .toolbar > :is(input, select):not([type="checkbox"]):not([type="number"]) { flex: 0 1 auto; }
html.rail-pre #annualPanel .toolbar > input[type="number"], html.rail-pre #annualPanel .toolbar > input[type="text"] { width: auto !important; flex: 1 1 130px; min-width: 110px; }
html.rail-pre #annualPanel .toolbar > #lgNote { flex: 2 1 220px; }
html.rail-pre #annualPanel .toolbar > #anYear, html.rail-pre #annualPanel .toolbar label #anYear { width: 100px !important; flex: 0 0 auto; }

/* ── 결산 규칙: 공통 비율 = 항목 카드 격자 · 채널 표 ── */
html.rail-pre #cwork #rlCommon { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
html.rail-pre #cwork #rlCommon > label { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); font-size: 12.5px; font-weight: 700; color: var(--sub); }
html.rail-pre #cwork #rlCommon > label input { width: 100% !important; height: 40px; color: var(--ink); }
html.rail-pre #rlTable input:not([type="checkbox"]), html.rail-pre #rlTable select { height: 36px; }
html.rail-pre #rlTable td:first-child, html.rail-pre #rlTable th:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); }
html.rail-pre #rlTable th:first-child { background: var(--bg); }

/* ── 원가 가져오기(서버가 끼운 구역) ── */
html.rail-pre #costPanel > div[style*="flex-wrap"] { gap: 12px !important; align-items: flex-end !important; margin: 0 0 14px !important; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
html.rail-pre #costPanel label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--sub); }
html.rail-pre #costPanel :is(select, input[type="text"], input[type="number"]) { height: 40px; }
html.rail-pre #costPanel details { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg); }
html.rail-pre #costPanel details > summary { cursor: pointer; font-size: 13.5px; font-weight: 700; }
html.rail-pre #costPanel .callout { margin: 8px 0; }
html.rail-pre #costPanel #ciMap label { flex-direction: row; align-items: center; gap: 10px; }
html.rail-pre #costPanel table { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* ── 정산 대사 · 리포트(위 요약 + 화면 안 탭 + 표) ── */
html.rail-pre .panel.wk-top { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
html.rail-pre .wk-top .toolbar, html.rail-pre .wk-top .f { margin: 0 0 14px; gap: 10px; }
html.rail-pre .wk-top .f .wk-fl { flex: 0 1 260px; text-align: left; }
html.rail-pre .wk-top > .wk-kpi { margin: 0; }
html.rail-pre .wk-work > .panel[data-lt] { background: none; }
html.rail-pre .wk-lt { gap: 8px; margin: 4px 0 14px; border-bottom: 0; }
html.rail-pre .wk-lt button { margin: 0; padding: 6px 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); color: var(--ink); }
html.rail-pre .wk-lt button:hover { border-radius: 999px; background: var(--brand-soft); color: var(--ink); }
html.rail-pre .wk-lt button[aria-selected="true"] { border-color: var(--brand-line); background: var(--card); color: var(--brand-dark); box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 10%, transparent); }
html.rail-pre .wk-tb, html.rail-pre .po-wrap > .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
html.rail-pre .wk-tb { flex: 0 1 auto; padding: 0; }
html.rail-pre :is(#cwork, .wk-work) :is(td.num, th.num) { font-family: var(--font); }
html.rail-pre .wk-tb table :is(th, td), html.rail-pre .po-wrap table :is(th, td), html.rail-pre #sumPanel table :is(th, td) { padding: 12px; border-bottom: 1px solid var(--line); }
html.rail-pre .wk-tb thead th, html.rail-pre .po-wrap thead th, html.rail-pre #sumTable thead th, html.rail-pre #feeTable thead th { background: var(--bg); color: var(--sub); font-size: 12.5px; font-weight: 700; }
html.rail-pre .wk-tb tbody tr:hover > td, html.rail-pre .po-wrap tbody tr:hover > td { background: var(--bg); }
html.rail-pre .wk-tb tbody tr:last-child > td { border-bottom: 0; }
html.rail-pre .wk-work .neg, html.rail-pre .wk-work td.neg { color: var(--danger); }
html.rail-pre .wk-top > .rp-link, html.rail-pre .wk-bar .rp-link { text-decoration: none; }

/* 리포트: 판정 띠 · 합계 칸 · 집계 안 한 날 */
html.rail-pre .verdict { margin: 0 0 14px; padding: 12px 16px; border: 0; border-radius: var(--radius-sm); font-size: 14px; line-height: 1.6; }
html.rail-pre .verdict.ok { background: var(--ok-bg); color: var(--ok); }
html.rail-pre .verdict.ng { background: var(--warn-bg); color: var(--warn); }
html.rail-pre .verdict small { display: inline; margin-left: 8px; font-size: 13px; font-weight: 500; }
html.rail-pre .wk-top .verdict { margin: 0 0 14px; padding: 12px 16px; }
html.rail-pre .st-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--dense-gap); margin: 0; }
html.rail-pre .st-kpis > .st-k { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
html.rail-pre .st-kpis .st-k > div { display: flex; flex-direction: column; min-width: 0; }
html.rail-pre .st-kpis .st-k b { font-size: 22px; line-height: 1.2; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
html.rail-pre .st-kpis .st-k small { font-size: 12.5px; color: var(--sub); }
html.rail-pre #missing { margin-top: 12px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger); }
html.rail-pre #missing:empty { display: none; }
html.rail-pre #stamp:empty { display: none; }
html.rail-pre .wk-pane > table, html.rail-pre #monPanel > div, html.rail-pre #dayPanel > div { border-radius: var(--radius-sm); }
html.rail-pre #monPanel > div[style*="overflow:auto"], html.rail-pre #dayPanel > div[style*="overflow:auto"], html.rail-pre #vOut div[style*="overflow:auto"] { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
html.rail-pre #sumPanel > h2, html.rail-pre #monPanel > h2, html.rail-pre #dayPanel > h2, html.rail-pre #vPanel > h2 { display: none; }

/* 좁은 화면 — 지표 띠는 두 칸 격자(칸 사이 세로 구분선은 오른쪽 칸에만) */
@media (max-width: 700px) {
  html.rail-pre :is(#head, .wk-top) > .wk-kpi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 0; }
  html.rail-pre :is(#head, .wk-top) > .wk-kpi > div { border-left: 0; }
  html.rail-pre :is(#head, .wk-top) > .wk-kpi > div:nth-child(even) { border-left: 1px solid var(--line); }
}
