:root {
  color-scheme: light;
  --navy: #0b2a4a;
  --navy-2: #173f66;
  --blue: #256fa3;
  --cyan: #17a6c7;
  --ink: #17212b;
  --muted: #5f6d79;
  --line: #d8e0e7;
  --surface: #ffffff;
  --background: #eef3f6;
  --ok: #217a4c;
  --ok-soft: #e6f5ec;
  --finding: #a76500;
  --finding-soft: #fff1d8;
  --urgent: #b42318;
  --urgent-soft: #fde8e7;
  --shadow: 0 12px 28px rgba(11, 42, 74, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--background); }
body { margin: 0; color: var(--ink); background: var(--background); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, .button-link { min-height: 48px; border: 0; border-radius: 12px; background: var(--navy); color: #fff; padding: 11px 17px; font-weight: 750; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
button:hover, .button-link:hover { background: var(--navy-2); }
button:disabled { opacity: .48; cursor: not-allowed; }
button.ghost { color: var(--navy); background: #fff; border: 1px solid #b9c8d5; }
button.ghost:hover { background: #f5f8fa; }
button.ghost.danger { color: var(--urgent); border-color: #d9a29e; }
button.ghost.danger:hover { background: var(--urgent-soft); border-color: var(--urgent); }
button.compact { min-height: 40px; padding: 8px 12px; }
h1, h2, h3, p { margin-top: 0; }
h1 { color: var(--navy); font-size: clamp(1.6rem, 4vw, 2.25rem); margin-bottom: 8px; }
h2 { color: var(--navy); font-size: 1.28rem; margin-bottom: 6px; }
h3 { color: var(--navy); margin-bottom: 4px; }
p { line-height: 1.48; color: var(--muted); }
label { display: grid; gap: 7px; color: var(--navy); font-weight: 720; }
input, select, textarea { width: 100%; min-height: 48px; border: 1px solid #afbfcc; border-radius: 10px; padding: 11px 12px; background: #fff; color: var(--ink); }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(23, 166, 199, .34); outline-offset: 2px; }

.app-header { min-height: 72px; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--navy); text-decoration: none; min-width: 0; }
.brand img { width: 98px; max-height: 42px; object-fit: contain; }
.brand span { display: grid; min-width: 0; }
.brand strong { font-size: 1.05rem; }
.brand small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.sync-button { background: var(--blue); }
.sync-button.pending { background: var(--finding); }
.connection-bar { background: #e8f0f6; color: var(--navy); padding: 7px 16px; text-align: center; font-weight: 700; font-size: .88rem; }
.connection-bar.offline { background: var(--finding-soft); color: #714600; }
.connection-bar.error { background: var(--urgent-soft); color: var(--urgent); }
.connection-bar.ok { background: var(--ok-soft); color: var(--ok); }
main { width: min(1180px, calc(100% - 28px)); margin: 24px auto 64px; }
[hidden] { display: none !important; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: clamp(18px, 3vw, 28px); }
.centered { max-width: 640px; margin: 60px auto; text-align: center; }
.view-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; margin-bottom: 20px; }
.view-heading p { margin-bottom: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .76rem; color: var(--blue); font-weight: 850; margin-bottom: 5px; }
.heading-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.message { min-height: 22px; color: var(--muted); margin-top: 8px; }
.message.error { color: var(--urgent); font-weight: 700; }
.message.ok { color: var(--ok); font-weight: 700; }

.inspection-list { display: grid; gap: 14px; }
.inspection-card { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 8px 20px rgba(11, 42, 74, .06); }
.inspection-card h2 { margin-bottom: 4px; }
.inspection-card p { margin: 0; }
.inspection-card-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.inspection-card-actions .ghost { background: #fff; }
.inspection-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.status-pill { padding: 5px 9px; border-radius: 999px; background: #e8f0f6; color: var(--navy); font-size: .82rem; font-weight: 750; }
.status-pill.done { background: var(--ok-soft); color: var(--ok); }
.empty-state { padding: 38px; text-align: center; background: #fff; border: 1px dashed #aebfcb; border-radius: 16px; }
.recovery-link { background: #714600; }
.recovery-link:hover { background: #563600; }
.recovery-back { background: #fff; color: var(--navy); border: 1px solid #b9c8d5; }
.recovery-panel { display: grid; gap: 18px; }
.recovery-warning { display: grid; gap: 4px; border: 1px solid #d8a84d; border-radius: 12px; padding: 14px; background: var(--finding-soft); color: #714600; }
.recovery-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.recovery-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.recovery-summary div { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #f7fafc; color: var(--muted); font-size: .85rem; }
.recovery-summary strong { display: block; color: var(--navy); font-size: 1.5rem; }
.recovery-results { display: grid; gap: 14px; }
.recovery-report { border: 1px solid var(--line); border-radius: 14px; padding: 15px; background: #fff; }
.recovery-report header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 10px; }
.recovery-report h2 { margin: 0; }
.recovery-report header span { color: var(--muted); font-size: .86rem; }
.recovery-units { display: grid; gap: 7px; }
.recovery-unit { display: grid; grid-template-columns: minmax(90px, .6fr) 1fr 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid #edf0f2; font-size: .86rem; }
.recovery-unit strong { color: var(--navy); }
.recovery-source { display: inline-flex; width: max-content; border-radius: 999px; padding: 4px 8px; background: #e8f0f6; color: var(--navy); font-size: .74rem; font-weight: 800; }

.setup-form { max-width: 820px; display: grid; gap: 20px; }
.project-select-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.project-select-row .ghost { min-height: 50px; white-space: nowrap; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; }
legend { color: var(--navy); font-weight: 800; margin-bottom: 6px; }
.field-help { margin: 0; font-size: .92rem; }
.preview-line { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.field-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.field-top-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.field-site { color: var(--navy); font-weight: 800; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-unit { position: static; display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 10px; max-width: 900px; text-align: center; padding: 8px 12px; margin: 0 auto 16px; background: linear-gradient(135deg, var(--navy), #164f7e); color: #fff; border-radius: 12px; box-shadow: 0 8px 18px rgba(11, 42, 74, .16); }
.active-unit > div { display: flex; align-items: baseline; justify-content: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.active-unit h1 { color: #fff; margin: 0; font-size: clamp(1.15rem, 2.5vw, 1.55rem); }
.active-unit span { display: inline; }
.unit-arrow { min-width: 44px; height: 44px; padding: 0; font-size: 1.65rem; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); }
.unit-list-button { min-height: 36px; padding: 6px 12px; border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.14); font-size: .84rem; }
.unit-list-button:hover { background: rgba(255,255,255,.24); }
.save-state { color: #cfe7f7; font-size: .84rem; font-weight: 700; }
.unit-picker { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; }
.unit-picker-backdrop { position: absolute; inset: 0; width: 100%; min-height: 100%; border: 0; border-radius: 0; padding: 0; background: rgba(5, 23, 41, .7); }
.unit-picker-backdrop:hover { background: rgba(5, 23, 41, .74); }
.unit-picker-panel { position: relative; z-index: 1; width: min(720px, 100%); max-height: min(84vh, 780px); overflow: auto; background: #fff; border-radius: 18px; box-shadow: 0 22px 60px rgba(0,0,0,.28); padding: clamp(18px, 3vw, 28px); }
.unit-picker-panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.unit-picker-panel h2 { margin: 0; }
.unit-list-summary { margin: 12px 0; color: var(--muted); font-weight: 700; }
.unit-add-form { margin: 0 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #f5f8fa; }
.unit-add-form label { display: block; margin-bottom: 7px; font-weight: 800; color: var(--navy); }
.unit-add-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.unit-add-form input { min-width: 0; }
.unit-add-form button { min-height: 46px; }
.unit-manage-message { min-height: 1.3em; margin: 0 0 10px; color: var(--muted); font-size: .84rem; font-weight: 700; }
.unit-manage-message.ok { color: var(--ok); }
.unit-manage-message.error { color: var(--urgent); }
.unit-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.unit-choice { min-height: 74px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 5px; padding: 5px; color: var(--navy); background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.unit-choice:hover { background: #f5f8fa; }
.unit-choice.current { border: 2px solid var(--blue); background: #eef7fc; }
.unit-choice-open { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px 8px; text-align: left; color: var(--navy); background: transparent; border: 0; }
.unit-choice-open:hover { background: rgba(37, 126, 177, .08); }
.unit-choice-main { min-width: 0; display: grid; gap: 3px; }
.unit-choice-main strong { overflow: hidden; text-overflow: ellipsis; }
.unit-choice-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-choice-actions { display: flex; flex-direction: column; gap: 4px; }
.unit-choice-action { min-width: 38px; min-height: 30px; padding: 4px 7px; color: var(--navy); background: #fff; border: 1px solid var(--line); font-size: .9rem; }
.unit-choice-action.delete { color: var(--urgent); }
.unit-choice-status { border-radius: 999px; padding: 5px 8px; font-size: .76rem; font-weight: 850; white-space: nowrap; background: #e8f0f6; color: var(--navy); }
.unit-choice-status.in-progress { background: var(--finding-soft); color: #714600; }
.unit-choice-status.complete { background: var(--ok-soft); color: var(--ok); }
.unit-picker-help { margin: 14px 0 0; font-size: .86rem; }
.field-grid { display: grid; gap: 16px; max-width: 900px; margin: 0 auto; }
.resident-panel { display: grid; gap: 10px; }
.resident-entry { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.resident-entry .dictation-button { min-height: 48px; }
.resident-panel .field-help { color: var(--muted); font-weight: 500; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading h2 { margin-bottom: 0; }
.mini-legend { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.dot.ok { background: var(--ok); }
.dot.finding { background: var(--finding); }

.checklist { display: grid; gap: 10px; }
.check-item { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 12px; }
.check-item h3 { font-size: 1rem; }
.check-item p { font-size: .86rem; margin: 0; }
.check-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.check-buttons button { min-height: 42px; padding: 8px; background: #fff; color: var(--navy); border: 1px solid #b8c7d2; font-size: .86rem; }
.check-buttons button[data-value="ok"].selected { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.check-buttons button[data-value="finding"].selected { background: var(--finding-soft); border-color: var(--finding); color: #7b4c00; }
.check-buttons button[data-value="na"].selected { background: #e9edf0; border-color: #66727c; color: #3e4952; }
.finding-detail { border: 1px solid #e6b760; border-radius: 12px; background: #fff8eb; padding: 14px; display: grid; gap: 10px; }
.finding-detail textarea { border-color: #d2a44d; background: #fff; }
.finding-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.finding-actions button { min-height: 52px; }
.finding-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: #76501a; font-size: .8rem; font-weight: 700; }
.finding-interim { margin: 0; }

.speech-interim { min-height: 24px; color: var(--blue); font-style: italic; margin-top: 8px; }
.dictation-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.dictation-actions span { color: var(--muted); font-size: .88rem; }
.dictation-button { background: var(--blue); min-width: 190px; }
.dictation-button.recording { background: var(--urgent); animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(180, 35, 24, .13); } }

.photo-panel { display: grid; gap: 13px; }
.count-badge { background: #e8f0f6; color: var(--navy); border-radius: 999px; padding: 6px 10px; font-size: .85rem; font-weight: 800; }
.camera-button { min-height: 62px; border-radius: 14px; background: var(--blue); color: #fff; display: flex; justify-content: center; align-items: center; font-size: 1.06rem; cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.photo-card { position: relative; background: #edf2f5; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-height: 120px; }
.photo-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.photo-card footer { padding: 8px; color: var(--navy); font-size: .78rem; font-weight: 700; }
.photo-card .pending { color: var(--finding); }
.photo-delete { position: absolute; right: 6px; top: 6px; min-width: 38px; min-height: 38px; padding: 0; border-radius: 50%; background: rgba(11,42,74,.9); }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

.overall-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.overall-options button { background: #fff; color: var(--navy); border: 1px solid #b8c7d2; min-height: 60px; }
.overall-options button[data-overall="ok"].selected { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.overall-options button[data-overall="repair"].selected { color: #7b4c00; border-color: var(--finding); background: var(--finding-soft); }
.overall-options button[data-overall="urgent"].selected { color: var(--urgent); border-color: var(--urgent); background: var(--urgent-soft); }
.finish-bar { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 12px; background: #eef3f6; border: 1px solid var(--line); border-radius: 16px; }
.finish-bar button:first-child { min-height: 60px; font-size: 1.02rem; }

.report-draft-notice { max-width: 680px; }
.report-draft-notice.warning { color: #7b4c00; font-weight: 750; }
.report-draft-notice.ok { color: var(--ok); font-weight: 750; }
.report-options { max-width: 960px; margin: 0 auto 14px; padding: 15px 18px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.report-options > div { display: grid; gap: 3px; color: var(--muted); font-size: .88rem; }
.report-options > div strong { color: var(--navy); font-size: .94rem; }
.privacy-toggle { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 9px; font-size: .88rem; white-space: nowrap; }
.privacy-toggle input { width: 20px; min-height: 20px; }

.report-sheet { background: #fff; max-width: 960px; margin: 0 auto; padding: 38px; box-shadow: var(--shadow); counter-reset: report-figure; }
.report-cover { min-height: 1040px; position: relative; display: flex; flex-direction: column; border-left: 8px solid #17255f; padding: 12px 24px 30px 70px; page-break-after: always; break-after: page; }
.report-cover-logo { width: 165px; max-height: 74px; object-fit: contain; object-position: left center; }
.report-cover-photo { width: min(100%, 650px); height: 360px; object-fit: cover; margin: 250px 0 56px auto; }
.report-cover-placeholder { width: min(100%, 650px); height: 220px; margin: 300px 0 70px auto; background: linear-gradient(135deg, #e8f0f6, #f7fafc); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.report-cover-title { margin: auto 0 0 auto; width: min(100%, 720px); text-align: right; }
.report-cover-title h1 { color: #17255f; font-size: 2.35rem; text-transform: uppercase; margin-bottom: 26px; }
.report-cover-main-title { color: #17255f; font-size: 2.35rem; line-height: 1.1; text-transform: uppercase; font-weight: 900; margin-bottom: 26px; }
.report-cover-title h2 { color: #111; font-size: 1.55rem; }
.report-cover-site { color: #111; font-size: 1.55rem; font-weight: 800; margin-bottom: 10px; }
.report-cover-title p { color: #111; font-size: 1.1rem; }
.report-draft-badge { position: absolute; top: 22px; right: 22px; border: 2px solid #a76500; color: #7b4c00; background: #fff8eb; border-radius: 6px; padding: 8px 12px; font-weight: 900; letter-spacing: .14em; }
.report-cover-footer { margin-top: 150px; color: #111; font-size: .82rem; }
.report-cover-footer strong { display: block; }
.report-content { color: #111; }
.report-page-header { display: grid; grid-template-columns: 145px 1fr auto; align-items: center; gap: 18px; border-bottom: 1px solid #111; padding-bottom: 10px; margin-bottom: 24px; }
.report-page-header img { width: 130px; max-height: 58px; object-fit: contain; }
.report-page-header strong { font-size: 1.05rem; }
.report-page-header span { text-align: right; font-size: .86rem; }
.report-toc { page-break-after: always; break-after: page; min-height: 900px; }
.report-toc h1 { font-size: 1.55rem; color: #111; }
.report-toc ol { display: grid; gap: 11px; padding-left: 24px; font-size: 1.02rem; }
.report-toc li::marker { font-weight: 800; }
.report-section { margin: 0 0 28px; }
.report-section h1 { color: #111; font-size: 1.35rem; text-transform: uppercase; margin-bottom: 16px; }
.report-section h2 { color: #111; font-size: 1.05rem; margin: 20px 0 8px; }
.report-section p, .report-editable { color: #111; line-height: 1.48; }
.report-editable { min-height: 1.5em; white-space: pre-wrap; border: 1px dashed #9fb0bd; border-radius: 6px; background: #fbfdff; padding: 7px 9px; }
.report-editable:focus { outline: 3px solid rgba(23, 166, 199, .28); border-color: var(--cyan); }
.report-editable.inline { display: inline-block; min-width: 220px; }
.report-review-warning { border: 1px solid #d8a84d; background: #fff8eb; color: #714600; padding: 12px 14px; margin: 18px 0 26px; font-weight: 750; }
.report-info-table { width: 100%; border-collapse: collapse; margin-bottom: 28px; }
.report-info-table th, .report-info-table td { padding: 8px 10px; border-bottom: 1px solid #ccd4dc; vertical-align: top; text-align: left; }
.report-info-table th { width: 28%; color: #111; }
.report-finding-table { width: 100%; border-collapse: collapse; margin: 13px 0 22px; font-size: .9rem; }
.report-finding-table th, .report-finding-table td { border: 1px solid #cbd5dd; padding: 8px; text-align: left; vertical-align: top; }
.report-finding-table th { background: #eef3f6; color: #0b2a4a; }
.report-signature { margin-top: 58px; }
.report-appendices { page-break-before: always; break-before: page; }
.report-appendix-intro { page-break-after: always; break-after: page; min-height: 900px; }
.appendix-unit { page-break-before: always; break-before: page; }
.appendix-unit:first-of-type { page-break-before: auto; break-before: auto; }
.appendix-unit-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; border-bottom: 3px solid var(--navy); margin-bottom: 14px; padding-bottom: 10px; }
.appendix-unit-header h2 { margin: 0; font-size: 1.45rem; }
.appendix-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 14px; font-size: .87rem; }
.appendix-meta strong { color: var(--navy); }
.appendix-check-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.appendix-check-table th, .appendix-check-table td { border: 1px solid #ccd4dc; padding: 7px 8px; text-align: left; vertical-align: top; }
.appendix-check-table th { background: #eef3f6; }
.appendix-check-table th:nth-child(1) { width: 30%; }
.appendix-check-table th:nth-child(2) { width: 19%; }
.appendix-note { white-space: pre-wrap; background: #f6f8fa; border-left: 4px solid var(--navy); padding: 10px 12px; margin: 13px 0; }
.appendix-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.appendix-photo { margin: 0; break-inside: avoid; counter-increment: report-figure; }
.appendix-photo img { width: 100%; height: 230px; object-fit: cover; border: 1px solid #ccd4dc; }
.appendix-photo figcaption { font-size: .78rem; color: #3e4952; margin-top: 4px; }
.appendix-photo figcaption::before { content: "Kuva " counter(report-figure) ". "; font-weight: 800; }
.report-footer { margin-top: 34px; border-top: 1px solid #111; padding-top: 8px; color: #3e4952; font-size: .76rem; display: flex; justify-content: space-between; gap: 20px; }

.report-header { display: grid; grid-template-columns: 130px 1fr; gap: 24px; border-bottom: 3px solid var(--navy); padding-bottom: 20px; margin-bottom: 22px; }
.report-header img { width: 130px; }
.report-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin: 18px 0 24px; }
.report-meta div { border-bottom: 1px solid var(--line); padding-bottom: 7px; }
.report-meta strong { display: block; color: var(--navy); font-size: .8rem; text-transform: uppercase; }
.report-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0 26px; }
.summary-number { border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.summary-number strong { display: block; color: var(--navy); font-size: 1.6rem; }
.report-unit { break-inside: avoid; border-top: 2px solid var(--navy); padding-top: 16px; margin-top: 28px; }
.report-unit-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.report-resident { margin: -2px 0 12px; color: var(--ink); }
.report-resident strong { color: var(--navy); }
.report-status { border-radius: 999px; padding: 6px 10px; font-weight: 800; font-size: .83rem; }
.report-status.ok { background: var(--ok-soft); color: var(--ok); }
.report-status.repair { background: var(--finding-soft); color: #7b4c00; }
.report-status.urgent { background: var(--urgent-soft); color: var(--urgent); }
.report-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; margin: 14px 0; }
.report-check { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #edf0f2; padding: 5px 0; font-size: .88rem; }
.report-check-block { break-inside: avoid; }
.report-check-note { white-space: pre-wrap; margin: 2px 0 7px; padding: 7px 9px; border-left: 3px solid var(--finding); background: var(--finding-soft); color: #61400e; font-size: .82rem; }
.report-notes { white-space: pre-wrap; background: #f6f8fa; border-radius: 10px; padding: 12px; }
.report-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.report-photo { margin: 0; break-inside: avoid; }
.report-photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.report-photo figcaption { font-size: .75rem; color: var(--muted); }

@media (max-width: 720px) {
  main { width: min(100% - 18px, 1180px); margin-top: 12px; }
  .app-header { min-height: 64px; }
  .brand img { width: 78px; }
  .brand small { max-width: 180px; }
  .header-actions { gap: 5px; }
  .header-actions button { padding-inline: 9px; font-size: .82rem; }
  .recovery-summary { grid-template-columns: 1fr 1fr; }
  .recovery-unit { grid-template-columns: 1fr 1fr; }
  .header-actions #homeButton { display: none; }
  .view-heading { display: grid; }
  .view-heading > button { width: 100%; }
  .two-columns { grid-template-columns: 1fr; }
  .project-select-row { grid-template-columns: 1fr; }
  .project-select-row .ghost { width: 100%; }
  .inspection-card { grid-template-columns: 1fr; }
  .inspection-card-actions { justify-content: stretch; }
  .inspection-card-actions button { width: 100%; }
  .active-unit { gap: 7px; padding: 7px 9px; }
  .active-unit > div { gap: 4px 8px; }
  .unit-list-button { flex-basis: 100%; width: min(220px, 100%); }
  .unit-picker { padding: 10px; align-items: end; }
  .unit-picker-panel { width: 100%; max-height: 88vh; border-radius: 18px 18px 8px 8px; }
  .unit-add-form > div { grid-template-columns: 1fr; }
  .unit-add-form button { width: 100%; }
  .unit-list { grid-template-columns: 1fr; }
  .field-topbar { align-items: stretch; }
  .field-top-actions { display: grid; grid-template-columns: 1fr; flex: 1; }
  .field-top-actions button { width: 100%; }
  .field-site { display: none; }
  .check-buttons { grid-template-columns: 1fr; }
  .check-buttons button { min-height: 48px; }
  .finding-actions { grid-template-columns: 1fr; }
  .resident-entry { grid-template-columns: 1fr; }
  .resident-entry .dictation-button { width: 100%; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .overall-options { grid-template-columns: 1fr; }
  .finish-bar { grid-template-columns: 1fr; }
  .report-sheet { padding: 20px; }
  .report-options { align-items: stretch; flex-direction: column; }
  .privacy-toggle { white-space: normal; }
  .report-cover { min-height: 900px; padding-left: 28px; }
  .report-cover-photo { height: 260px; margin-top: 180px; }
  .report-cover-placeholder { margin-top: 220px; }
  .report-cover-title h1 { font-size: 1.75rem; }
  .report-page-header { grid-template-columns: 100px 1fr; }
  .report-page-header img { width: 96px; }
  .report-page-header span { grid-column: 1 / -1; text-align: left; }
  .appendix-photos { grid-template-columns: 1fr; }
  .appendix-photo img { height: auto; aspect-ratio: 4 / 3; }
  .report-header { grid-template-columns: 1fr; }
  .report-header img { width: 110px; }
  .report-meta { grid-template-columns: 1fr; }
  .report-summary { grid-template-columns: 1fr 1fr; }
  .report-checks { grid-template-columns: 1fr; }
  .report-photos { grid-template-columns: 1fr 1fr; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 10pt; }
  .app-header, .connection-bar, .print-hide { display: none !important; }
  main { width: 100%; margin: 0; }
  .report-sheet { box-shadow: none; padding: 0; max-width: none; }
  .report-cover { min-height: 272mm; }
  .report-cover-photo { margin-top: 64mm; height: 90mm; }
  .report-cover-placeholder { margin-top: 78mm; height: 55mm; }
  .report-cover-footer { margin-top: 32mm; }
  .report-toc, .report-appendix-intro { min-height: 250mm; }
  .report-editable { border: 0; background: transparent; padding: 0; }
  .report-review-warning { display: none; }
  .appendix-photo img { height: 68mm; }
  .report-unit { break-inside: avoid; }
}
