:root {
  --navy: #16213f;
  --navy-light: #2f4f7c;
  --primary: #2546f0;
  --primary-dark: #1c35c2;
  --gold: #c79a4b;
  --gold-light: #f4e6c8;
  --accent: #e76f51;
  --green: #1f9d55;
  --green-dark: #18803f;
  --border: #e4e7ed;
  --border-light: #eef0f4;
  --bg: #f3f5f9;
  --text: #1c2230;
  --muted: #6b7280;
  --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.04);
  --card-shadow-hover: 0 4px 10px rgba(16, 24, 40, 0.05), 0 14px 32px rgba(16, 24, 40, 0.07);
  --font-display: 'Plus Jakarta Sans', 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 480px at 12% -10%, rgba(37, 70, 240, 0.06), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, rgba(199, 154, 75, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

/* --- Top bar --- */
.topbar {
  background: linear-gradient(120deg, var(--navy) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 18px 32px;
  position: relative;
  box-shadow: 0 4px 24px rgba(22, 33, 63, 0.18);
}
.topbar::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold) 0%, rgba(199,154,75,0.15) 45%, rgba(199,154,75,0) 75%);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
}
.brand-mark {
  width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  box-shadow: 0 0 0 4px rgba(199, 154, 75, 0.18);
  transform: rotate(45deg);
}
.brand {
  font-family: var(--font-display);
  font-size: 1.32em; font-weight: 800; letter-spacing: 0.14em;
}
.brand-sub {
  font-size: 0.8em; color: rgba(255,255,255,0.6); font-weight: 500;
  letter-spacing: 0.04em;
  padding-left: 14px; border-left: 1px solid rgba(255,255,255,0.18);
  margin-left: 2px;
}

.page { max-width: 1280px; margin: 0 auto; padding: 36px 32px 80px; }

header { margin-bottom: 34px; }
h1 {
  margin: 0; font-size: 2.3em; font-weight: 800; letter-spacing: -0.02em;
  font-family: var(--font-display);
  color: var(--navy);
}
.title-accent {
  display: block; width: 64px; height: 4px; margin: 14px 0 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--primary) 100%);
}
.subtitle { margin: 14px 0 0; color: var(--muted); font-size: 0.96em; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(0, 430px); gap: 26px; align-items: start; }
.layout > * { min-width: 0; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
}

/* --- Saved jobs sidebar --- */
.jobs-col .card { padding: 20px; position: sticky; top: 28px; }
.jobs-col h2 {
  font-size: 0.82em; margin-bottom: 16px; padding-bottom: 12px;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
  font-weight: 800; border-bottom: 1px solid var(--border-light);
}
.new-quote-btn {
  width: 100%; padding: 12px 14px; margin-bottom: 16px;
  background: linear-gradient(120deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border: none; border-radius: 10px; cursor: pointer;
  font-weight: 700; font-size: 0.85em; letter-spacing: 0.01em;
  box-shadow: 0 4px 14px rgba(37, 70, 240, 0.22);
  transition: filter 0.15s, transform 0.12s;
}
.new-quote-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.new-quote-btn:active { transform: translateY(0); }
.jobs-list { display: flex; flex-direction: column; gap: 8px; }
.job-item {
  border: 1.5px solid var(--border); border-radius: 10px; padding: 11px 13px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s, transform 0.1s;
  position: relative; background: #fff;
}
.job-item:hover { border-color: var(--primary); background: #f5f8fe; }
.job-item.active {
  border-color: var(--primary); background: #eef2fb;
  box-shadow: 0 0 0 3px rgba(37, 70, 240, 0.1);
}
.job-item .job-name { font-weight: 700; font-size: 0.88em; color: var(--text); margin-bottom: 4px; word-break: break-word; }
.job-item .job-meta { font-size: 0.76em; color: var(--muted); }
.job-item .job-actions { display: flex; gap: 6px; margin-top: 9px; }
.job-item .job-actions button {
  flex: 1; font-size: 0.72em; padding: 5px 6px; border-radius: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  cursor: pointer; font-weight: 600; transition: border-color 0.15s, color 0.15s;
}
.job-item .job-actions button:hover { border-color: var(--primary); color: var(--primary); }
.job-item .job-actions button.danger:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 980px) {
  .jobs-col .card { position: static; }
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 32px;
  margin-bottom: 22px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}
.card:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: #d8dce6;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.05em;
  color: var(--navy);
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.branz-link {
  margin-left: auto;
  font-size: 0.78em; font-weight: 700; text-transform: none; letter-spacing: normal;
  color: var(--primary); text-decoration: none;
  padding: 7px 14px; border: 1.5px solid var(--primary); border-radius: 8px;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.branz-link:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }

.run-card .run-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.run-card .run-header h2 { flex: 1; }
.run-card { position: relative; overflow: hidden; padding-left: 34px; }
.run-card::before {
  content: '';
  position: absolute; top: 0; left: 0; bottom: 0; width: 5px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--gold) 100%);
}
.remove-run-btn {
  flex-shrink: 0; font-size: 0.78em; padding: 7px 14px; border-radius: 8px;
  border: 1.5px solid var(--border); background: #fff; color: var(--muted);
  cursor: pointer; font-weight: 700; transition: border-color 0.15s, color 0.15s, transform 0.1s;
  margin-bottom: 20px;
}
.remove-run-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

.add-run-btn {
  width: 100%; padding: 14px 18px; margin-bottom: 22px;
  background: #fff; color: var(--primary);
  border: 1.5px dashed var(--primary); border-radius: 12px; cursor: pointer;
  font-weight: 700; font-size: 0.92em; letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.1s, border-style 0.15s;
}
.add-run-btn:hover { background: #f3f6fe; transform: translateY(-1px); }
.add-run-btn:active { transform: translateY(0); }

h2 .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--navy) 100%);
  color: #fff; font-size: 0.78em; font-weight: 800; flex-shrink: 0;
  font-family: var(--font-display);
  box-shadow: 0 2px 8px rgba(37, 70, 240, 0.32);
  position: relative;
}
h2 .num::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(199, 154, 75, 0.4);
}
h3 {
  font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); margin: 26px 0 12px; font-weight: 800;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; margin-bottom: 16px; min-width: 0; }
input[type="text"], input[type="number"], input[type="date"], select, textarea { width: 100%; }
.field:last-child { margin-bottom: 0; }
.field label {
  font-size: 0.76em; color: var(--muted); margin-bottom: 8px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
}

input[type="text"], input[type="number"], input[type="date"], textarea {
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 0.95em; font-family: inherit; background: #fbfcfe; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input:hover, textarea:hover { border-color: #c7ccd6; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 70, 240, 0.1);
}

select {
  padding: 11px 38px 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95em;
  font-family: inherit;
  font-weight: 500;
  background-color: #fbfcfe;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%232546f0'%3E%3Cpath d='M4 6l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
select:hover { border-color: #c7ccd6; }

textarea { width: 100%; resize: vertical; }

.hint { font-size: 0.83em; color: var(--muted); margin: 10px 0 0; line-height: 1.5; }
.hint::before { content: '💡 '; }

.checkbox-field {
  display: flex; align-items: center; gap: 11px; font-weight: 600;
  font-size: 0.92em; color: var(--text); margin-bottom: 18px; cursor: pointer;
  padding: 12px 16px; background: #f7f9fc; border-radius: 10px;
  border: 1px solid var(--border-light);
  transition: background 0.15s, border-color 0.15s;
}
.checkbox-field:hover { background: #eef2fb; border-color: var(--border); }
.checkbox-field input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); }

table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border-light); }
th {
  background: #f7f8fb; color: var(--muted); font-weight: 800;
  font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1.5px solid var(--border);
}
th:first-child { border-radius: 8px 0 0 0; }
th:last-child { border-radius: 0 8px 0 0; }
tfoot td { font-weight: 700; background: #f7f8fb; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: #f5f8fe; }
.empty-row { color: var(--muted); font-style: italic; text-align: center; padding: 22px 0; }

.run-location-table input, .run-extras-table input, #surchargeTable input {
  width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px;
  text-align: right; font-size: 0.95em; background: #fbfcfe;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.run-location-table input:focus, .run-extras-table input:focus, #surchargeTable input:focus {
  outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 70, 240, 0.1);
}
#surchargeTable td:nth-child(2) {
  white-space: nowrap; display: flex; align-items: center; gap: 4px; justify-content: flex-end;
}
#surchargeTable td:nth-child(2) input { width: 4.5em; flex: none; }
#surchargeTable td:nth-child(3) input { width: 4em; }
#surchargeTable th:nth-child(1), #surchargeTable td:nth-child(1) { width: 38%; }
.run-location-table td:nth-child(2), .run-location-table td:nth-child(3), .run-location-table td:nth-child(5),
.run-extras-table td:nth-child(2), .run-extras-table td:nth-child(3), .run-extras-table td:nth-child(4),
#surchargeTable td:nth-child(2), #surchargeTable td:nth-child(3), #surchargeTable td:nth-child(4),
#summaryTable td:nth-child(3), #summaryTable td:nth-child(4) {
  text-align: right;
}
.run-location-table td:nth-child(4) { text-align: center; }
.run-location-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }

/* --- Summary column --- */
.summary-sticky { position: sticky; top: 28px; }
.summary-col .card {
  padding: 28px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--navy);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(199, 154, 75, 0.05) 0%, rgba(199, 154, 75, 0) 90px),
    #fff;
}
.summary-col h2 {
  color: var(--navy); font-size: 1.18em;
  font-family: var(--font-display);
}

.totals-table { margin-top: 18px; }
.totals-table td { padding: 10px 4px; border-bottom: none; font-size: 0.95em; }
.totals-table tr:not(:last-child) td { border-bottom: 1px solid var(--border-light); }
.totals-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.totals-table .grand td {
  font-size: 1.45em; font-weight: 800;
  font-family: var(--font-display);
  background: linear-gradient(120deg, var(--navy) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: 14px; padding: 18px 16px;
  border-bottom: none !important;
  box-shadow: 0 8px 22px rgba(22, 33, 63, 0.22);
}
.totals-table .grand td:last-child {
  font-weight: 800;
  color: var(--gold-light);
}
.totals-table .grand { margin-top: 4px; }
.totals-table .grand td:first-child { border-radius: 14px 0 0 14px; }
.totals-table .grand td:last-child { border-radius: 0 14px 14px 0; }
.totals-table input {
  width: 4.5em; padding: 6px 8px; border: 1.5px solid var(--border);
  border-radius: 8px; text-align: right; font-size: 0.95em; margin: 0 4px;
  background: #fbfcfe;
}
.totals-table input:focus {
  outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 70, 240, 0.1);
}

.fixing-detail-img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 4px;
  box-shadow: var(--card-shadow);
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 36px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  background: #fafbfd;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: #f3f6fe;
  color: var(--primary-dark);
}
.dropzone img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
  box-shadow: var(--card-shadow);
}

/* --- Marked-up plans thumbnails --- */
.markup-thumbs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.markup-thumb { position: relative; width: 120px; height: 120px; border-radius: 10px; overflow: hidden; box-shadow: var(--card-shadow); border: 1px solid var(--border); }
.markup-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.markup-remove {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; border-radius: 50%;
  border: none; background: rgba(20,24,40,0.72); color: #fff;
  font-size: 16px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.markup-remove:hover { background: var(--accent); }

/* --- Tag picker --- */
.tag-picker { display: flex; gap: 10px; margin: 6px 0 0; }
.tag-picker select {
  flex: 1; min-width: 0;
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.9em; background: #fafbfd; color: var(--text);
}
#addTagBtn {
  flex: 0 0 auto; padding: 10px 18px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff; font-weight: 600; cursor: pointer;
  font-family: var(--font-display); transition: filter 0.15s;
}
#addTagBtn:hover { filter: brightness(1.08); }
.selected-tags { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.tag-chip {
  display: flex; align-items: flex-start; gap: 10px;
  background: #f3f6fe; border: 1px solid var(--border-light); border-left: 3px solid var(--primary);
  border-radius: 8px; padding: 9px 12px; font-size: 0.85em; line-height: 1.45; color: var(--text);
}
.tag-chip span { flex: 1; }
.tag-remove {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: #d8def0; color: var(--navy); font-size: 15px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.tag-remove:hover { background: var(--accent); color: #fff; }
.tag-comments-label { display: block; font-weight: 600; font-size: 0.9em; margin: 4px 0 6px; }
#removePhotoBtn {
  background: #fff; color: var(--accent); border: 1.5px solid var(--accent);
  padding: 10px 18px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 0.85em;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
#removePhotoBtn:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }

@media print {
  .dropzone { border: none; padding: 0; }
  #dropzoneText { display: none; }
}

#printBtn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 22px;
  background: linear-gradient(120deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff; border: none;
  padding: 16px 24px; font-size: 1em; font-weight: 700;
  border-radius: 12px; cursor: pointer; transition: filter 0.15s, transform 0.1s;
  box-shadow: 0 6px 18px rgba(31, 157, 85, 0.28);
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}
#printBtn:hover { filter: brightness(1.06); transform: translateY(-1px); }
#printBtn:active { transform: translateY(0); }
#printBtn::before { content: '🖨️'; }

.word-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 10px;
  background: linear-gradient(120deg, #2357b8 0%, #1a439c 100%);
  color: #fff; border: none;
  padding: 14px 24px; font-size: 0.95em; font-weight: 600;
  border-radius: 12px; cursor: pointer; transition: filter 0.15s, transform 0.1s;
  box-shadow: 0 4px 14px rgba(35, 87, 184, 0.28);
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}
.word-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.word-btn:active { transform: translateY(0); }

.price-update-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 10px;
  background: linear-gradient(120deg, var(--gold) 0%, #a87f33 100%);
  color: #fff; border: none;
  padding: 13px 24px; font-size: 0.92em; font-weight: 600;
  border-radius: 12px; cursor: pointer; transition: filter 0.15s, transform 0.1s;
  box-shadow: 0 4px 14px rgba(199, 154, 75, 0.3);
  font-family: var(--font-display); letter-spacing: 0.01em;
}
.price-update-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.price-update-btn:active { transform: translateY(0); }
.price-update-hint { text-align: center; }
.price-update-hint::before { content: ''; }

.price-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(16, 24, 40, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.price-modal-box {
  background: #fff; border-radius: 16px; width: min(720px, 100%);
  max-height: 86vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.3); overflow: hidden;
}
.price-modal-box h2 {
  margin: 0; padding: 20px 24px; font-family: var(--font-display);
  font-size: 1.2em; border-bottom: 1px solid var(--border);
}
.price-modal-body { padding: 18px 24px; overflow-y: auto; }
.px-none { font-size: 1.05em; color: var(--green-dark); }
.px-h { font-size: 0.95em; margin: 14px 0 8px; font-family: var(--font-display); }
.px-h.px-warn { color: var(--accent); }
.px-table { width: 100%; border-collapse: collapse; font-size: 0.86em; }
.px-table th, .px-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border-light); }
.px-table th:nth-child(2), .px-table td:nth-child(2),
.px-table th:nth-child(3), .px-table td:nth-child(3) { text-align: right; white-space: nowrap; width: 90px; }
.px-new { color: var(--green-dark); font-weight: 700; }
.px-list { margin: 6px 0; padding-left: 18px; font-size: 0.84em; color: var(--muted); }
.px-list li { margin-bottom: 4px; }
.px-foot { margin-top: 16px; font-size: 0.82em; color: var(--muted); font-style: italic; }
.price-modal-actions {
  display: flex; justify-content: flex-end; gap: 12px;
  padding: 16px 24px; border-top: 1px solid var(--border);
}
.price-cancel-btn, .price-apply-btn {
  padding: 11px 22px; border-radius: 10px; cursor: pointer; font-weight: 600;
  font-family: var(--font-display); border: none; font-size: 0.92em;
}
.price-cancel-btn { background: #eef0f4; color: var(--text); }
.price-apply-btn { background: linear-gradient(120deg, var(--green) 0%, var(--green-dark) 100%); color: #fff; }
.price-apply-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* --- Mode tabs (Balustrades / Roofs & Pergolas) --- */
.mode-tabs {
  display: flex; gap: 6px; margin: 4px 0 22px;
  background: #eef0f4; padding: 5px; border-radius: 12px; width: fit-content;
}
.mode-tab {
  border: none; background: transparent; cursor: pointer;
  padding: 10px 22px; border-radius: 9px; font-weight: 600; font-size: 0.95em;
  font-family: var(--font-display); color: var(--muted); transition: all 0.15s;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active {
  background: #fff; color: var(--navy);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}
.roof-base-hint { font-weight: 600; color: var(--green-dark); }
.roof-base-hint.roof-out { color: var(--accent); }

.run-notes-field { margin-top: 16px; }
.run-notes-field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9em; }
.hint-inline { font-weight: 400; color: var(--muted); font-size: 0.88em; }
.run-notes {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 0.9em; resize: vertical;
  background: #fafbfd; color: var(--text);
  transition: border-color 0.15s;
}

/* --- Print-only header / footer bars (match MAXIMO quote PDF) --- */
.print-only { display: none; }

@media print {
  @page { margin: 26mm 16mm 22mm; }

  body, input, select, textarea, h1, h2, h3, h4, p, label, td, th {
    font-family: Arial, Helvetica, sans-serif !important;
  }

  .topbar { display: none; }

  .print-header.print-only {
    display: flex; align-items: center; justify-content: space-between;
    position: fixed; top: 0; left: 0; right: 0; height: 16mm;
    background: var(--primary); color: #fff;
    padding: 0 16mm;
  }
  .print-logo {
    font-family: var(--font-display); font-weight: 800; font-size: 1.6em;
    letter-spacing: 0.02em; color: #fff;
  }
  .print-logo-i { color: #c7cbd4; }
  .print-phone { font-size: 0.95em; font-weight: 600; color: #fff; }

  .print-footer.print-only {
    display: flex; align-items: center; justify-content: center;
    position: fixed; bottom: 0; left: 0; right: 0; height: 12mm;
    background: var(--navy); color: #fff;
    font-weight: 800; font-size: 0.9em; letter-spacing: 0.08em;
  }

  body { background: #fff; }
  .page { padding: 0; max-width: 100%; }
  .layout { grid-template-columns: 1fr; display: block; }
  .no-print, .form-col, header { display: none !important; }

  h1 { font-size: 1.4em; }
  .title-accent { display: none; }

  .card { box-shadow: none; border: none; padding: 0; margin-bottom: 14px; page-break-inside: avoid; }
  .run-card::before { display: none; }
  .run-card { padding-left: 0; }
  .card:hover { box-shadow: none; }
  .summary-sticky { position: static; }
  .summary-col .card {
    border: none; border-radius: 0; background: none; margin-top: 8px;
  }
  input, select, textarea { border: none !important; background: none !important; appearance: none; }

  /* Print-only intro page (Experts in Home Improvement / Our Process) */
  .print-intro { padding: 4mm 0 0; }
  .print-h2 {
    text-align: center; font-size: 1.3em; font-weight: 800; letter-spacing: 0.04em;
    margin: 0 0 14px; color: #000;
  }
  .print-intro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 30px; margin-bottom: 20px; }
  .print-intro p { font-size: 0.92em; line-height: 1.55; margin: 0 0 12px; color: #222; }
  .print-bullets { margin: 0; padding-left: 18px; font-size: 0.92em; line-height: 1.55; color: #222; }
  .print-bullets li { margin-bottom: 6px; }
  .print-intro-photo { margin: 4px 0 18px; }
  .print-intro-photo img { width: 100%; height: 50mm; object-fit: cover; display: block; }
  .print-page-break { page-break-after: always; }

  /* Cover page (page 1 photo) */
  .print-cover {
    margin: -26mm -16mm 0; width: calc(100% + 32mm);
    height: 297mm; overflow: hidden; display: flex;
  }
  .print-cover img { width: 100%; height: 100%; object-fit: cover; }
  .print-cover ~ .print-page-break + .print-intro,
  .print-only.print-cover { page-break-after: always; }

  /* Old per-line summary/surcharge tables are replaced by #printRunSummary */
  #summaryTable, #surchargeTable, h3 { display: none; }

  /* Print-only run summary — one block per run (Location/Length/Height/Fixing), no per-line pricing */
  #printRunSummary { display: block; }
  .print-run-block {
    border: 1px solid #ddd; border-radius: 0; padding: 10px 12px;
    margin-bottom: 10px; page-break-inside: avoid;
  }
  .print-run-title {
    font-size: 0.95em; font-weight: 700; margin: 0 0 6px; color: #000;
  }
  .print-run-details p {
    margin: 0; font-size: 0.85em; line-height: 1.6; color: #333;
  }

  /* Terms & conditions / acceptance pages */
  .print-tc-intro { font-size: 0.92em; line-height: 1.55; color: #222; margin: 4mm 0 6px; text-align: center; }
  .print-tc-link { text-align: center; margin: 0 0 18px; font-size: 0.92em; }
  .print-tc-list { margin: 0; padding-left: 18px; font-size: 0.78em; line-height: 1.55; color: #222; }
  .print-tc-list li { margin-bottom: 8px; }
  .print-tc-signoff {
    display: flex; justify-content: space-between; margin-top: 24px;
    font-size: 0.85em; color: #222;
  }

  .print-accept { padding-top: 4mm; }
  .print-accept-client { font-size: 0.95em; margin: 0 0 30px; }
  .print-accept-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0 30px; margin-bottom: 18px;
    font-size: 0.9em; color: #222;
  }
  .print-accept p { font-size: 0.9em; color: #222; margin: 0 0 18px; }
  .print-accept-note {
    text-align: center; font-weight: 700; font-size: 0.85em;
    margin-top: 40px; letter-spacing: 0.01em;
  }

  .totals-table { border: none; margin-top: 14px; width: 50%; margin-left: auto; }
  .totals-table td { border-bottom: 1px solid #eee !important; padding: 6px 4px; }
  /* Only show Subtotal, GST and Total — hide the internal cost breakdown */
  .totals-table tr:has(#materialSubtotal),
  .totals-table tr:has(#surchargeSubtotal),
  .totals-table tr:has(#markupAmount),
  .totals-table tr:has(#totalExGst),
  .totals-table tr:has(#perMetre),
  .totals-table tr:has(#totalHrs) { display: none; }
  .totals-table .grand td {
    background: none !important; color: #000 !important; box-shadow: none;
    border-top: 2px solid #000 !important; border-radius: 0; padding: 8px 4px;
    font-size: 1.15em;
  }
  .totals-table .grand td:last-child { color: #000 !important; }
  .totals-table input { border: none !important; padding: 0 4px; }

  #printBtn { display: none; }
}

/* --- Roof / pergola drawing gallery --- */
.roof-gallery-field { margin-top: 4px; }
.roof-gallery-field > label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.roof-gallery-reset {
  margin-left: auto; background: none; border: none; padding: 0;
  color: var(--primary); font: inherit; font-size: 0.82em; cursor: pointer; text-decoration: underline;
}
.roof-gallery-reset:hover { color: var(--primary-dark); }
.roof-gallery {
  margin-top: 8px; max-height: 360px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--bg);
}
.roof-gallery-group + .roof-gallery-group { margin-top: 14px; }
.roof-gallery-group-title {
  font-size: 0.72em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 8px;
}
.roof-gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px;
}
.roof-snip {
  position: relative; display: block; padding: 0; cursor: pointer;
  border: 2px solid var(--border); border-radius: 8px; overflow: hidden;
  background: #fff; transition: border-color 0.12s, box-shadow 0.12s, transform 0.08s;
}
.roof-snip:hover { border-color: var(--navy-light); box-shadow: var(--card-shadow); }
.roof-snip img { display: block; width: 100%; height: 96px; object-fit: contain; background: #fff; }
.roof-snip.is-selected { border-color: var(--green); box-shadow: 0 0 0 2px rgba(31,157,85,0.18); }
.roof-snip-check {
  position: absolute; top: 5px; right: 5px; width: 19px; height: 19px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 12px; line-height: 19px; text-align: center;
  opacity: 0; transform: scale(0.6); transition: opacity 0.12s, transform 0.12s;
}
.roof-snip.is-selected .roof-snip-check { opacity: 1; transform: scale(1); }
.roof-snip:not(.is-selected) img { opacity: 0.55; }
.roof-snip-label {
  display: block; padding: 4px 6px; font-size: 0.68em; line-height: 1.25; color: var(--text);
  border-top: 1px solid var(--border-light); background: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

