/* ==========================================================================
   Mould Assessment — base stylesheet (brand-agnostic)

   All colour comes from --brand-* design tokens. The :root values below are the
   DEFAULT brand (Riteflo) and the safety-net fallback if a brand theme fails to
   load. Per-brand overrides live in brands/<brand>/theme.css and are applied by
   assets/brand-service.js. See docs/WHITE-LABEL.md.
   ========================================================================== */

:root {
  /* Brand accent — RiteFlo blue (default brand) */
  --brand-accent:         #269bd5;   /* primary accent — buttons, selected state */
  --brand-accent-bright:  #46b6ea;   /* hover / highlight */
  --brand-accent-deep:    #03548e;   /* active / pressed (RiteFlo navy) */

  /* Surfaces (dark navy slate) */
  --brand-bg:           #0c1722;   /* page background */
  --brand-surface:      #16242f;   /* cards, header */
  --brand-surface-2:    #101c26;   /* nested surface / inputs */
  --brand-surface-3:    #213748;   /* raised / hover */
  --brand-border:       #283e50;   /* hairline borders */
  --brand-border-strong:#3c5870;

  /* Text */
  --brand-text:        #eaf1f6;   /* body text */
  --brand-text-dim:    #8fa4b5;   /* muted / hints */
  --white: #ffffff;
  --black: #000000;

  /* Status (brand-agnostic) */
  --ok:   #2ecc71;
  --warn: #f5b301;
  --err:  #ff5a4d;

  --font-head: 'Roboto Condensed', sans-serif;
  --font-body: 'Roboto', sans-serif;

  /* Score colour scale 0–3 — severity meaning is consistent across brands
     (red = severe), so these are NOT part of the brand accent. */
  /* Severity scale — traffic-light (0 none/gray · 1 low/green · 2 moderate/amber · 3 severe/red) */
  --score-0: #484f58;
  --score-1: #238636;
  --score-2: #d29922;
  --score-3: #da3633;

  /* Metric SERIES colours — a STABLE identity hue per assessment metric, used by
     the scoring-distribution donut + its legend so each metric is the same colour
     on every card (the legend is a true key). Deliberately distinct from the
     severity scale above; severity is conveyed by the value, the centre peak and
     the severity badge — not by these hues. Order matches FormConfig.scoreFields:
     [0] Damage/Stains  [1] Visible Mould  [2] Wet/Damp. */
  --metric-0: #b072e6;   /* Damage / Stains — violet */
  --metric-1: #36c98f;   /* Visible Mould  — green  */
  --metric-2: #3aa0e0;   /* Wet / Damp     — blue   */
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background-color: var(--brand-bg);
  padding: 0 0 80px;
  margin: 0;
  color: var(--brand-text);
}

.container {
  max-width: 920px;
  margin: 0 auto;
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}

/* Edit Reports area — a subtle dotted texture marks this as the "amend existing"
   space, visually distinct from the "add new" Assessment page. Same surface colour;
   the source pattern's light #E5E5F7/#444CF7 scheme is re-tinted for the dark theme. */
body.edit-area .container {
  background-color: var(--brand-surface);
  /* dot colour: the brand accent darkened 25% (toward black), at 28% opacity */
  background-image:
    radial-gradient(color-mix(in srgb, color-mix(in srgb, var(--brand-accent), #000 25%) 28%, transparent) 1.5px, transparent 1.5px),
    radial-gradient(color-mix(in srgb, color-mix(in srgb, var(--brand-accent), #000 25%) 28%, transparent) 1.5px, transparent 1.5px);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

/* ----------------------------------------------------- Header & progress --- */
header {
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--brand-accent) 18%, transparent) 0%, transparent 55%),
    var(--brand-surface-2);
  padding: 30px 30px 26px;
  border-bottom: 3px solid var(--brand-accent);
  text-align: center;
}
.brand-logo { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto 14px; }
.logo-text { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; text-transform: uppercase; color: var(--white); letter-spacing: 1px; }
.tagline { font-family: var(--font-head); font-size: 0.9rem; letter-spacing: 3px; color: var(--brand-accent); margin-top: 4px; }

/* Sticky status bar: autosave + room count */
.statusbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: #000;
  color: var(--brand-text);
  font-family: var(--font-head);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--brand-border);
}
.statusbar .save-state { display: flex; align-items: center; gap: 8px; }
.statusbar #roomCounter { color: var(--brand-accent); }
.save-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand-text-dim); transition: background 0.3s;
}
.save-dot.saved   { background: var(--ok); }
.save-dot.dirty   { background: var(--warn); }
.save-dot.offline { background: var(--err); }
.save-dot.error   { background: var(--err); }

/* ------------------------------------------------------------- Sections --- */
.intro-section { padding: 28px 40px; border-bottom: 1px solid var(--brand-border); line-height: 1.6; }
.intro-section h2 { font-family: var(--font-head); margin: 0 0 10px; text-transform: uppercase; color: var(--white); }
.intro-section p { margin: 0; color: var(--brand-text-dim); }

form { padding: 0; }

.section {
  padding: 32px 40px;
  border-bottom: 1px solid var(--brand-border);
}
.section-title {
  font-family: var(--font-head);
  font-size: 1.4rem;
  text-transform: uppercase;
  margin: 0 0 6px;
  color: var(--white);
  border-left: 6px solid var(--brand-accent);
  padding-left: 12px;
}
.section-sub { color: var(--brand-text-dim); margin: 0 0 22px; padding-left: 18px; font-size: 0.95rem; }

/* --------------------------------------------------------- Form controls --- */
.field { margin-bottom: 22px; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 24px;
}
label { display: block; font-weight: 700; margin-bottom: 8px; font-size: 1rem; color: var(--brand-text); }
.label-hint { display: block; font-weight: 400; font-size: 0.85rem; color: var(--brand-text-dim); margin-top: 2px; }
.required-star { color: var(--brand-accent); }

input[type="text"],
input[type="date"],
input[type="email"],
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--brand-border-strong);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--brand-surface-2);
  color: var(--brand-text);
}
input::placeholder, textarea::placeholder { color: #6b7079; }
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus { outline: none; border-color: var(--brand-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 25%, transparent); }
input.invalid, textarea.invalid { border-color: var(--err); background: #2a1614; }
/* Normalise native date picker on dark */
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(0.7); }

/* Select / combo box — matched to the text inputs above, with a custom caret and
   a dark native option popup (color-scheme). */
select {
  width: 100%;
  padding: 12px 38px 12px 12px;        /* room for the caret on the right */
  border: 1px solid var(--brand-border-strong);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.2;
  color: var(--brand-text);
  background-color: var(--brand-surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%238fa4b5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 12px 8px;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  color-scheme: dark;                  /* dark native dropdown popup */
  cursor: pointer;
}
select:hover { border-color: color-mix(in srgb, var(--brand-accent) 45%, var(--brand-border-strong)); }
select:focus { outline: none; border-color: var(--brand-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 25%, transparent); }
/* Best-effort styling of the option list where the browser allows it */
select option { background: var(--brand-surface); color: var(--brand-text); }
select option:checked { background: color-mix(in srgb, var(--brand-accent) 30%, var(--brand-surface)); }

/* Address geolocation — Google-Places-style leading pin icon + tooltip */
.input-icon-wrap { position: relative; display: block; }
input.has-leading-icon { padding-left: 46px; }

.addr-geo-icon {
  position: absolute; left: 1px; top: 1px; bottom: 1px; width: 40px;
  display: grid; place-items: center;
  background: transparent; border: none; border-right: 1px solid var(--brand-border);
  color: var(--brand-text-dim); cursor: pointer; padding: 0;
  border-radius: 4px 0 0 4px; transition: color 0.15s, background 0.15s;
}
.addr-geo-icon:hover,
.addr-geo-icon:focus-visible { color: var(--brand-accent); background: color-mix(in srgb, var(--brand-accent) 8%, transparent); outline: none; }
.addr-geo-icon:focus-visible { box-shadow: inset 0 0 0 2px var(--brand-accent); }
.addr-geo-glyph { display: grid; place-items: center; }
.addr-geo-glyph svg { width: 18px; height: 18px; display: block; }
.addr-geo-icon.loading { animation: geo-pulse 0.9s ease-in-out infinite; color: var(--brand-accent); }
@keyframes geo-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Tooltip bubble */
.addr-geo-tip {
  position: absolute; left: 0; top: calc(100% + 9px); z-index: 40;
  background: #000; color: #fff;
  border: 1px solid var(--brand-border-strong); border-radius: 5px;
  padding: 9px 11px; font-family: var(--font-body); font-size: 0.8rem; line-height: 1.35;
  text-transform: none; font-weight: 400; letter-spacing: 0; text-align: left;
  width: max-content; max-width: 230px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.55);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s 0.15s;
  pointer-events: none;
}
.addr-geo-tip::before {
  content: ""; position: absolute; left: 13px; top: -5px;
  width: 9px; height: 9px; background: #000;
  border-left: 1px solid var(--brand-border-strong); border-top: 1px solid var(--brand-border-strong);
  transform: rotate(45deg);
}
.addr-geo-icon:hover .addr-geo-tip,
.addr-geo-icon:focus-visible .addr-geo-tip {
  opacity: 1; visibility: visible; transform: translateY(0);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s 0s;
}

/* Typeahead */
.typeahead { position: relative; }
.typeahead-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: 100%;
  background: var(--brand-surface-3); border: 1px solid var(--brand-border-strong); border-top: none;
  max-height: 220px; overflow-y: auto; display: none;
}
.typeahead-list.visible { display: block; }
.typeahead-item { padding: 10px 12px; cursor: pointer; color: var(--brand-text); }
.typeahead-item:hover, .typeahead-item.active { background: var(--brand-accent); color: var(--white); }

/* Pill radio / checkbox groups */
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pill-group input[type="radio"],
.pill-group input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.pill {
  padding: 9px 16px;
  border: 1px solid var(--brand-border-strong);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-head);
  text-transform: uppercase;
  font-size: 0.9rem;
  color: var(--brand-text);
  background: var(--brand-surface-2);
  transition: 0.15s;
  user-select: none;
}
.pill:hover { background: var(--brand-surface-3); border-color: var(--brand-border-strong); }
input:checked + .pill { background: var(--brand-accent); border-color: var(--brand-accent); color: var(--white); }
input:focus-visible + .pill { outline: 3px solid var(--brand-accent-bright); outline-offset: 2px; }

/* Checkbox list (materials / assessment notes) */
.check-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 6px 14px; margin-top: 6px; }
.check-item { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; cursor: pointer; color: var(--brand-text); }
.check-item input { width: 18px; height: 18px; accent-color: var(--brand-accent); }

/* ----------------------------------------------------------- Room cards --- */
.rooms-wrap { display: flex; flex-direction: column; gap: 24px; }
.room-card {
  border: 1px solid var(--brand-border-strong);
  border-radius: 6px;
  background: var(--brand-surface);
  overflow: hidden;
}
.room-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: var(--brand-surface-2);
  color: var(--white);
  padding: 14px 18px;
  cursor: pointer;
  border-left: 4px solid var(--brand-accent);
}
.room-head h3 { font-family: var(--font-head); margin: 0; font-size: 1.2rem; text-transform: uppercase; }
.room-head .room-meta { font-size: 0.85rem; color: var(--brand-text-dim); font-weight: 400; }
.room-head-actions { display: flex; align-items: center; gap: 10px; }
.collapse-caret { transition: transform 0.2s; color: var(--brand-text-dim); }
.room-body { padding: 22px; }
.room-card.collapsed .room-body { display: none; }
.room-card.collapsed .collapse-caret { transform: rotate(-90deg); }

/* Room header: title + done badge, and compact action buttons */
.room-head-titles { min-width: 0; }
.room-head-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.room-done-badge {
  font-family: var(--font-head); text-transform: uppercase; font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.5px; color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent);
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  padding: 2px 8px; border-radius: 20px;
}
.room-head-actions .room-action { padding: 6px 12px; font-size: 0.82rem; }
.room-toggle { min-width: 42px; }

/* Locked ("done") room — read-only until Edit re-opens it */
.room-card.is-locked { border-color: color-mix(in srgb, var(--ok) 40%, var(--brand-border-strong)); }
.room-card.is-locked .room-head { border-left-color: var(--ok); }
/* Locked = read-only. app.js also sets body.inert for modern browsers; the
   pointer-events fallback blocks interaction where `inert` is unsupported. */
.room-card.is-locked .room-body { opacity: 0.72; pointer-events: none; }

/* Edit Reports — property-listing-style editing header (clear context + hierarchy:
   eyebrow → large address → supporting meta → instruction). */
.edit-report-header {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-accent) 9%, var(--brand-surface)) 0%, var(--brand-surface) 100%);
  border: 1px solid var(--brand-border);
  border-left: 5px solid var(--brand-accent);
  border-radius: 8px;
  padding: 26px 28px;
  margin-bottom: 24px;
  text-align: left;   /* override the page-level header{} centering */
}
.edit-report-kicker {
  font-family: var(--font-head); text-transform: uppercase; letter-spacing: 2.5px;
  font-size: 0.72rem; font-weight: 700; color: var(--brand-accent); margin: 0 0 8px;
}
.edit-report-address {
  font-family: var(--font-head); font-weight: 700; color: var(--white);
  font-size: clamp(1.85rem, 5.5vw, 2.7rem); line-height: 1.08; letter-spacing: -0.5px;
  margin: 0; word-break: break-word;
}
.edit-report-meta { margin: 12px 0 0; font-size: 0.9rem; font-weight: 500; color: var(--brand-text); }
.edit-report-meta:empty { display: none; }
.edit-report-sub { margin: 10px 0 0; font-size: 0.95rem; line-height: 1.55; color: var(--brand-text-dim); max-width: 62ch; }
.edit-report-sub strong { color: var(--brand-text); font-weight: 700; }
@media (max-width: 480px) { .edit-report-header { padding: 20px 18px; } }

/* ------------------------------------------------------- Component cards --- */
.component-card {
  border: 1px solid var(--brand-border);
  border-radius: 4px;
  margin-bottom: 14px;
  background: var(--brand-surface);
}
.component-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--brand-surface-2);
  border-radius: 4px 4px 0 0;
}
.component-head .comp-label { font-family: var(--font-head); font-size: 1.05rem; text-transform: uppercase; color: var(--white); }
.component-card.has-issue { border-color: var(--brand-accent); }
.component-card.has-issue .component-head { background: color-mix(in srgb, var(--brand-accent) 14%, transparent); border-bottom: 1px solid var(--brand-accent); }

/* Toggle switch */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.85rem; font-family: var(--font-head); text-transform: uppercase; color: var(--brand-text-dim); }
.toggle input { position: absolute; opacity: 0; }
.toggle-track {
  width: 46px; height: 26px; border-radius: 13px; background: var(--brand-surface-3);
  position: relative; transition: background 0.2s; border: 1px solid var(--brand-border-strong);
}
.toggle-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: var(--brand-text-dim);
  transition: transform 0.2s, background 0.2s;
}
.toggle input:checked + .toggle-track { background: var(--brand-accent); border-color: var(--brand-accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(20px); background: var(--white); }
.toggle input:checked ~ span:last-child { color: var(--brand-accent-bright); }

.component-detail { padding: 18px 16px; }

/* Score block */
.score-row { margin-bottom: 18px; }
.score-row > .score-label { font-family: var(--font-head); text-transform: uppercase; font-size: 0.95rem; margin-bottom: 6px; color: var(--brand-text); }
.score-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.score-pill {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid rgba(0,0,0,0.25); border-radius: 4px; cursor: pointer; font-weight: 700; font-size: 1.05rem;
  font-family: var(--font-head);
}
.score-pills input { position: absolute; opacity: 0; pointer-events: none; }
.score-pill[data-score="0"] { background: var(--score-0); color: #d7dade; }
.score-pill[data-score="1"] { background: var(--score-1); color: #eafff0; }
.score-pill[data-score="2"] { background: var(--score-2); color: #1a0c00; }
.score-pill[data-score="3"] { background: var(--score-3); color: #fff; }
input:checked + .score-pill { outline: 3px solid var(--white); outline-offset: -2px; box-shadow: 0 0 0 2px var(--brand-bg) inset; }
.ext-wall { margin-left: 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; cursor: pointer; color: var(--brand-text-dim); }
.ext-wall input { width: 18px; height: 18px; accent-color: var(--brand-accent); }

.detail-label { font-family: var(--font-head); text-transform: uppercase; font-size: 0.9rem; margin: 16px 0 4px; color: var(--brand-text-dim); }

/* Area name + scoring key shown above a room's components (0–3 coloured radios) */
.components-area { font-family: var(--font-head); font-size: 1.15rem; color: var(--white); margin: 0 0 10px; }
.scoring-key { background: var(--brand-surface-2); border: 1px solid var(--brand-border); border-radius: 6px; padding: 12px 14px; margin: 0 0 18px; }
.scoring-key-title { display: block; font-family: var(--font-head); text-transform: uppercase; font-size: 0.78rem; letter-spacing: 1px; color: var(--brand-text-dim); margin-bottom: 2px; }
.scoring-key .legend { margin-top: 4px; }

/* "Other" free-text inputs inside check lists */
.other-text { margin-top: 8px; }
.other-text input { max-width: 360px; }

/* Photo upload */
.photo-zone { margin-top: 16px; }
/* Image-upload dropzone tile — dashed rounded border, centred camera+ icon + "Upload".
   Square-ish (matches screenshots/image-upload.png); responsive, capped width. */
.photo-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  width: 100%; max-width: 200px; aspect-ratio: 6 / 5; min-height: 120px; padding: 12px;
  border: 2px dashed var(--brand-border-strong); border-radius: 10px;
  background: var(--brand-surface-2); color: var(--brand-text-dim);
  cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.photo-btn:hover { border-color: var(--brand-accent); color: var(--brand-text); background: color-mix(in srgb, var(--brand-accent) 8%, var(--brand-surface-2)); }
.photo-btn-icon { display: block; }
.photo-btn-icon svg { width: 28px; height: 28px; display: block; }
.photo-btn-label { font-family: var(--font-head); font-size: 0.95rem; letter-spacing: 0.3px; }
.exterior-photos { margin-top: 20px; }
/* Uploaded-photo cards — responsive grid; one per row on narrow screens. */
.photo-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 12px; }
.photo-thumb {
  display: flex; flex-direction: column;
  background: var(--brand-surface); border: 1px solid var(--brand-border); border-radius: 10px; overflow: hidden;
}
.photo-media { position: relative; }
.photo-media img { display: block; width: 100%; height: 190px; object-fit: cover; background: var(--brand-surface-2); }
/* IN REPORT overlay (top-right of the image) */
.thumb-include {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 7px;
  background: color-mix(in srgb, #000 55%, transparent);
  border: 1px solid color-mix(in srgb, #fff 20%, transparent);
  border-radius: 6px; padding: 5px 9px; cursor: pointer;
  font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.68rem; color: var(--white);
}
.thumb-include input { margin: 0; width: 15px; height: 15px; accent-color: var(--brand-accent); }
/* Description field */
.photo-desc {
  width: 100%; resize: none; min-height: 58px;
  border: none; border-top: 1px solid var(--brand-border);
  background: transparent; color: var(--brand-text);
  font-family: var(--font-body); font-size: 0.92rem; line-height: 1.4; padding: 12px 14px;
}
.photo-desc::placeholder { color: var(--brand-text-dim); }
.photo-desc:focus { outline: none; background: var(--brand-surface-2); }
/* "Include description in report" toggle */
.photo-descopt { display: inline-flex; align-items: center; gap: 7px; padding: 0 14px 12px; font-size: 0.78rem; color: var(--brand-text-dim); cursor: pointer; }
.photo-descopt input { margin: 0; accent-color: var(--brand-accent); }
/* Footer: thumbnail picker (exterior) + delete */
.photo-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--brand-border); }
.photo-foot-spacer { flex: 1 1 auto; }
.photo-foot .remove {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--brand-border); border-radius: 6px; background: transparent; color: var(--brand-text-dim); cursor: pointer;
}
.photo-foot .remove svg { width: 18px; height: 18px; }
.photo-foot .remove:hover { border-color: var(--err); color: var(--err); }
.thumb-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--brand-text); cursor: pointer; }
.thumb-pick input { margin: 0; width: 16px; height: 16px; accent-color: var(--brand-accent); }

/* -------------------------------- Config-driven brand fields (ADR-0025) --- */
/* Group sub-heading inserted between general fields when `group` changes.
   Spans the whole field grid so groups read as sections. */
.field-group-heading {
  grid-column: 1 / -1;
  font-family: var(--font-head);
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-text);
  border-left: 4px solid var(--brand-accent);
  padding-left: 10px;
  margin: 14px 0 0;
}
.field-group-heading:first-child { margin-top: 0; }

/* Per-brand room-conditions block (between identification and ventilation). */
.room-extras .field:last-child { margin-bottom: 0; }

/* Slider (range) — live readout + min/max bounds + threshold warning. Thumb is
   ≥ 44px effective touch target for field use on phones. */
.slider-wrap { margin-top: 6px; }
.slider-row { display: flex; align-items: center; gap: 14px; }
.slider-value {
  min-width: 76px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand-text);
  background: var(--brand-surface-2);
  border: 1px solid var(--brand-border-strong);
  border-radius: 5px;
  padding: 8px 10px;
  flex: 0 0 auto;
}
.slider-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--brand-text-dim);
  margin-top: 4px;
  /* keep the bounds under the track, not under the readout */
  padding-right: 104px;
}
.slider-input {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  width: 100%;
  height: 44px;                 /* comfortable touch strip around the track */
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.slider-input:focus-visible { outline: 3px solid var(--brand-accent-bright); outline-offset: 2px; border-radius: 6px; }
.slider-input::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: var(--brand-surface-3);
  border: 1px solid var(--brand-border-strong);
}
.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -11px;            /* centre the thumb on the 8px track */
  border-radius: 50%;
  background: var(--brand-accent);
  border: 3px solid color-mix(in srgb, var(--brand-accent) 40%, var(--brand-surface));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
.slider-input::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: var(--brand-surface-3);
  border: 1px solid var(--brand-border-strong);
}
.slider-input::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-accent);
  border: 3px solid color-mix(in srgb, var(--brand-accent) 40%, var(--brand-surface));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
/* Threshold warning shown while the value exceeds flagAbove (uses the same
   severity tokens as the 0–3 scoring pills). */
.slider-flag {
  margin: 8px 0 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--score-2);
  border-left: 4px solid var(--score-2);
  background: color-mix(in srgb, var(--score-2) 12%, transparent);
  border-radius: 0 5px 5px 0;
  padding: 8px 12px;
}

/* Report: derived "Site risk factors" + flagged moisture chips (reuse the
   report-vent chip aesthetics, tinted with the warning severity token). */
.report-flag-chip {
  border-color: color-mix(in srgb, var(--score-2) 55%, transparent);
  background: color-mix(in srgb, var(--score-2) 14%, transparent);
  color: color-mix(in srgb, var(--score-2) 70%, var(--brand-text));
  font-weight: 700;
}

/* --------------------------------------------------- Progressive reveal --- */
.conditional {
  overflow: hidden;
  max-height: 0;
  visibility: hidden;
  transition: max-height 0.3s ease, margin 0.3s ease, visibility 0s 0.3s;
  margin: 0;
}
.conditional.visible {
  max-height: 4000px;
  visibility: visible;
  transition: max-height 0.4s ease, margin 0.3s ease, visibility 0s 0s;
}

/* ---------------------------------------------------------- Buttons etc --- */
.btn {
  font-family: var(--font-head);
  text-transform: uppercase;
  border: 1px solid var(--brand-border-strong);
  border-radius: 4px;
  background: var(--brand-surface-2);
  color: var(--brand-text);
  cursor: pointer;
  padding: 12px 22px;
  font-size: 1rem;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--brand-surface-3); border-color: var(--brand-border-strong); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--brand-accent); border-color: var(--brand-accent); color: var(--white); }
.btn-primary:hover { background: var(--brand-accent-bright); border-color: var(--brand-accent-bright); transform: scale(1.01); }
.btn-ghost { border-style: dashed; }
.btn-danger { border-color: var(--err); color: var(--err); background: transparent; }
.btn-danger:hover { background: var(--err); color: var(--white); }
.btn-edit { border-color: var(--brand-accent); color: var(--brand-accent); background: transparent; }
.btn-edit:hover { background: var(--brand-accent); color: var(--white); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

.add-room-btn {
  width: 100%; padding: 18px; font-size: 1.1rem; margin-top: 8px;
  /* Raised dark blue-grey fill (vs the recessed --brand-surface-2 of inputs/textareas)
     so it clearly reads as a button, not a form field. */
  background: var(--brand-surface-3);
  border-color: var(--brand-border-strong);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.add-room-btn:hover { background: color-mix(in srgb, var(--brand-surface-3), #fff 9%); border-color: var(--brand-border-strong); }
.add-room-btn:disabled, .add-room-btn.is-disabled { opacity: 0.5; cursor: not-allowed; }
.add-room-hint { display: none; margin: 8px 2px 0; font-size: 0.85rem; color: var(--brand-accent); }
.add-room-hint.visible { display: block; }

.submit-btn {
  width: 100%;
  background: var(--brand-accent);
  color: var(--white);
  font-family: var(--font-head);
  font-size: 1.3rem;
  padding: 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: transform 0.1s, background 0.15s;
}
.submit-btn:hover { background: var(--brand-accent-bright); transform: scale(1.01); }
.submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.submit-error, .submit-info {
  margin-top: 16px; padding: 14px 18px; font-size: 0.92rem; display: none; border-radius: 4px;
}
.submit-error { background: #2a1614; border: 1px solid var(--err); color: #ff8e84; white-space: pre-line; }
.submit-info  { background: #14202b; border: 1px solid #2c5d8a; color: #9cc7ee; }
.submit-error.visible, .submit-info.visible { display: block; }

footer { background: #000; padding: 20px; text-align: center; font-size: 0.85rem; border-top: 3px solid var(--brand-accent); color: var(--brand-text-dim); }
footer strong { color: var(--brand-text); }

/* --------------------------------------------------------- Overlay modal --- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity 0.25s; padding: 20px;
}
.overlay.visible { opacity: 1; pointer-events: all; }
.overlay-card { background: var(--brand-surface); border: 1px solid var(--brand-border-strong); border-top: 4px solid var(--brand-accent); border-radius: 6px; padding: 44px 36px; max-width: 520px; width: 100%; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,0.6); }
.overlay-card h2 { font-family: var(--font-head); font-size: 1.8rem; text-transform: uppercase; margin: 0 0 14px; color: var(--white); }
.overlay-card p { line-height: 1.6; margin-bottom: 26px; color: var(--brand-text-dim); }
.overlay-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Reusable confirm/alert modal (Components.confirm/alert) */
.modal-overlay .overlay-card { width: 100%; max-width: min(520px, calc(100vw - 32px)); }
.modal-card { padding: 32px 28px; }
.modal-card h2 { font-size: 1.35rem; }
.modal-card p { margin-bottom: 22px; word-break: break-word; }
.modal-card .modal-confirm.btn-danger:hover { background: var(--err); color: var(--white); }
@media (max-width: 480px) {
  .modal-card { padding: 26px 20px; }
  .modal-card h2 { font-size: 1.15rem; }
  .modal-overlay .overlay-actions { width: 100%; }
  .modal-overlay .overlay-actions .btn { flex: 1 1 auto; }   /* full-width, easy-tap buttons */
}

/* --------------------------------------------------------------- Legend --- */
/* One scoring-key item per line for legibility */
.legend { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 6px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--brand-text); }
.legend-swatch { width: 26px; height: 26px; border-radius: 4px; display: grid; place-items: center; font-weight: 700; font-family: var(--font-head); }
.legend-swatch[data-score="0"] { background: var(--score-0); color: #d7dade; }
.legend-swatch[data-score="1"] { background: var(--score-1); color: #eafff0; }
.legend-swatch[data-score="2"] { background: var(--score-2); color: #1a0c00; }
.legend-swatch[data-score="3"] { background: var(--score-3); color: #fff; }

/* ============================================================ REPORTING === */
.muted { color: var(--brand-text-dim); }

/* View switcher */
.viewnav { display: flex; gap: 0; background: var(--brand-surface-2); border-bottom: 1px solid var(--brand-border); }
.viewnav-btn {
  flex: 1; padding: 14px 18px; background: transparent; border: none; cursor: pointer;
  color: var(--brand-text-dim); font-family: var(--font-head); text-transform: uppercase;
  letter-spacing: 1px; font-size: 0.95rem; border-bottom: 3px solid transparent;
}
.viewnav-btn:hover { color: var(--brand-text); }
.viewnav-btn.active { color: var(--white); border-bottom-color: var(--brand-accent); background: color-mix(in srgb, var(--brand-accent) 6%, transparent); }

/* Filters */
.report-filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px 18px; margin-bottom: 18px;
}
.report-filters .field { margin-bottom: 0; }
.filter-clear-cell { display: flex; align-items: flex-end; }
.reports-count { color: var(--brand-text-dim); font-size: 0.85rem; }
.reports-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
#syncNowBtn { padding: 8px 14px; font-size: 0.85rem; }

/* Cloud sync status chip (report rows) */
.cloud-chip { display: inline-block; padding: 3px 9px; border-radius: 20px; font-family: var(--font-head); text-transform: uppercase; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.5px; white-space: nowrap; border: 1px solid var(--brand-border-strong); }
.cloud-chip.cloud-local   { background: var(--brand-surface-3); color: var(--brand-text-dim); }
.cloud-chip.cloud-pending { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.cloud-chip.cloud-synced  { background: color-mix(in srgb, var(--ok) 16%, transparent);  color: var(--ok);  border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.cloud-chip.cloud-error   { background: color-mix(in srgb, var(--err) 16%, transparent); color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }

/* Reports list */
.reports-list { display: flex; flex-direction: column; gap: 10px; }
.report-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; background: var(--brand-surface); border: 1px solid var(--brand-border);
  border-left: 4px solid var(--brand-accent); border-radius: 4px; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.report-row:hover { background: var(--brand-surface-3); }
.report-row-main { min-width: 0; flex: 1 1 auto; }
.report-row-thumb { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 4px; overflow: hidden; }
.report-row-thumb.has-img { border: 1px solid var(--brand-border-strong); }
.report-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.report-row-addr { font-family: var(--font-head); font-size: 1.1rem; color: var(--white); text-transform: uppercase; }
.report-row-meta { color: var(--brand-text-dim); font-size: 0.82rem; margin-top: 3px; }
.report-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.report-row-actions .btn { padding: 8px 14px; font-size: 0.85rem; }
.reports-empty { text-align: center; padding: 40px 20px; color: var(--brand-text-dim); }
.reports-empty p { margin: 4px 0; }

/* Severity badges & colour scale (reused across list + report) */
.sev-badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px; font-family: var(--font-head);
  text-transform: uppercase; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.5px; white-space: nowrap;
}
.sev-badge.lg { font-size: 1rem; padding: 7px 18px; }
.sev-0 { background: var(--score-0); color: #d7dade; }
.sev-1 { background: var(--score-1); color: #eafff0; }
.sev-2 { background: var(--score-2); color: #1a0c00; }
.sev-3 { background: var(--score-3); color: #fff; }
.sev-bg-0 { background: var(--score-0); color: #d7dade; }
.sev-bg-1 { background: var(--score-1); color: #eafff0; }
.sev-bg-2 { background: var(--score-2); color: #1a0c00; }
.sev-bg-3 { background: var(--score-3); color: #fff; }

/* Report action bar */
.report-actions {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; background: #000; border-bottom: 1px solid var(--brand-border);
}
.report-actions-right { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------- Report document */
#reportContent { padding: 0; }
.report-doc {
  max-width: 820px; margin: 0 auto; padding: 34px 38px 28px;
  background: var(--brand-bg); color: var(--brand-text); font-family: var(--font-body);
}
/* Google Material Symbols (report icons, loaded in index.html) */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal;
  line-height: 1; letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr;
  -webkit-font-smoothing: antialiased; -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.micon { display: inline-flex; align-items: center; font-size: 18px; }

/* Section wrappers + labels (icon + uppercase) */
.report-section { margin: 0 0 30px; }
.report-seclabel { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); text-transform: uppercase; letter-spacing: 1px; font-size: 0.92rem; font-weight: 700; color: var(--brand-text-dim); border-bottom: 1px solid var(--brand-border); padding-bottom: 8px; margin: 0 0 16px; }
.report-seclabel .micon { font-size: 20px; color: var(--brand-accent); }

/* Severity tint — each .rsev-N exposes a single --rc consumed by its children */
.rsev-0 { --rc: var(--score-0); }
.rsev-1 { --rc: var(--score-1); }
.rsev-2 { --rc: var(--score-2); }
.rsev-3 { --rc: var(--score-3); }

/* Header */
.report-head { display: flex; flex-direction: column; gap: 18px; border-bottom: 1px solid var(--brand-border); padding-bottom: 22px; margin-bottom: 26px; }
.report-logo { width: 200px; max-width: 55%; height: auto; }
.report-wordmark { font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; text-transform: uppercase; letter-spacing: 1px; color: var(--brand-accent); }
.report-head-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.report-address { font-family: var(--font-head); font-size: clamp(1.7rem, 5vw, 2.4rem); font-weight: 700; margin: 0 0 6px; color: var(--white); line-height: 1.08; letter-spacing: -0.5px; }
.report-subtitle { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 3px; font-size: 0.82rem; font-weight: 700; color: var(--brand-text-dim); margin: 0; }
.report-risk { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; color: var(--rc); background: color-mix(in srgb, var(--rc) 12%, transparent); border: 1px solid color-mix(in srgb, var(--rc) 45%, transparent); }
.report-risk .micon { font-size: 24px; }
.report-risk-body { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.report-risk-label { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; font-size: 0.9rem; }
.report-risk-ref { font-size: 0.72rem; color: var(--brand-text-dim); margin-top: 2px; }

/* Meta grid + status */
.report-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin-bottom: 30px; background: var(--brand-border); border: 1px solid var(--brand-border); border-radius: 10px; overflow: hidden; }
.report-meta-item { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--brand-surface); }
.report-meta-k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--brand-text-dim); font-family: var(--font-head); }
.report-meta-v { color: var(--brand-text); font-size: 0.95rem; font-weight: 500; }
.report-status { display: inline-flex; align-items: center; align-self: flex-start; gap: 7px; color: var(--rc); font-weight: 700; }
.report-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rc); }

/* Property overview hero */
.report-hero { border: 1px solid var(--brand-border); border-radius: 12px; overflow: hidden; }
.report-hero .report-photo { border-radius: 0; }
.report-hero .report-photo-img { width: 100%; height: clamp(200px, 42vw, 320px); border: none; border-radius: 0; }
.report-hero .report-photo-desc { display: none; }
.report-exterior-more { margin-top: 12px; }

/* Risk summary stat cards */
.report-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.report-stat { display: flex; align-items: center; gap: 14px; background: var(--brand-surface); border: 1px solid var(--brand-border); border-radius: 10px; padding: 16px 18px; position: relative; overflow: hidden; }
.report-stat.rsev-2, .report-stat.rsev-3 { border-color: color-mix(in srgb, var(--rc) 35%, var(--brand-border)); }
.report-stat.rsev-2::before, .report-stat.rsev-3::before { content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 100%; background: var(--rc); }
.report-stat-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-surface-2); border: 1px solid var(--brand-border); color: var(--brand-accent); flex: 0 0 auto; }
.report-stat.rsev-2 .report-stat-icon, .report-stat.rsev-3 .report-stat-icon { color: var(--rc); background: color-mix(in srgb, var(--rc) 12%, transparent); border-color: color-mix(in srgb, var(--rc) 25%, transparent); }
.report-stat-icon .micon { font-size: 25px; }
.report-stat-body { display: flex; flex-direction: column; }
.report-stat-n { font-family: var(--font-head); font-size: 1.9rem; font-weight: 700; line-height: 1; color: var(--white); }
.report-stat.rsev-2 .report-stat-n, .report-stat.rsev-3 .report-stat-n { color: var(--rc); }
.report-stat-l { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--brand-text-dim); font-family: var(--font-head); margin-top: 5px; }
.report-dist { background: var(--brand-surface); border: 1px solid var(--brand-border); border-radius: 10px; padding: 16px 18px; }
.sevdist-empty { display: flex; align-items: center; justify-content: center; width: 100%; color: var(--brand-text-dim); font-size: 0.8rem; }

/* Room cards */
.report-rooms { display: flex; flex-direction: column; gap: 16px; }
.report-room { position: relative; background: var(--brand-surface); border: 1px solid color-mix(in srgb, var(--rc) 30%, var(--brand-border)); border-radius: 12px; padding: 18px 18px 18px 22px; overflow: hidden; margin: 0; }
.report-room::before { content: ""; position: absolute; left: 0; top: 0; width: 5px; height: 100%; background: var(--rc); }
.report-room-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 1px solid var(--brand-border); padding-bottom: 14px; margin-bottom: 14px; }
.report-room-titles { min-width: 0; }
.report-room-name { font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; color: var(--white); margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.report-room-badge { color: var(--rc); background: color-mix(in srgb, var(--rc) 18%, transparent); border: 1px solid color-mix(in srgb, var(--rc) 30%, transparent); border-radius: 5px; padding: 2px 8px; font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.68rem; font-weight: 700; }
.report-room-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: var(--brand-text-dim); font-size: 0.82rem; }
.report-room-meta span { display: inline-flex; align-items: center; gap: 5px; }
.report-room-meta .micon { font-size: 16px; }
.report-room--slim { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 14px 22px; }
.report-room-slim-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.report-room-check { color: var(--rc); display: inline-flex; }
.report-room-check .micon { font-size: 30px; }

/* Peak-damage gauge */
.report-gauge { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 0 0 auto; }
.report-gauge-ring { position: relative; width: 56px; height: 56px; }
.report-gauge-svg, .report-gauge-svg svg { width: 100%; height: 100%; display: block; }
.report-gauge-val { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 0.85rem; color: var(--rc); }
.report-gauge-cap { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--brand-text-dim); font-family: var(--font-head); }

/* Metric matrix */
.report-matrix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.report-matrix-tile { background: var(--brand-surface-2); border: 1px solid var(--brand-border); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.report-matrix-label { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--brand-text-dim); font-family: var(--font-head); }
.report-matrix-val { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--rc); }
.report-matrix-word { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; line-height: 1; }
.report-matrix-val .micon { font-size: 21px; }

.report-room-detail { display: flex; flex-direction: column; gap: 10px; }
.report-room-detail .report-room-ident { color: var(--brand-text-dim); font-size: 0.88rem; margin: 0; }

/* Compact ventilation chips */
.report-vent { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.report-vent-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--brand-text-dim); font-family: var(--font-head); margin-right: 4px; }
.report-vent-chip { font-size: 0.74rem; color: var(--brand-text); background: var(--brand-surface-2); border: 1px solid var(--brand-border); border-radius: 999px; padding: 3px 10px; }

/* Remediation action plan */
.report-actions-plan { display: flex; flex-direction: column; border: 1px solid var(--brand-border); border-radius: 12px; overflow: hidden; }
.report-action { display: flex; gap: 14px; padding: 16px; border-top: 1px solid var(--brand-border); background: color-mix(in srgb, var(--rc) 5%, transparent); }
.report-action:first-child { border-top: none; }
.report-action-icon { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; color: var(--rc); background: color-mix(in srgb, var(--rc) 15%, transparent); border: 1px solid color-mix(in srgb, var(--rc) 25%, transparent); }
.report-action-icon .micon { font-size: 19px; }
.report-action-body { flex: 1 1 auto; min-width: 0; }
.report-action-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.report-action-prio { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.6px; font-size: 0.72rem; font-weight: 700; color: var(--rc); }
.report-action-room { font-size: 0.72rem; color: var(--brand-text-dim); background: var(--brand-surface); border: 1px solid var(--brand-border); border-radius: 5px; padding: 2px 8px; }
.report-action-title { font-family: var(--font-head); font-size: 1rem; color: var(--white); margin: 0 0 3px; }
.report-action-desc { font-size: 0.85rem; color: var(--brand-text-dim); margin: 0; line-height: 1.45; }

/* Severity Distribution — rounded pill bar (proportional segments) + dot legend.
   Traffic-light palette (green Low / gold Moderate / red Severe) per the design ref. */
.sevdist-title { font-family: var(--font-head); text-transform: uppercase; font-size: 0.95rem; letter-spacing: 1px; font-weight: 700; color: var(--brand-text-dim); margin-bottom: 12px; }
.sevdist-bar { display: flex; height: 24px; border-radius: 999px; background: var(--brand-surface-2); border: 1px solid var(--brand-border-strong); padding: 3px; overflow: hidden; }
.sevdist-seg { display: block; min-width: 6px; }
.sevdist-seg:first-child { border-radius: 999px 0 0 999px; }
.sevdist-seg:last-child { border-radius: 0 999px 999px 0; }
.sevdist-seg:only-child { border-radius: 999px; }
.sevdist-legend { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; }
.sevdist-legend-item { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--brand-text); }
.sevdist-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.sevdist-1 { background: var(--score-1); }   /* Low — green */
.sevdist-2 { background: var(--score-2); }   /* Moderate — amber */
.sevdist-3 { background: var(--score-3); }   /* Severe — red */

/* One scoring-key item per line for legibility */
.report-legend { background: var(--brand-surface-2); border: 1px solid var(--brand-border); border-radius: 6px; padding: 12px 16px; margin-bottom: 26px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.report-legend-title { font-family: var(--font-head); text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.5px; color: var(--brand-text-dim); margin-bottom: 2px; }
.report-legend-item { display: flex; align-items: center; gap: 9px; font-size: 0.85rem; }
.report-legend-swatch { width: 22px; height: 22px; border-radius: 4px; display: grid; place-items: center; font-weight: 700; font-family: var(--font-head); }


/* Component cards */
.report-comp { border: 1px solid var(--brand-border); border-left: 3px solid var(--brand-accent); border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; background: var(--brand-surface-2); }
.report-comp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.report-comp-name { font-family: var(--font-head); text-transform: uppercase; font-size: 1rem; color: var(--white); }
/* Component body: 3-column flexbox (image | details | scoring viz);
   collapses to 2 columns when no image is available. */
.report-comp-grid { display: flex; gap: 16px; align-items: stretch; }
.report-comp-col-img { flex: 0 0 132px; display: flex; flex-direction: column; gap: 8px; }
.report-comp-col-mid { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.report-comp-col-viz { flex: 0 0 196px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.report-comp-col-img .report-photo-img { width: 100%; height: 96px; }

/* Donut chart (scoring distribution) + legend */
.report-donut { display: grid; place-items: center; }
.report-donut svg { display: block; }
.donut-legend { width: 100%; display: flex; flex-direction: column; gap: 5px; }
.donut-legend-row { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; line-height: 1.2; }
.donut-legend-sw { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; border: 1px solid rgba(0,0,0,0.25); }
.donut-legend-label { flex: 1 1 auto; color: var(--brand-text-dim); }
.donut-legend-val { font-family: var(--font-head); font-weight: 700; color: var(--brand-text); min-width: 12px; text-align: right; }
.donut-legend-ext { font-size: 0.6rem; font-weight: 700; font-family: var(--font-head); background: var(--brand-accent); color: #fff; padding: 1px 4px; border-radius: 3px; letter-spacing: 0.5px; }

.report-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.report-tags-l { font-size: 0.78rem; color: var(--brand-text-dim); text-transform: uppercase; font-family: var(--font-head); margin-right: 2px; }
.report-tag { font-size: 0.8rem; background: var(--brand-surface); border: 1px solid var(--brand-border-strong); border-radius: 12px; padding: 3px 10px; color: var(--brand-text); }
.report-photos, .report-photo-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.report-photo { border-radius: 5px; }
.report-photo-img { width: 130px; height: 100px; border: 1px solid var(--brand-border-strong); border-radius: 5px; overflow: hidden; }
.report-photo-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.report-photo-img.report-photo-missing { display: grid; place-items: center; background: var(--brand-surface); color: var(--brand-text-dim); font-size: 0.72rem; text-align: center; padding: 4px; }
/* Per-image caption overlaid on the bottom of a report photo (evidence gallery). */
.report-photo { position: relative; }
.report-photo-desc {
  position: absolute; left: 0; right: 0; bottom: 0;
  margin: 0; padding: 5px 8px; font-size: 0.7rem; line-height: 1.3; color: #eef3f7;
  background: linear-gradient(transparent, rgba(0,0,0,0.55) 30%, rgba(0,0,0,0.82));
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  border-radius: 0 0 5px 5px;
}

.report-exterior { margin: 0; }
.report-room-notes { font-size: 0.88rem; color: var(--brand-text); background: var(--brand-surface-2); border: 1px solid var(--brand-border); border-left: 2px solid var(--rc, var(--brand-accent)); border-radius: 6px; padding: 10px 12px; margin: 2px 0 0; }
.report-notes { border-top: 1px solid var(--brand-border); padding-top: 14px; margin-top: 8px; }
.report-notes h3 { font-family: var(--font-head); text-transform: uppercase; font-size: 1rem; margin: 0 0 6px; color: var(--white); }
.report-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--brand-border); color: var(--brand-text-dim); font-size: 0.78rem; text-align: center; }

/* ------------------------------------------------------------ Responsive --- */
@media (max-width: 640px) {
  .section { padding: 22px 18px; }
  .intro-section { padding: 22px 18px; }
  .room-body { padding: 14px; }
  .brand-logo { max-width: 260px; }
  .logo-text { font-size: 1.4rem; }
  .report-doc { padding: 22px 18px; }
  .report-address { font-size: 1.4rem; }
  .report-row { flex-direction: column; align-items: flex-start; }
  .report-comp-grid { flex-direction: column; }
  .report-comp-col-img, .report-comp-col-viz { flex-basis: auto; width: 100%; }
  .report-comp-col-viz { align-items: flex-start; }
}

/* ================================================================= PRINT === */
@media print {
  @page { size: A4; margin: 0; }

  html, body { background: var(--brand-bg) !important; }
  /* Force the dark theme + all accent colours to render in print */
  body, .report-doc, .report-doc * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide all app chrome — leave only the report document */
  .no-print, .statusbar, .viewnav, .report-actions,
  .container > header, .container > footer,
  #formView, #reportsView { display: none !important; }

  .container { max-width: none; margin: 0; border: none; box-shadow: none; background: var(--brand-bg); }
  #reportView { display: block !important; }
  /* Page margin is 0 so the dark background bleeds to the paper edge; the
     report keeps an internal inset so content isn't flush against the edge. */
  .report-doc { max-width: none; margin: 0; padding: 10mm 12mm; }

  /* Keep blocks from splitting awkwardly across pages */
  .report-room, .report-comp, .report-photo, .report-legend, .report-stat,
  .report-action, .report-matrix-tile, .report-hero { break-inside: avoid; page-break-inside: avoid; }
  .report-head, .report-seclabel { break-after: avoid; page-break-after: avoid; }
  .report-comp-head, .report-room-head { break-after: avoid; }
  a[href]::after { content: ""; } /* don't print URL noise */
}
