:root {
  color-scheme: light;
  font: 100%/1.5 "Segoe UI", system-ui, sans-serif;
  color: #19332f;
  background: #eff4f1;
  --surface: #fff;
  --dark: #193a36;
  --accent: #d5edac;
  --muted: #48635c;
  --line: #d9e4df;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid #2c8068;
  outline-offset: 2px;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2 { line-height: 1.13; letter-spacing: -.045em; }
button { min-height: 40px; padding: 7px 13px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--dark); font-weight: 650; font-size: .9375rem; }
button:hover { background: #eaf3ed; }
button:disabled { cursor: default; opacity: .52; }
.primary { background: var(--accent); border-color: #c9e59e; }
.primary:hover { background: #e1f4c7; }
.quiet, .danger { background: transparent; border-color: transparent; padding-inline: 8px; }
.danger { color: #8a463b; }
.danger:hover { background: #f8eeeb; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mast { background: #fff; border-bottom: 1px solid var(--line); }
.mast-inner, main { width: min(1280px, calc(100% - 64px)); margin-inline: auto; }
.mast-inner { min-height: 66px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.logo { text-decoration: none; display: flex; align-items: center; gap: 7px; font-weight: 600; }
.logo-mark { display: grid; place-items: center; width: 34px; height: 34px; background: var(--dark); color: var(--accent); border-radius: 9px; margin-right: 4px; font-size: 1.25rem; }
.standalone { font-size: .9375rem; color: var(--muted); }
.overview { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 28px 0 22px; padding: 28px 34px; border-radius: 18px; color: #fff; background: var(--dark); }
.eyebrow { color: var(--muted); font-size: .875rem; font-weight: 700; margin-bottom: 5px; }
.overview .eyebrow { color: var(--accent); }
.overview h1 { font-size: clamp(2.05rem, 5vw, 3.75rem); margin-bottom: 7px; }
.overview p:last-child { color: #dcebe4; }
.project-controls { min-width: 270px; }
.project-controls .button-row { flex-wrap: nowrap; }
.project-controls label { font-size: .9rem; font-weight: 700; margin-bottom: 6px; }
.project-controls select { min-width: 100px; }
.project-controls button { white-space: nowrap; }
#save-status { display: block; color: #dcebe4; margin-top: 7px; min-height: 22px; font-size: .875rem; }
.workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: start; gap: 18px; margin-bottom: 40px; }
.sidebar, .surface { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
.sidebar { position: sticky; top: 12px; max-height: calc(100dvh - 24px); overflow: auto; padding: 14px 12px; }
.side-head { padding: 6px 8px 13px; }
.side-head h2 { font-size: 1.3rem; }
.side-head p { color: var(--muted); font-size: .875rem; margin-top: 4px; }
#outline, .side-actions { display: grid; gap: 4px; }
.outline-entry { text-align: left; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 7px; align-items: center; width: 100%; background: transparent; border-color: transparent; padding: 6px; font-weight: 550; }
.outline-entry[aria-current] { background: #e5f0e9; border-color: #c9e0d4; font-weight: 750; }
.nav-marker { border-radius: 6px; text-align: center; font-size: .8125rem; color: #35574e; font-weight: 700; }
.side-actions { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 10px; }
.side-actions button { text-align: left; }
.surface-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.surface-head h2 { font-size: clamp(1.45rem, 3vw, 2.15rem); overflow-wrap: anywhere; }
.surface-head .button-row { flex-shrink: 0; }
.editor { padding: 22px 24px; }
.lead { color: var(--muted); margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
label { display: grid; gap: 5px; font-size: .9375rem; font-weight: 650; min-width: 0; }
.wide { grid-column: 1 / -1; }
input, select, textarea { width: 100%; min-width: 0; min-height: 42px; border: 1px solid #bfd0c8; border-radius: 8px; padding: 8px 10px; color: #19332f; background: #fff; font-weight: 400; font-size: 1rem; }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, #48635c 50%), linear-gradient(135deg, #48635c 50%, transparent 50%); background-position: right 16px center, right 11px center; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.editor > h3 { margin-top: 18px; }
.chapter-list { padding-left: 26px; margin-top: 4px; }
.chapter-list button { text-align: left; }
.sub-outline { list-style: none; padding-left: 16px; margin-block: 3px 8px; }
.sub-outline button { min-height: 32px; font-weight: 500; }
.nested-outline { padding-left: 15px; }
.nested-block { margin-left: clamp(8px, 3vw, 32px); border-left: 3px solid #a9c8b9; }
.chapter-actions, .add-block { margin: 12px 0 16px; }
.block { border: 1px solid var(--line); border-radius: 11px; padding: 14px; margin-bottom: 12px; display: grid; gap: 10px; }
.block-head, .checklist-head, .preview-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.block-head .button-row { justify-content: end; }
.block-head button { font-size: .875rem; min-height: 33px; }
.matrix { overflow: auto; margin-bottom: 9px; }
.matrix table { border-collapse: collapse; min-width: 100%; }
.matrix th, .matrix td { min-width: 135px; padding: 4px; text-align: left; }
.matrix th:last-child, .matrix td:last-child { min-width: auto; }
.matrix label { font-size: .8125rem; }
.matrix .table-link { margin-top: 3px; font-size: .8125rem; }
.table-link summary { cursor: pointer; color: var(--muted); }
.table-link select { margin-top: 4px; font-size: .85rem; }
.section-photos { margin-block: 10px; }
.section-photo-list:empty { display: none; }
.section-photo-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 12px; margin-top: 8px; }
.section-photo-card { min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 8px; }
.section-photo-card .photo-thumb { width: 100%; height: 120px; object-fit: contain; }
.photo-thumb { display: block; max-width: 100%; max-height: 270px; object-fit: contain; margin: 8px 0; }
.hint { color: var(--muted); font-size: .9rem; }
.linked-fields { margin-top: 9px; border: 1px solid var(--line); border-radius: 8px; background: #f4f8f5; }
.linked-fields > summary { padding: 8px 11px; color: var(--dark); font-size: .9rem; font-weight: 700; cursor: pointer; }
.linked-content { padding: 4px 11px 12px; }
.linked-content h4 { margin-top: 12px; }
.link-entry { min-width: 0; display: grid; gap: 4px; align-content: start; }
.link-entry .hint { overflow-wrap: anywhere; }
.field-example { color: #37594c; background: #e9f2eb; border-left: 3px solid #a9c8b9; padding: 6px 8px; font-size: .875rem; overflow-wrap: anywhere; }
.scope-options { min-width: 0; margin: 4px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.scope-options legend { font-weight: 650; font-size: .9rem; }
.scope-options .scope-choice { display: flex; align-items: start; gap: 7px; padding: 3px 0; font-weight: 500; }
.scope-choice input[type="checkbox"] { width: 16px; min-height: 16px; height: 16px; margin: 3px 0 0; flex: none; accent-color: var(--dark); }
.scope-options > label:last-child { margin-top: 6px; }
.linked-preview { margin-top: 5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.purpose-field { display: grid; gap: 8px; margin-bottom: 14px; }
.block .purpose-field { margin-bottom: 0; }
.auto-checklist { overflow-x: auto; margin-block: 12px; }
.auto-checklist table { width: 100%; min-width: 40rem; border-collapse: collapse; }
.auto-checklist th, .auto-checklist td { text-align: left; vertical-align: top; padding: 8px; border: 1px solid var(--line); white-space: pre-wrap; }
.auto-checklist th { background: #e9f2eb; }
.site-diagram { margin: 16px 0; }
.site-diagram img { display: block; width: 100%; max-width: 850px; }
.site-diagram figcaption { margin-top: 5px; font-size: .875rem; color: var(--muted); }
.intensity-criteria:not(:empty) { display: grid; gap: 10px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.intensity-additional { margin-block: 14px; }
.intensity-additional h3 { margin-bottom: 5px; }
.intensity-additional fieldset { min-width: 0; }
.intensity-toggle { display: flex; align-items: center; gap: 8px; }
.intensity-toggle input { width: auto; }

.checklist-head { flex-wrap: wrap; margin-bottom: 8px; }
.checklist-head p { margin: 0; }
.checklist-frame { width: 100%; height: min(74dvh, 850px); min-height: 480px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
dialog { border: 1px solid var(--line); background: #fff; color: inherit; border-radius: 15px; padding: 23px; max-width: calc(100% - 24px); }
dialog::backdrop { background: #132b27ab; }
#project-dialog, #chapter-dialog { width: min(460px, calc(100% - 24px)); }
#project-form, #chapter-form { display: grid; gap: 13px; }
#project-form p { color: var(--muted); }
#project-form .button-row, #chapter-form .button-row { justify-content: end; }
#preview-dialog { width: min(1000px, calc(100% - 24px)); max-height: 92dvh; padding: 0; background: #e9efed; }
.preview-controls { position: sticky; top: 0; z-index: 2; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; }
.pagination-stage { position: fixed; left: -10000px; top: 0; width: 210mm; visibility: hidden; pointer-events: none; }
.report-print [id] { scroll-margin-top: 70px; }
@media screen {
  #report .pagedjs_pages { min-width: 210mm; padding: 14px; }
  #report .pagedjs_page { margin: 0 auto 14px; background: #fff; box-shadow: 0 1px 5px #1d483326; }
}
@media(max-width: 800px) {
  .mast-inner, main { width: calc(100% - 28px); }
  .overview { align-items: start; flex-direction: column; gap: 15px; padding: 22px; }
  .project-controls { min-width: 0; width: min(100%, 425px); }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  #outline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-actions { display: flex; flex-wrap: wrap; }
}
@media(max-width: 520px) {
  .surface-head, .block-head { align-items: start; flex-direction: column; }
  .surface-head, .editor { padding: 15px 13px; }
  .form-grid { grid-template-columns: 1fr; }
  .standalone { max-width: 110px; text-align: right; }
}
@page { size: A4; margin: 0; }
@media print {
  :root, body { background: #fff; color: #000; }
  body > :not(#preview-dialog), #preview-dialog .preview-controls { display: none !important; }
  #preview-dialog::backdrop { display: none; }
  #preview-dialog[open] { display: block; position: static; width: 100%; max-width: none; height: auto; max-height: none; overflow: visible; margin: 0; border: 0; border-radius: 0; background: #fff; }
  #report .pagedjs_page:last-child { break-after: auto; }
}
