:root { --bg:#f5f6f8; --card:#fff; --ink:#1c2430; --muted:#6c7683; --line:#dde2e7; --accent:#17324d; }
* { box-sizing:border-box; }
body { margin:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif; background:var(--bg); color:var(--ink); padding-bottom:env(safe-area-inset-bottom); }
a { color:inherit; text-decoration:none; }
.header { position:sticky; top:0; z-index:10; background:#fff; border-bottom:1px solid var(--line); padding:14px 16px; padding-top:max(14px, env(safe-area-inset-top)); display:flex; align-items:center; gap:12px; }
.header h1 { font-size:18px; margin:0; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
.header a { font-weight:800; white-space:nowrap; }
.container { width:min(920px,100%); margin:0 auto; padding:16px; padding-bottom:120px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:16px; padding:16px; margin-bottom:14px; box-shadow:0 2px 8px rgba(0,0,0,.03); }
.job-title { font-size:20px; font-weight:750; margin-bottom:6px; }
.meta { color:var(--muted); font-size:14px; line-height:1.55; }
.row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.spacer { flex:1; }
.btn { display:inline-flex; align-items:center; justify-content:center; min-height:44px; border-radius:12px; border:1px solid var(--accent); background:var(--accent); color:#fff; padding:10px 14px; font-weight:700; cursor:pointer; }
.btn.secondary { background:#fff; color:var(--accent); }
.btn.danger { background:#8d1d1d; border-color:#8d1d1d; }
.btn.full { width:100%; }
.section-title { margin:22px 2px 10px; font-size:13px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); font-weight:800; }
.badge { display:inline-block; border-radius:999px; padding:5px 9px; font-size:12px; font-weight:800; text-transform:uppercase; background:#e8edf2; }
.badge.unprioritised { background:#e8edf2; }
.badge.low { background:#e9f5ed; }
.badge.medium { background:#fff3d8; }
.badge.high { background:#ffe4d6; }
.badge.urgent { background:#ffd9d9; }
.issue { display:grid; grid-template-columns:54px 1fr; gap:12px; cursor:pointer; position:relative; }
.issue-no { width:44px; height:44px; display:grid; place-items:center; border-radius:50%; background:#edf1f5; font-weight:800; }
.issue-side { display:flex; flex-direction:column; align-items:center; gap:6px; }
.issue-order-controls { display:flex; flex-direction:column; gap:4px; width:44px; }
.issue-order-controls .btn { min-height:32px; padding:4px; font-size:15px; line-height:1; }
.issue-order-controls .btn:disabled { opacity:.35; cursor:default; }
body.merge-on .issue-order-controls { display:none; }
.issue h3 { margin:0 0 6px; font-size:17px; }
.issue p { margin:7px 0; }
.issue-photo { width:100%; max-height:320px; object-fit:cover; border-radius:12px; margin-top:10px; border:1px solid var(--line); }
label { display:block; margin:14px 0 6px; font-weight:700; }
input, textarea, select { width:100%; min-height:44px; border:1px solid #cfd6dd; border-radius:10px; padding:10px 12px; font:inherit; background:#fff; }
textarea { min-height:110px; resize:vertical; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.empty { text-align:center; color:var(--muted); padding:30px 15px; }
.fab { position:fixed; right:18px; bottom:20px; border:0; border-radius:999px; padding:15px 20px; background:var(--accent); color:#fff; font-size:16px; font-weight:800; box-shadow:0 8px 25px rgba(0,0,0,.2); }
.thumb-row { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; margin-top:10px; }
.thumb-row img { width:100%; height:150px; object-fit:contain; background:#eef1f4; border-radius:10px; border:1px solid var(--line); }
.photo-frame { position:relative; display:block; }
.photo-frame img { display:block; width:100%; }
.markup-layer { position:absolute; left:0; top:0; width:100%; height:100%; pointer-events:none; }
.thumb-link { border-radius:10px; overflow:hidden; }
.thumb-markup { position:absolute; left:8px; right:8px; bottom:8px; z-index:2; background:rgba(23,50,77,.9); color:#fff; font-size:13px; font-weight:800; text-align:center; border-radius:8px; padding:7px 8px; }
.issue-photo-frame { margin-top:10px; border-radius:12px; overflow:hidden; border:1px solid var(--line); background:#eef1f4; }
.issue-photo-frame .issue-photo { margin-top:0; border:0; max-height:360px; object-fit:contain; }
@media (max-width:600px){ .container{padding:12px 12px 120px;} .grid2{grid-template-columns:1fr;} .card{border-radius:14px;} }
@media print { .no-print,.header,.fab,.fab-group,.merge-actionbar,.project-toolbar,.busy {display:none!important;} body{background:white;} .container{width:100%;max-width:none;padding:0;} .card{box-shadow:none;break-inside:avoid;border:0;border-bottom:1px solid #ccc;border-radius:0;} }

.photo-actions { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:8px; }
.photo-picker { position:relative; margin:0; min-height:54px; border:1px solid var(--accent); border-radius:12px; display:flex; align-items:center; justify-content:center; padding:12px; font-weight:800; color:var(--accent); background:#fff; cursor:pointer; text-align:center; }
.photo-picker.camera-picker { background:var(--accent); color:#fff; }
.photo-picker input[type=file] { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.photo-help { margin-top:8px; font-size:13px; line-height:1.4; color:var(--muted); }
@media (max-width:420px){ .photo-actions{grid-template-columns:1fr;} }
.fab-group { position:fixed; right:18px; bottom:calc(20px + env(safe-area-inset-bottom)); display:flex; gap:10px; align-items:center; z-index:20; }
.fab-group .fab { position:static; }
.fab-secondary { background:#fff; color:var(--accent); border:1px solid var(--accent); }
.batch-heading { margin:0 0 6px; font-size:19px; }
.batch-select { margin-top:14px; }
.batch-card { padding:12px; }
.batch-top { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.batch-number { width:32px; height:32px; border-radius:50%; display:grid; place-items:center; background:#edf1f5; font-weight:800; }
.batch-remove { margin-left:auto; border:0; background:transparent; color:#8d1d1d; font-weight:750; padding:8px; }
.batch-preview { display:block; width:100%; max-height:420px; object-fit:contain; background:#eef1f4; border-radius:12px; border:1px solid var(--line); }
.batch-card.grouped { border-left:4px solid var(--accent); margin-top:-8px; }
.batch-fields[hidden] { display:none; }
.merge-row { display:flex; align-items:center; gap:9px; padding:11px; margin-top:10px; border:1px solid var(--line); border-radius:10px; background:#fafbfc; min-height:44px; }
.merge-row input { width:22px; min-height:22px; margin:0; }
.batch-savebar { position:sticky; bottom:0; z-index:15; padding:10px 0 calc(16px + env(safe-area-inset-bottom)); background:linear-gradient(transparent,var(--bg) 22%); }
.busy { position:fixed; inset:0; background:rgba(28,36,48,.55); color:#fff; display:grid; place-items:center; z-index:80; font-weight:800; padding:24px; text-align:center; }
.busy[hidden] { display:none !important; }
.job-search label:first-of-type { margin-top:0; }
.job-search-actions { display:grid; grid-template-columns:1fr; gap:10px; margin-top:14px; }
.job-search-actions:has(a) { grid-template-columns:1fr 1fr; }
.job-search-actions .btn { width:100%; }
.project-toolbar { margin:0 2px 14px; }
.toolbar-help { margin:8px 0 0; }
.issue-check { position:absolute; left:10px; top:10px; z-index:2; background:#fff; border-radius:6px; padding:4px; }
.issue-check input { width:22px; min-height:22px; margin:0; }
body.merge-on .fab-group { display:none; }
body.merge-on .issue.selected { border-color:var(--accent); background:#f3f6f9; }
.merge-actionbar { position:sticky; bottom:calc(8px + env(safe-area-inset-bottom)); z-index:25; display:flex; gap:10px; padding:10px 0 6px; background:linear-gradient(transparent,var(--bg) 28%); }
.merge-actionbar .btn { flex:1; }
.merge-actionbar[hidden] { display:none; }
.job-card { position:relative; cursor:pointer; }
.job-check { position:absolute; left:10px; top:10px; z-index:2; background:#fff; border-radius:6px; padding:4px; }
.job-check input { width:22px; min-height:22px; margin:0; }
body.merge-on .job-card.selected { border-color:var(--accent); background:#f3f6f9; }
.merged-jobs { margin-top:10px; padding-top:10px; border-top:1px solid var(--line); }
.thumb-item { display:flex; flex-direction:column; gap:8px; }
.photo-order-controls { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.photo-order-controls .btn { min-height:40px; padding:8px; font-size:18px; line-height:1; }
.photo-order-controls .btn:disabled { opacity:.35; cursor:default; }
.report-actions { display:flex; flex-direction:column; gap:10px; }
.report-actions .meta { margin:0; }
.notice { border-color:#b7c9da; background:#f3f7fb; }
.danger-notice { border-color:#e2b6b6; background:#fff5f5; color:#8d1d1d; }
.signature-wrap { margin-top:8px; border:1px solid var(--line); border-radius:12px; overflow:hidden; background:#fff; touch-action:none; }
#signaturePad { display:block; width:100%; height:auto; touch-action:none; cursor:crosshair; }
.signature-actions { display:flex; flex-wrap:wrap; gap:12px; align-items:center; margin-top:10px; }
.sig-clear-label { display:flex; align-items:center; gap:8px; margin:0; font-weight:600; color:var(--muted); }
.sig-clear-label input { width:auto; min-height:0; }
.sig-preview-block { margin-top:14px; }
.sig-preview, .logo-preview, .cover-logo { display:block; max-width:min(320px,100%); max-height:110px; object-fit:contain; background:#fff; border:1px solid var(--line); border-radius:10px; padding:8px; margin-top:8px; }
.sig-on-page { border:0; border-radius:0; padding:0; background:transparent; box-shadow:none; }
.cover-logo-center { margin-left:auto; margin-right:auto; }
.cover-site-title { margin:18px 0 14px; font-size:28px; line-height:1.2; text-align:center; }
.cover-report-title { text-align:center; font-size:17px; font-weight:650; margin:-6px 0 14px; color:var(--ink); }
.cover-card .cover-signoff { margin-top:40px; padding-top:16px; border-top:1px solid var(--line); }
.photo-edit-list { display:flex; flex-direction:column; gap:14px; margin-top:10px; }
.photo-edit-item { display:grid; grid-template-columns:minmax(140px,1fr) 1.2fr; gap:12px; padding:12px; border:1px solid var(--line); border-radius:12px; background:#fafbfc; }
.photo-edit-media { display:flex; flex-direction:column; gap:8px; }
.photo-move-row { display:flex; flex-direction:column; gap:8px; }
.photo-move-row label { margin:4px 0 0; font-size:13px; }
.photo-move-row select { min-height:40px; }
.photo-edit-fields textarea { min-height:96px; }
.photo-scale-bar { margin:8px 0 14px; padding:12px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.photo-scale-controls { display:flex; align-items:center; gap:10px; margin-top:8px; }
.photo-scale-controls .btn { min-width:48px; }
.preview-photo-row { margin-top:12px; }
.preview-photo-row.with-comment { display:flex; flex-wrap:wrap; gap:12px; align-items:flex-start; margin-top:12px; }
.preview-photo-row.with-comment .photo-frame { flex:0 1 auto; }
.preview-photo-row.with-comment .preview-photo-comment { flex:1 1 140px; min-width:140px; }
.preview-photo-row.stacked { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.preview-photo-comment { font-size:14px; line-height:1.45; color:var(--ink); }
.issue-photo.scale-1 { max-height:160px; max-width:42%; }
.issue-photo.scale-2 { max-height:210px; max-width:55%; }
.issue-photo.scale-3 { max-height:280px; max-width:70%; }
.issue-photo.scale-4 { max-height:340px; max-width:85%; }
.issue-photo.scale-5 { max-height:420px; max-width:100%; }
.preview-photo-row.stacked .issue-photo {
  max-width:100%;
}
.photo-frame.markup-drawn { overflow:hidden; }
.photo-frame.markup-drawn img { visibility:hidden; position:absolute; width:1px; height:1px; }
.rot-90 img { transform:rotate(90deg); transform-origin:center center; }
.rot-180 img { transform:rotate(180deg); transform-origin:center center; }
.rot-270 img { transform:rotate(270deg); transform-origin:center center; }
@media (max-width:700px){
  .photo-edit-item, .preview-photo-row.with-comment, .preview-photo-row.stacked { grid-template-columns:1fr; }
}
code { font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:13px; }
@media(max-width:520px){ .fab-group{left:12px;right:12px}.fab-group .fab{flex:1;text-align:center;padding:14px 10px}.batch-preview{max-height:340px} }

.markup-body { background:#111; touch-action:none; overscroll-behavior:none; }
body.markup-open { overflow:hidden; position:fixed; inset:0; width:100%; height:100%; touch-action:none; overscroll-behavior:none; }
.markup-overlay { position:fixed; inset:0; z-index:100; background:#111; color:#fff; touch-action:none; overscroll-behavior:none; -webkit-user-select:none; user-select:none; }
.markup-stage { position:absolute; inset:0; overflow:hidden; display:flex; align-items:center; justify-content:center; background:#111; touch-action:none; overscroll-behavior:none; }
.markup-stage canvas { touch-action:none; background:#000; display:block; flex:0 0 auto; }
.markup-top { position:absolute; left:0; right:0; top:0; z-index:5; display:flex; align-items:center; gap:8px; padding:8px 10px; padding-top:max(8px, env(safe-area-inset-top)); background:rgba(0,0,0,.55); touch-action:manipulation; }
.markup-top h1 { margin:0; flex:1; font-size:16px; color:#fff; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.markup-top .btn { min-height:40px; padding:8px 12px; }
.markup-dock { position:absolute; left:0; right:0; bottom:0; z-index:5; background:rgba(0,0,0,.55); padding:6px 8px calc(8px + env(safe-area-inset-bottom)); touch-action:manipulation; }
.markup-tools, .markup-sizes { display:flex; gap:5px; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.markup-tools button, .markup-sizes button { flex:1; min-width:52px; min-height:38px; border:1px solid #3a3a3a; background:#2a2a2a; color:#fff; border-radius:9px; font-weight:750; font-size:13px; }
.markup-tools button.on, .markup-sizes button.on { background:#fff; color:#111; border-color:#fff; }
.markup-swatch-block { display:flex; flex-direction:column; gap:4px; }
.markup-swatch-label { color:#fff; font-weight:750; font-size:12px; letter-spacing:.06em; text-transform:uppercase; }
.markup-swatch-label[hidden] { display:none; }
.markup-colors { display:flex; gap:8px; justify-content:center; padding:4px 0 6px; }
.markup-colors button {
  -webkit-appearance:none; appearance:none;
  flex:1; min-width:0; height:36px; min-height:36px; width:auto;
  border-radius:8px; border:3px solid rgba(255,255,255,.35); padding:0;
  background:var(--swatch,#e03131) !important; background-color:var(--swatch,#e03131) !important;
}
.markup-colors button.on { border-color:#fff; box-shadow:0 0 0 2px #111; }
.markup-outline-block.is-outline .markup-colors button {
  background:#1a1a1a !important; background-color:#1a1a1a !important;
  box-shadow:inset 0 0 0 7px var(--swatch,#e03131);
}
.markup-outline-block.is-outline .markup-colors button.on {
  border-color:#fff; box-shadow:inset 0 0 0 7px var(--swatch,#e03131), 0 0 0 2px #111;
}
.markup-row { display:flex; gap:6px; align-items:center; }
.markup-row .markup-sizes { flex:1; }
.markup-row .btn { min-height:38px; padding:6px 8px; font-size:13px; }
.markup-textbar { display:flex; flex-direction:column; gap:10px; padding:0 0 10px; touch-action:manipulation; }
.markup-textbar[hidden] { display:none; }
.markup-text-colors { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.markup-swatch {
  -webkit-appearance:none; appearance:none;
  display:block; width:100%; height:44px; min-height:44px; min-width:0; padding:0;
  border-radius:10px; border:3px solid rgba(255,255,255,.4);
  background:var(--swatch,#e03131) !important; background-color:var(--swatch,#e03131) !important;
}
.markup-swatch.on { border-color:#fff; box-shadow:0 0 0 2px #111; }
.markup-text-size { display:flex; align-items:center; gap:8px; color:#fff; font-weight:750; font-size:14px; }
.markup-text-size span { flex:0 0 auto; }
.markup-text-size .text-size-val { flex:0 0 2.4em; text-align:right; font-variant-numeric:tabular-nums; }
.markup-text-size .text-size-range {
  -webkit-appearance:none; appearance:none;
  flex:1; width:auto; height:8px; min-height:8px; padding:0; margin:0;
  background:#4a4a4a; border:0; border-radius:999px;
}
.markup-text-size .text-size-range::-webkit-slider-thumb {
  -webkit-appearance:none; appearance:none;
  width:28px; height:28px; border-radius:50%; background:#fff; border:0;
}
.markup-text-size .text-size-range::-moz-range-thumb {
  width:28px; height:28px; border-radius:50%; background:#fff; border:0;
}
.markup-text-entry { display:flex; gap:8px; }
.markup-text-entry input[type="text"] { flex:1; min-height:44px; }
.markup-text-entry .btn { flex:0 0 auto; }
.batch-preview-wrap { margin-top:8px; }
.batch-preview-wrap .batch-preview { max-height:340px; }
