/* Workjigs. Printed-manual look: plain type, thin rules, dense tables. No gradients, no shadows. */
:root { --ink: #1b1d1f; --muted: #5f646b; --rule: #d5d8dc; --soft: #f4f5f6; --accent: #0b5cad; --flag: #8a4b00; --bg: #fff; }
@media (prefers-color-scheme: dark) { :root { --ink: #e7e9ec; --muted: #a2a8b0; --rule: #3a3f45; --soft: #1e2226; --accent: #6aa8ea; --flag: #e0a35a; --bg: #14171a; } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; }
a { color: var(--accent); }
header.site, footer.site, main { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
header.site { display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-top: 14px; padding-bottom: 10px; }
header.site .brand { font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: .02em; }
header.site nav { display: flex; gap: 16px; font-size: 14px; flex: 1; }
header.site nav a { color: var(--ink); text-decoration: none; }
header.site nav a:hover { text-decoration: underline; }
header.site details.lang { font-size: 14px; position: relative; }
header.site details.lang summary { cursor: pointer; list-style: none; color: var(--ink); }
header.site details.lang summary::-webkit-details-marker { display: none; }
header.site details.lang summary::after { content: ' \25BE'; font-size: 11px; }
header.site details.lang ul { position: absolute; inset-inline-end: 0; top: 1.8em; z-index: 5; margin: 0; padding: 6px 0; list-style: none; background: var(--bg); border: 1px solid var(--ink); columns: 2; column-gap: 0; width: 22em; }
header.site details.lang li a { display: block; padding: 3px 12px; color: var(--ink); text-decoration: none; }
header.site details.lang li a:hover { background: var(--soft); }
header.site details.lang li a[aria-current] { font-weight: 600; }
main { padding-top: 24px; padding-bottom: 48px; }
h1 { font-size: 28px; line-height: 1.25; margin: 8px 0 8px; }
.dek { font-size: 18px; color: var(--muted); max-width: 760px; margin: 0 0 20px; }
.crumb { font-size: 13px; color: var(--muted); }
.crumb a { color: var(--muted); }
h2 { font-size: 20px; margin: 36px 0 10px; padding-top: 10px; border-top: 1px solid var(--rule); }
article { max-width: 760px; }
article p, article li { margin: 0 0 12px; }
article table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0 16px; }
article th, article td { border: 1px solid var(--rule); padding: 6px 8px; text-align: start; vertical-align: top; }
article th { background: var(--soft); }
.formula { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--soft); padding: 8px 12px; display: inline-block; }
.note { border-inline-start: 3px solid var(--flag); padding: 6px 12px; background: var(--soft); }
.muted { color: var(--muted); } .small { font-size: 13px; }
/* tool */
#app { border: 1px solid var(--ink); margin: 8px 0 32px; }
.step { padding: 14px 16px 16px; border-top: 1px solid var(--rule); }
.step:first-child { border-top: 0; }
.step h2 { border: 0; margin: 0 0 10px; padding: 0; font-size: 16px; display: flex; gap: 10px; align-items: center; }
.step h2 span { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--ink); font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 14px; }
.drop { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; border: 1px dashed var(--rule); }
.drop.over { border-color: var(--accent); background: var(--soft); }
.btn { font: inherit; font-size: 14px; padding: 6px 12px; border: 1px solid var(--ink); background: var(--bg); color: var(--ink); cursor: pointer; display: inline-block; }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.small { font-size: 13px; padding: 4px 10px; }
.btn:disabled { opacity: .4; cursor: default; }
select, input { font: inherit; font-size: 14px; padding: 4px 6px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); }
.status { font-size: 14px; min-height: 1.6em; margin-top: 6px; }
.summary { display: grid; grid-template-columns: max-content 1fr max-content 1fr max-content 1fr; gap: 2px 12px; font-size: 13px; margin: 6px 0 0; }
.summary dt { color: var(--muted); } .summary dd { margin: 0; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { border-bottom: 1px solid var(--rule); padding: 5px 8px; text-align: start; white-space: nowrap; }
table.data thead th { border-bottom: 1px solid var(--ink); font-weight: 600; }
table.data tfoot td { border-top: 1px solid var(--ink); border-bottom: 0; }
table.data .n { text-align: end; }
table.data input.p { text-align: end; width: 8em; }
.formula, table.data .n, .summary dd { unicode-bidi: plaintext; }
td.flag { color: var(--flag); }
/* home */
ul.tools { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--ink); }
ul.tools li { border-bottom: 1px solid var(--rule); padding: 12px 0; }
ul.tools a { font-weight: 600; font-size: 17px; }
ul.tools .field { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
ul.tools p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
footer.site { border-top: 1px solid var(--rule); padding-top: 14px; padding-bottom: 30px; font-size: 13px; color: var(--muted); }
footer.site nav { display: flex; gap: 14px; margin-bottom: 6px; }
footer.site nav a { color: var(--muted); }
@media (max-width: 640px) { header.site details.lang ul { width: 18em; }
  table.data thead { display: none; }
  table.data, table.data tbody { display: block; width: 100%; }
  table.data tfoot { display: table; width: 100%; }
  table.data tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
  table.data tbody td, table.data tbody td.n { border: 0; padding: 2px 0; white-space: normal; text-align: start; }
  table.data tbody td.lead { grid-column: 1 / -1; font-weight: 600; }
  table.data tbody td.no { display: none; }
  table.data tbody td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); }
  table.data input.p { width: 100%; text-align: start; }
  table.data tfoot td { text-align: start; } h1 { font-size: 23px; } .dek { font-size: 16px; } .summary { grid-template-columns: max-content 1fr; } }
/* PDF takeoff workspace: full width, three columns, drawing in the middle */
#app.app-wide { width: calc(100vw - 32px); margin-inline-start: calc(50% - 50vw + 16px); border: 1px solid var(--ink); }
.tk { display: flex; flex-direction: column; height: max(600px, calc(100vh - 120px)); font-size: 13px; }
.tk-bar, .tk-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--rule); }
.tk-gap { flex: 1; }
.tk-name { font-weight: 600; min-width: 12em; border-color: transparent; }
.tk-name:focus, .tk-name:hover { border-color: var(--rule); }
.tk-main { flex: 1; display: grid; grid-template-columns: 230px 1fr 320px; min-height: 0; }
.tk-left, .tk-right { overflow: auto; padding: 8px; border-inline-end: 1px solid var(--rule); }
.tk-right { border-inline-end: 0; border-inline-start: 1px solid var(--rule); }
.tk-left h3, .tk-right h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin: 10px 0 6px; display: flex; justify-content: space-between; align-items: center; }
.tk-filter { width: 100%; margin-bottom: 4px; }
.tk-sheets, .tk-conds { list-style: none; margin: 0; padding: 0; }
.tk-sheets li, .tk-conds li { display: flex; gap: 6px; align-items: center; padding: 4px 6px; cursor: pointer; border-bottom: 1px solid var(--rule); }
.tk-sheets li.on, .tk-conds li.on { background: var(--soft); outline: 1px solid var(--ink); }
.tk-sheets .nm, .tk-conds .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-sheets .sc { color: var(--muted); font-size: 11px; } .tk-sheets .ct { font-size: 11px; background: var(--ink); color: var(--bg); padding: 0 5px; }
.warn { color: #c0392b !important; }
select.warn { border-color: #c0392b; }
.tk-conds i, .tk-tot i { display: inline-block; width: 10px; height: 10px; margin-inline-end: 6px; flex: none; }
.tk-conds .q { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.tk-conds .ed { border: 0; background: none; cursor: pointer; color: var(--muted); font: inherit; }
.tk-center { display: flex; flex-direction: column; min-width: 0; }
.tk-tool { font: inherit; font-size: 12px; padding: 4px 8px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); cursor: pointer; }
.tk-tool.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
kbd { font: 10px ui-monospace, monospace; border: 1px solid var(--rule); padding: 0 3px; color: var(--muted); }
.tk-tool.on kbd { color: var(--bg); border-color: var(--bg); }
.tk-chk { display: inline-flex; gap: 4px; align-items: center; }
.tk-view { position: relative; flex: 1; overflow: hidden; background: #e9ebee; outline: none; touch-action: none; }
.tk-view canvas { position: absolute; inset: 0; }
.tk-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); padding: 20px; text-align: center; }
.tk-tip { position: absolute; background: var(--ink); color: var(--bg); padding: 2px 6px; font-size: 12px; pointer-events: none; font-variant-numeric: tabular-nums; }
.tk-status { display: flex; justify-content: space-between; padding: 3px 8px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 12px; min-height: 22px; }
.tk-tot td, .tk-tot th { white-space: normal !important; }
.tk-tot tr.it td:first-child { padding-inline-start: 22px; color: var(--muted); }
.tk-sel { border-top: 1px solid var(--ink); margin-top: 10px; padding-top: 6px; display: grid; gap: 6px; }
.tk-dlg { border: 1px solid var(--ink); padding: 16px 18px; max-width: 640px; width: 92vw; background: var(--bg); color: var(--ink); }
.tk-dlg::backdrop { background: rgba(0,0,0,.35); }
.tk-dlg h3 { margin: 0 0 10px; } .tk-dlg h4 { margin: 14px 0 4px; }
.tk-dlg .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.tk-dlg label { display: grid; gap: 2px; font-size: 13px; }
.tk-dlg .row.end { justify-content: flex-end; margin-top: 14px; }
.tk-items input, .tk-items select { width: 100%; }
.btn.danger { border-color: #c0392b; color: #c0392b; }
.tk-plist { list-style: none; padding: 0; } .tk-plist li { padding: 4px 0; border-bottom: 1px solid var(--rule); }
@media (max-width: 900px) { .tk-main { grid-template-columns: 1fr; grid-template-rows: auto 60vh auto; } .tk { height: auto; } .tk-left, .tk-right { border: 0; max-height: 40vh; } }
.tk-empty[hidden], .tk-tip[hidden] { display: none; }
.tk-left h3 span { display: flex; gap: 4px; }
.tk-left h3 { flex-wrap: wrap; gap: 4px; }
.tk-tools label { white-space: nowrap; }
.tk-sel p, .tk-sel h3 { margin: 0; }
.tk-tot thead th { white-space: nowrap !important; }
