:root { color-scheme:light; font-family:system-ui,sans-serif; color:#172c29; background:#eef3f0; }
* { box-sizing:border-box; }
body { margin:0; }
.shell { width:min(100% - 32px, 850px); margin-inline:auto; }
header { background:#133c34; color:#fff; }
.brand { padding:15px 0; font-weight:750; letter-spacing:.03em; }
.brand span { margin-left:10px; font-size:.875rem; font-weight:500; color:#bce6d3; }
.intro { padding:27px 0 4px; }
h1 { margin:0; font-size:clamp(1.65rem,5vw,2.45rem); }
p { line-height:1.6; }
.intro p { color:#40574f; margin:10px 0 0; }
#status:empty { display:none; }
#status { background:#def0e6; padding:12px; border-radius:8px; }
section { padding:20px; margin:18px 0; border:1px solid #cbd9d2; border-radius:15px; background:#fff; }
h2 { font-size:1.12rem; margin:0 0 18px; }
.grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.fence-length-examples { margin:6px 0 0; white-space:pre-line; font-size:.875rem; }
.fence-results { display:grid; grid-template-columns:repeat(auto-fit,minmax(135px,1fr)); gap:8px; }
.fence-results div { display:flex; justify-content:space-between; gap:8px; padding:8px; border:1px solid #dce4dc; border-radius:6px; }
.fence-results dd { margin:0; font-weight:700; white-space:nowrap; }
.wide, fieldset { grid-column:1/-1; }
label, legend { font-size:.9rem; font-weight:650; }
label { display:block; }
input:not([type=checkbox]):not([type=radio]), select, textarea { display:block; width:100%; margin-top:5px; min-height:44px; border:1px solid #82948b; border-radius:7px; padding:8px 10px; font:inherit; font-weight:400; background:white; color:inherit; }
textarea { min-height:74px; }
select { appearance:none; padding-right:32px; background-image:linear-gradient(45deg,transparent 50%,#133c34 50%),linear-gradient(135deg,#133c34 50%,transparent 50%); background-position:calc(100% - 15px) 50%,calc(100% - 10px) 50%; background-size:5px 5px; background-repeat:no-repeat; }
fieldset { min-width:0; border:1px solid #d7e2dc; border-radius:9px; padding:10px 12px; margin:10px 0; }
.choice-group { margin:0; }
.choices { display:flex; flex-wrap:wrap; gap:8px; }
.tick { display:inline-flex; align-items:center; min-height:44px; gap:8px; padding:6px 10px; border:1px solid #cbd9d2; border-radius:8px; cursor:pointer; }
.tick:has(input:checked) { border-color:#145b43; background:#def0e6; }
.tick input { width:19px; height:19px; flex:none; margin:0; accent-color:#145b43; }
.option-toggle { margin-bottom:12px; }
#work-title, #work-manual + button { margin-top:16px; }
#work-title { overflow-wrap:anywhere; }
.work-list { margin:0 0 20px; border-block-start:1px solid #d7e2dc; }
.work-item { padding:4px 0; border-block-end:1px solid #d7e2dc; }
.work-line { display:grid; grid-template-columns:minmax(0,1fr) minmax(3.5rem,5.5rem) minmax(3.25rem,5.5rem); align-items:center; gap:6px; }
.work-line :is(input, label) { min-width:0; margin:0; }
.work-line input:not([type=checkbox]) { padding-inline:6px; font-size:1rem; }
.work-check { display:flex; align-items:center; gap:8px; min-height:44px; overflow-wrap:anywhere; cursor:pointer; }
.work-check input { width:19px; height:19px; flex:none; accent-color:#145b43; }
.work-line:not(:has([data-work-field="qty"]:not([hidden]))) .work-check { grid-column:1/-1; }
.work-actions { display:flex; flex-wrap:wrap; align-items:flex-start; justify-content:space-between; gap:4px 12px; padding-inline-start:27px; }
.work-actions button, .work-notes summary { min-height:44px; font-size:.85rem; }
.work-actions button { padding-inline:8px; }
.work-notes { flex:1; min-width:4rem; }
.work-notes[open] { flex-basis:100%; }
.work-notes summary { padding:12px 0; color:#145b43; cursor:pointer; }
.work-notes textarea { margin:0 0 6px; font-size:1rem; }
button { min-height:44px; padding:8px 14px; border:1px solid #145b43; border-radius:8px; font:inherit; font-weight:700; color:#fff; background:#145b43; cursor:pointer; }
button:disabled { opacity:.55; cursor:default; }
.secondary { background:white; color:#145b43; }
.subactions { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
#editor-footer { padding-block:12px 32px; }
.output-options { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr)); gap:10px; }
.output-options > div { padding:12px; border:1px solid #cedcd4; border-radius:9px; background:white; }
.output-options button { width:100%; }
.output-options p { margin:8px 0 0; font-size:.875rem; }
#output-dialog { width:min(480px,calc(100% - 24px)); border:1px solid #82948b; border-radius:10px; padding:20px; }
#output-dialog::backdrop { background:#0009; }
.intro + .subactions { align-items:center; margin-bottom:14px; }
.pdf-toolbar { margin-block:16px; }
.pdf-toolbar p { margin-block:8px 0; font-size:.875rem; }
.pdf-paper { padding:clamp(12px,4vw,32px); background:white; color:#222; border:1px solid #cbd9d2; }
.pdf-paper h1 { font-size:1.65rem; border-block-end:2px solid #133c34; padding-bottom:8px; }
.pdf-paper h2 { margin:18px 0 8px; padding-inline-start:8px; border-inline-start:4px solid #133c34; }
.pdf-paper h3 { margin:13px 0 6px; font-size:.95rem; }
.pdf-paper table { width:100%; margin:0 0 10px; table-layout:fixed; border-collapse:collapse; font-size:.85rem; }
.pdf-paper th, .pdf-paper td { padding:5px 7px; border:1px solid #8c9b93; text-align:left; vertical-align:top; overflow-wrap:anywhere; white-space:pre-wrap; }
.pdf-paper th { background:#f2f5f3; }
.pdf-pairs th { width:32%; }
.photo-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr)); gap:12px; list-style:none; padding:0; }
.photo-list li { min-width:0; padding:10px; border:1px solid #d7e2dc; border-radius:8px; }
.photo-thumbnail { width:100%; padding:0; border:0; background:#edf2ef; }
.photo-thumbnail img { display:block; width:100%; height:160px; object-fit:contain; }
#photo-preview { max-width:94vw; max-height:94dvh; border:1px solid #82948b; border-radius:8px; padding:10px; }
#photo-preview img { display:block; max-width:85vw; max-height:74dvh; margin-top:8px; object-fit:contain; }
#photo-preview::backdrop { background:#0009; }
.pdf-photo-page figure { margin:0 0 12px; break-inside:avoid; }
.pdf-photo-page img { display:block; width:100%; height:clamp(160px,55vw,330px); object-fit:contain; }
.pdf-photo-page figcaption { margin-top:4px; font-size:.85rem; white-space:pre-wrap; overflow-wrap:anywhere; }
:focus-visible { outline:3px solid #348d66; outline-offset:3px; }
[hidden] { display:none!important; }
@media(max-width:560px) { .grid { grid-template-columns:1fr; } section { padding:15px; } }

@page { size:A4; margin:13mm; }
@media print {
  :root, body { background:white; color:black; }
  body { padding:0; }
  body > header, #editor, #editor-footer, .pdf-toolbar { display:none !important; }
  #pdf-preview { width:100%; margin:0; }
  .pdf-paper { padding:0; border:0; }
  .pdf-paper h1, .pdf-paper h2, .pdf-paper h3 { break-after:avoid; }
  .pdf-paper thead { display:table-header-group; }
  .pdf-paper table { font-size:10pt; }
  .pdf-photo-page { break-before:page; }
  .pdf-photo-page img { height:80mm; }
}
