:root { --ink: #182329; --muted: #637178; --paper: #ffffff; --line: #d9e0dc; --teal: #0f766e; --teal-dark: #095b56; --orange: #e36b3d; --soft: #eef5f1; --page-margin: 1cm; --page-w: 210mm; --page-h: 297mm; }
* { box-sizing: border-box; }
@page { size: A4; margin: 0; }
body { margin: 0; color: var(--ink); background: #e8efeb; font: 15px/1.55 'DM Sans', sans-serif; }
.topbar { background: var(--ink); color: white; padding: 24px clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.topbar h1 { margin: 0; font: 700 clamp(22px, 3vw, 34px)/1.1 'Libre Baskerville', serif; letter-spacing: 0; }
.topbar p { margin: 7px 0 0; color: #bdcfca; }
.badge { border: 1px solid #5c766f; border-radius: 999px; padding: 7px 12px; color: #d8eee8; font-size: 12px; white-space: nowrap; }
.workspace { width: min(1440px, calc(100% - 40px)); margin: 28px auto 60px; display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 28px; align-items: start; }
.panel, .paper-stack { background: var(--paper); border: 1px solid var(--line); box-shadow: 0 12px 35px #17342b12; }
.panel { position: sticky; top: 18px; padding: 24px; border-radius: 8px; }
.panel h2 { margin: 0 0 4px; font: 700 20px 'Libre Baskerville', serif; }
.panel .hint { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.field { margin: 14px 0; }
label { display: block; margin-bottom: 6px; font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: #49615e; }
input, textarea, select { width: 100%; border: 1px solid #cbd7d1; border-radius: 5px; background: white; color: var(--ink); padding: 10px 11px; font: inherit; outline: none; }
input:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px #0f766e1c; }
textarea { min-height: 92px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 20px; }
button { border: 0; border-radius: 5px; cursor: pointer; padding: 11px 12px; font: 700 13px 'DM Sans', sans-serif; }
.primary { background: var(--teal); color: white; }
.primary:hover { background: var(--teal-dark); }
.secondary { background: #dfece7; color: var(--teal-dark); }
.danger { background: #fff0eb; color: #b44826; }
.status { min-height: 20px; margin-top: 12px; color: var(--teal); font-size: 12px; }

/* ===== Paper: real A4 sheets, one per printed page ===== */
.paper-stack { width: var(--page-w); max-width: 100%; margin: 0 auto; }
.sheet { position: relative; width: var(--page-w); max-width: 100%; min-height: var(--page-h); margin: 0 auto 16px auto; background: var(--paper); box-shadow: 0 2px 14px #17342b18; padding: var(--page-margin); font: 10pt/2 Tahoma, sans-serif; line-height: 2; overflow: visible; }
.sheet:last-child { margin-bottom: 0; }
.sheet-label { position: absolute; top: -16px; right: 2px; font: 700 10px/1.4 Tahoma, sans-serif; color: #8ba39c; pointer-events: none; }

/* PDF export (html2pdf): screen-like rendering of the stacked sheets */
body.pdf-exporting { background: white; }
body.pdf-exporting .topbar, body.pdf-exporting .panel { display: none !important; }
body.pdf-exporting .workspace { display: block; width: auto; margin: 0; }
.paper-stack.pdf-export { width: 794px !important; max-width: none !important; border: 0 !important; box-shadow: none !important; background: white; }
.paper-stack.pdf-export .sheet { width: 794px !important; max-width: none !important; min-height: 1123px !important; height: 1123px !important; overflow: hidden !important; margin: 0 !important; box-shadow: none !important; padding: var(--page-margin) !important; }
.pdf-export .sheet-label { display: none; }

.paper-head { text-align: center; padding-bottom: 10px; margin-bottom: 18px; break-inside: avoid; page-break-inside: avoid; }
.paper-head h2 { margin: 0; font: 700 12pt Tahoma, sans-serif; }
.paper-head p { margin: 8px 0 0; font: 700 12pt Tahoma, sans-serif; letter-spacing: .08em; }
.page-two { break-before: page; page-break-before: always; padding-top: 10mm; }
.section { margin-top: 24px; }
.section h3 { margin: 0 0 9px; font: 700 12pt Tahoma, sans-serif; }
.section h4 { margin: 14px 0 4px 20px; font: 700 10pt Tahoma, sans-serif; }
.section p { margin: 0 0 8px; text-align: justify; line-height: 2; }
.section ol { margin: 5px 0 0 21px; padding: 0; }
.section li { margin: 4px 0; line-height: 2; }
.section > p, .section > ol { margin-left: 20px; }
.section #previewActivity p { margin: 0 0 8px 20px; text-align: justify; line-height: 2; }
.section #previewActivity p:first-child { margin-bottom: 10px; }
.section #previewActivity .topic-group { margin: 0 0 10px 40px; }
.section #previewActivity .topic-group-label { font-weight: 600; margin: 4px 0 2px; line-height: 2; }
.section #previewActivity .topic-list { margin: 0; padding: 0; list-style: none; }
.section #previewActivity .topic-list li { margin: 2px 0; line-height: 2; padding-left: 24px; text-indent: -14px; }
.section #previewActivity .topic-list li::before { content: '- '; text-indent: 0; }
.section #previewActivity ol.topic-list { counter-reset: topic-counter; list-style: decimal; padding-left: 20px; }
.section #previewActivity ol.topic-list li { padding-left: 6px; text-indent: 0; counter-increment: topic-counter; }
.section #previewActivity ol.topic-list li::before { content: none; }
.section h4 ~ p, .section h4 ~ ol { margin-left: 40px; }
#previewResults { margin-left: 40px; }
.signature { width: 270px; margin: 45px 0 0 auto; text-align: center; break-inside: avoid; page-break-inside: avoid; }
.signature p { text-align: center; margin: 4px 0; }
.signature .space { height: 24px; }
.photos { break-before: page; page-break-before: always; margin-top: 40px; padding-top: 24px; }
.photos h3 { margin: 0 0 15px; }
.photo-grid { display: grid; grid-template-columns: 1fr; gap: 15px; }
.photo-card { position: relative; overflow: hidden; width: 100%; max-height: calc(var(--page-h) - 2 * var(--page-margin) - 34mm); background: #edf2ef; border: 1px solid #bcc9c4; }
.photo-card > .photo-slot { display: block; width: 100%; height: auto; max-height: none; object-fit: contain; background: #edf2ef; }
.geotag-wrap { position: absolute; right: auto; bottom: 0; left: 10%; width: 80%; display: flex; flex-direction: column; }
.geotag-overlay { position: relative; right: auto; bottom: auto; left: auto; display: grid; width: 100%; grid-template-columns: 64px 1fr; gap: 8px; padding: 9px; align-items: stretch; background: rgba(16, 24, 32, .55); color: white; font-size: 9px; line-height: 1.3; align-self: stretch; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.geotag-mini-map { width: 64px; height: auto; min-height: 64px; overflow: hidden; background: #d8e6df; }
.geotag-overlay strong { display: block; font-size: 10px; }
.geo-line { display: block; }
.gps-camera-brand { display: inline-flex; justify-content: flex-end; align-items: center; gap: 6px; padding: 2px 8px 4px; background: rgba(16, 24, 32, .55); color: white; font: 700 10px/1 Tahoma, sans-serif; letter-spacing: .03em; width: fit-content; align-self: flex-end; border-top-right-radius: 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.gps-camera-brand::before { display: none; }
.kop-preview { display: block; width: 100%; max-height: 145px; margin: 0 auto 8px; object-fit: contain; }
.signature-images { display: flex; justify-content: center; align-items: end; gap: 24px; min-height: 80px; margin: 4px 0; }
.signature-images img { display: block; width: 135px; height: 70px; object-fit: contain; }
.map-picker { height: 230px; margin-top: 8px; border: 1px solid #cbd7d1; border-radius: 5px; overflow: hidden; }
.coordinates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.coordinates input { font-size: 12px; padding: 8px; }
.map-note { color: var(--muted); font-size: 11px; margin-top: 6px; }
.upload-note { color: var(--muted); font-size: 12px; margin-top: 7px; }
.page-footer { display: none; }

@media (max-width: 900px) { .workspace { grid-template-columns: 1fr; } .panel { position: static; } .paper-stack, .sheet { width: 100%; } .sheet { min-height: auto; } }
@media (max-width: 520px) { .topbar { display: block; } .badge { display: inline-block; margin-top: 15px; } .sheet { padding: 28px 20px; } .grid-2, .photo-grid, .actions { grid-template-columns: 1fr; } .paper-head h2 { font-size: 20px; } }

@media print {
    body { background: white; }
    .topbar, .panel, .sheet-label { display: none !important; }
    .workspace { display: block; width: 100%; margin: 0; }
    .paper-stack { border: 0; box-shadow: none; width: auto; max-width: none; }
    .sheet { border: 0; box-shadow: none; width: auto; max-width: none; margin: 0; min-height: 0; }
    .page-footer { display: block; position: fixed; right: var(--page-margin); bottom: 8mm; left: var(--page-margin); border-top: 1px solid #9aa9a4; padding-top: 3mm; text-align: center; color: #637178; font: 9pt Tahoma, sans-serif; }
    .geotag-overlay, .gps-camera-brand { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .geotag-overlay { background: rgba(16, 24, 32, .55) !important; color: white !important; }
    .gps-camera-brand { background: rgba(16, 24, 32, .55) !important; color: white !important; border-top-right-radius: 6px !important; }
}
