/* ============================================================
   MarineSurvey Pro — Design System
   Navy #0D1B2A · Steel Blue #2E6DA4 · White content · Amber alerts
   Tablet-first: large touch targets, tab navigation
   ============================================================ */

:root {
  --navy: #0D1B2A;
  --navy-800: #13263A;
  --navy-700: #1B3A57;
  --steel: #2E6DA4;
  --steel-light: #4A8BC2;
  --steel-pale: #EAF2F9;
  --white: #FFFFFF;
  --bg: #F4F7FA;
  --ink: #16232F;
  --ink-soft: #4E6273;
  --line: #D8E2EA;
  --amber: #B45309;
  --amber-bg: #FEF3C7;
  --amber-line: #F59E0B;
  --excellent: #0D9488;
  --excellent-bg: #CCFBF1;
  --good: #15803D;
  --good-bg: #DCFCE7;
  --fair: #B45309;
  --fair-bg: #FEF3C7;
  --poor: #B91C1C;
  --poor-bg: #FEE2E2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(13, 27, 42, .08), 0 4px 14px rgba(13, 27, 42, .06);
  --shadow-lg: 0 8px 30px rgba(13, 27, 42, .18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; max-width: 100%; overscroll-behavior-x: none; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; color: var(--ink); }
/* Form controls default to a min-content min-width in flex/grid layouts, which silently
   overflows narrow containers. Zeroing it lets width/flex/grid-track rules take over. */
input, select, textarea, button { min-width: 0; }
img, svg { max-width: 100%; height: auto; }

/* ---------- generic controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px;
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 600;
  background: var(--steel); color: #fff;
  transition: background .15s, transform .05s;
  text-decoration: none;
}
.btn:hover { background: var(--steel-light); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--navy); }
.btn-primary:hover { background: var(--navy-700); }
.btn-ghost { background: transparent; color: var(--steel); border: 1.5px solid var(--steel); }
.btn-ghost:hover { background: var(--steel-pale); }
.btn-danger { background: var(--poor); }
.btn-danger:hover { background: #DC2626; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="number"], .field input[type="date"], .field input[type="time"],
.field select, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: #fff;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(46, 109, 164, .15);
}
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.field .hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; text-transform: none; letter-spacing: 0; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.badge-excellent { background: var(--excellent-bg); color: var(--excellent); }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-fair { background: var(--fair-bg); color: var(--fair); }
.badge-poor { background: var(--poor-bg); color: var(--poor); }
.badge-steel { background: var(--steel-pale); color: var(--steel); }
.badge-navy { background: var(--navy); color: #fff; }

/* ---------- login screen ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-700) 70%, var(--steel) 130%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 36px;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .login-logo { width: 162px; height: 162px; border-radius: 33px; margin-bottom: 6px; box-shadow: var(--shadow); }
.login-brand h1 { font-size: 24px; color: var(--navy); letter-spacing: -.01em; margin-top: 8px; }
.login-brand p { color: var(--ink-soft); font-size: 14px; margin-top: 4px; }
.login-error { background: var(--poor-bg); color: var(--poor); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.login-note { margin-top: 18px; font-size: 12.5px; color: var(--ink-soft); text-align: center; line-height: 1.5; }
.linklike-inline { background: none; border: none; padding: 0; color: var(--steel); font-size: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.linklike-inline:hover { color: var(--steel-light); }

/* ---------- app shell ---------- */
.app-header {
  background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; min-height: 60px;
  padding-top: env(safe-area-inset-top, 0px);
  position: sticky; top: 0; z-index: 50;
}
.app-header { min-width: 0; }
.app-header .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; flex-shrink: 0; }
.app-header .brand .brand-logo { display: block; height: 38px; width: 38px; border-radius: 8px; }
.app-header nav { min-width: 0; flex-shrink: 1; overflow-x: auto; scrollbar-width: none; }
.app-header nav::-webkit-scrollbar { display: none; }
.app-header nav button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 6px 14px; border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; background: transparent; color: #B9CCDD;
  white-space: nowrap; transition: background .15s, color .15s;
}
.app-header nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-header nav button.active { background: var(--steel); color: #fff; }
.app-header nav button.active:hover { background: var(--steel-light); }
.app-header .spacer { flex: 1; }
.app-header .who { font-size: 13px; color: #B9CCDD; text-align: right; line-height: 1.3; flex-shrink: 0; }
.app-header .who b { color: #fff; display: block; }
.app-header button.linklike { background: none; border: none; color: #B9CCDD; font-size: 13px; text-decoration: underline; }
.app-header button.linklike:hover { color: #fff; }

/* horizontal-scroll-contained data tables — never lets a wide table force page-level scroll */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; border-radius: var(--radius); box-shadow: var(--shadow); }
.table-wrap table.admin { box-shadow: none; }

.main { max-width: 1200px; margin: 0 auto; padding: 24px 20px 80px; }

/* ---------- dashboard ---------- */
.page-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.page-title h2 { font-size: 26px; color: var(--navy); letter-spacing: -.02em; }
.page-title-logo { height: 105px; width: 105px; border-radius: 22px; flex-shrink: 0; }
.page-title .sub { color: var(--ink-soft); font-size: 14px; margin-top: 2px; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-bar select, .filter-bar input {
  min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line);
  border-radius: var(--radius); background: #fff; font-size: 14px;
}

.survey-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.survey-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; cursor: pointer; border: 1.5px solid transparent;
  transition: border-color .15s, transform .1s;
}
.survey-card:hover { border-color: var(--steel); transform: translateY(-1px); }
.survey-card .vessel { font-weight: 700; font-size: 17px; color: var(--navy); }
.survey-card .meta { font-size: 13.5px; color: var(--ink-soft); margin-top: 4px; }
.survey-card .rowline { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 8px; flex-wrap: wrap; }
.survey-card .progressbar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 12px; overflow: hidden; }
.survey-card .progressbar > div { height: 100%; background: var(--steel); border-radius: 3px; }

.empty-state {
  background: #fff; border: 2px dashed var(--line); border-radius: 14px;
  padding: 56px 24px; text-align: center; color: var(--ink-soft);
}
.empty-state .big { font-size: 44px; margin-bottom: 10px; }
.empty-state h3 { color: var(--navy); font-size: 19px; margin-bottom: 6px; }
.empty-state p { max-width: 460px; margin: 0 auto 18px; font-size: 14.5px; }

/* ---------- survey editor layout ---------- */
.editor-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.editor-main { min-width: 0; }

/* section tabs */
.section-tabs {
  display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 4px; background: #fff; border-radius: 12px; box-shadow: var(--shadow);
  margin-bottom: 18px; scrollbar-width: thin;
  position: sticky; top: calc(66px + env(safe-area-inset-top, 0px)); z-index: 40;
}
.section-tabs button {
  flex: 0 0 auto; display: flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 8px 14px; border: 1.5px solid var(--ink); border-radius: 9px;
  background: transparent; color: var(--ink); font-size: 14px; font-weight: 600;
  white-space: nowrap;
}
.section-tabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.section-tabs button .count { font-size: 11.5px; background: rgba(46,109,164,.12); color: var(--steel); border-radius: 999px; padding: 1px 8px; }
.section-tabs button.active .count { background: rgba(255,255,255,.18); color: #fff; }
/* Sections with Fair/Poor findings keep their amber warning outline */
.section-tabs button.flagged { border-color: var(--amber); border-width: 2px; }

.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 18px;
}
.card h3 { font-size: 18px; color: var(--navy); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.card h4 { font-size: 14px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; margin: 22px 0 10px; }

/* checklist items */
.check-item {
  border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; background: #fff;
}
.check-item.rated-excellent { border-left: 5px solid var(--excellent); }
.check-item.rated-good { border-left: 5px solid var(--good); }
.check-item.rated-fair { border-left: 5px solid var(--amber-line); background: #FFFDF5; }
.check-item.rated-poor { border-left: 5px solid var(--poor); background: #FFF8F8; }
.check-item .ci-label { font-weight: 600; font-size: 15px; margin-bottom: 10px; }
.check-item .ci-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button {
  min-height: 40px; padding: 6px 13px; border: none; background: #fff;
  font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  border-right: 1.5px solid var(--line);
}
.seg button:last-child { border-right: none; }
.seg button.on-present, .seg button.on-neutral { background: var(--steel); color: #fff; }
.seg button.on-excellent { background: var(--excellent); color: #fff; }
.seg button.on-good { background: var(--good); color: #fff; }
.seg button.on-fair { background: var(--amber-line); color: #fff; }
.seg button.on-poor { background: var(--poor); color: #fff; }

.check-item textarea {
  width: 100%; margin-top: 10px; min-height: 44px; padding: 9px 12px;
  border: 1.5px solid var(--line); border-radius: 8px; resize: vertical; font-size: 14.5px;
}
.check-item textarea:focus { outline: none; border-color: var(--steel); }

/* report section toggles */
.section-toggle-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; }
.section-toggle { display: flex; align-items: center; gap: 9px; padding: 8px 4px; font-size: 14px; cursor: pointer; }
.section-toggle input { width: 18px; height: 18px; accent-color: var(--steel); cursor: pointer; flex-shrink: 0; }
.section-toggle:has(input:not(:checked)) span { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--line); }
/* Plain checkbox+label row (same layout as section-toggle, WITHOUT the excluded-section
   strikethrough — for checkboxes like the sea trial's "Speeds verified by GPS"). */
.check-label { display: flex; align-items: center; gap: 9px; padding: 8px 4px; font-size: 14px; cursor: pointer; }
.check-label input { width: 18px; height: 18px; accent-color: var(--steel); cursor: pointer; flex-shrink: 0; }

/* pre-report notes acknowledgment gate */
.notes-ack-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; margin-bottom: 4px; }
.notes-ack-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.notes-ack-row:has(input:checked) { border-color: var(--good); background: #F0FBF4; }
.notes-ack-row input { width: 18px; height: 18px; accent-color: var(--steel); cursor: pointer; flex-shrink: 0; margin-top: 2px; }
.notes-ack-row .lbl { font-weight: 600; font-size: 14px; color: var(--navy); margin-bottom: 3px; }
.notes-ack-row .preview { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }

/* read-only sample banner (non-admin viewing a shared sample survey) */
/* ---------- Bluetooth Live Data (Beta) ---------- */
.bt-status { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 10px; }
.bt-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.bt-device { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.bt-devline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bt-rssi { font-size: 12px; color: var(--ink-soft); }
.bt-id { font-size: 11px; color: var(--ink-soft); word-break: break-all; margin-top: 2px; }
.bt-detail { margin-top: 8px; font-size: 13px; }
.bt-detail.bt-error { color: var(--poor); }
.bt-victron { display: inline-block; background: var(--steel-pale); color: var(--steel); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.bt-keyrow { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.bt-keyrow input { flex: 1; min-width: 200px; border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: ui-monospace, monospace; font-size: 13px; }
.bt-keyhint { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.bt-trend { margin-top: 8px; padding: 8px 10px; background: var(--steel-pale); border-radius: 8px; font-size: 13px; }
.bt-netsec { margin-top: 14px; padding-top: 12px; border-top: 1.5px solid var(--line); }
.bt-net-title { font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.bt-net-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.bt-net-row input, .bt-net-row select { flex: 1; min-width: 200px; border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.bt-net-status { font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; }
.bt-btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.bt-error { color: var(--poor); margin-bottom: 6px; }
.bt-values { margin-top: 6px; border-collapse: collapse; }
.bt-values td { padding: 3px 14px 3px 0; font-size: 13.5px; }
.bt-values td:last-child { font-weight: 600; }
.bt-cap-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.bt-cap { border: 1.5px solid var(--line); border-left: 4px solid var(--steel); border-radius: 8px; padding: 8px 12px; }
.bt-cap-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.bt-cap-head .btn { margin-left: auto; }
.bt-cap-ts { font-size: 12px; color: var(--ink-soft); }
.bt-cap-vals { font-size: 13px; margin-top: 4px; color: var(--ink-soft); }
.bt-cap-vals b { color: var(--ink); }

/* ---------- field tools: moisture / USCG / signatures / invoice / annotation ---------- */
.moist-row { display: grid; grid-template-columns: 1.2fr .7fr 2fr auto; gap: 8px; margin-bottom: 8px; }
.moist-row input, .moist-row select { border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 10px; font-size: 14px; min-width: 0; background: #fff; }
.uscg-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; flex-wrap: wrap; }
.uscg-row.uscg-bad { border-color: var(--poor); background: var(--poor-bg); }
.uscg-main { flex: 1; min-width: 220px; }
.uscg-detail { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.sig-label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; }
.sig-pad { width: 100%; height: 150px; border: 1.5px dashed var(--steel); border-radius: 10px; background: #fff; display: block; }
.sig-actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.inv-row { display: grid; grid-template-columns: 2.4fr .8fr auto; gap: 8px; margin-bottom: 8px; }
.inv-row input { border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 10px; font-size: 14px; min-width: 0; }
.photo-thumb .annot, .addphoto-thumb .annot {
  position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border: none; border-radius: 6px;
  background: rgba(13,27,42,.75); color: #fff; font-size: 13px; line-height: 1;
}
.annot-overlay { position: fixed; inset: 0; z-index: 400; background: rgba(10,18,26,.88); display: flex; align-items: center; justify-content: center; padding: 12px; }
.annot-box { background: var(--navy); border-radius: 14px; padding: 10px; max-width: 96vw; max-height: 94vh; max-height: 94dvh; display: flex; flex-direction: column; gap: 8px; }
.annot-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.annot-tools button { border: 1.5px solid rgba(255,255,255,.35); background: transparent; color: #fff; border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 600; min-height: 36px; }
.annot-tools button.on { background: var(--steel); border-color: var(--steel); }
.annot-tools .annot-swatch { width: 30px; padding: 0; }
.annot-tools .annot-swatch.on { outline: 2.5px solid #fff; }
.annot-tools .annot-save { background: var(--steel); border-color: var(--steel); }
.annot-sep { width: 1px; align-self: stretch; background: rgba(255,255,255,.25); margin: 0 2px; }
.annot-spacer { flex: 1; }
.annot-canvas-wrap { overflow: auto; }
.annot-canvas-wrap canvas { max-width: 100%; max-height: 74vh; display: block; border-radius: 8px; }
@media (max-width: 700px) {
  .sig-grid { grid-template-columns: 1fr; }
  .moist-row { grid-template-columns: 1fr .6fr auto; }
  /* The 3rd ("auto") column only exists for the delete button — once the note/comments
     field is forced onto its own full-width row, auto-placement drops the button into
     column 1 of the next row instead, and the now-contentless 3rd column collapses to
     0px, leaving the button oversized in column 1's track. Full-spanning the button too
     keeps every row's placement predictable instead of relying on grid auto-placement
     to land it in a specific column. */
  .moist-row input[data-moist$=":note"], .moist-row input[data-thruhull$=":comments"],
  .moist-row [data-moist-del], .moist-row [data-thruhull-del] { grid-column: 1 / -1; }
}

.readonly-banner {
  background: var(--amber-bg); border: 1.5px solid var(--amber-line); color: var(--amber);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
  font-size: 14px; font-weight: 600;
}

.ai-draft-banner {
  background: var(--amber-bg); border: 1.5px solid var(--amber-line); color: var(--amber);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
  font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 10px;
}
.ai-draft-banner .ai-draft-dismiss {
  margin-left: auto; background: none; border: none; color: inherit; cursor: pointer;
  font-size: 15px; font-weight: 700; line-height: 1; padding: 2px 4px;
}

/* license & certification checklist (signup, admin add-surveyor, account page) */
.license-check-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.license-check-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; }
.license-check-row.checked { border-color: var(--steel); background: var(--steel-pale); }
.license-check-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; min-width: 90px; cursor: pointer; }
.license-check-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--steel); cursor: pointer; flex-shrink: 0; }
.license-check-row .lic-input { flex: 1; min-width: 140px; min-height: 40px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 14px; background: #fff; }
.license-check-row .lic-input:disabled { background: var(--bg); color: var(--ink-soft); cursor: not-allowed; }

/* FAQ accordion */
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item { border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.faq-q { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border: none; text-align: left; font-weight: 600; font-size: 15px; color: var(--navy); cursor: pointer; }
.faq-q:hover { background: var(--steel-pale); }
.faq-chevron { transition: transform .15s; color: var(--steel); flex-shrink: 0; }
.faq-q.open .faq-chevron { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .2s ease; }
.faq-a.open { max-height: 400px; }
.faq-a-inner { padding: 0 16px 16px; font-size: 14px; color: var(--ink-soft); line-height: 1.6; }

/* cost estimate worksheet */
.cost-item { background: var(--bg); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.cost-grid { display: grid; grid-template-columns: 2fr 60px 1fr 1fr 70px; gap: 8px; }
.cost-grid input { min-height: 42px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px; }
.cost-row2 { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cost-row2 input { flex: 1; min-height: 42px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px; }
.cost-labor-readout { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.cost-totals {
  margin-top: 18px; background: var(--navy); color: #fff; border-radius: var(--radius);
  padding: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px;
}
.cost-totals .lbl { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: #9DB8D2; }
.cost-totals .val { display: block; font-weight: 700; margin-top: 3px; font-size: 15px; }
.cost-totals .val.grand { color: #4ADE80; font-size: 17px; }
@media (max-width: 640px) { .cost-grid { grid-template-columns: 1fr 1fr; } }

/* in-water survey / sea trial readings grid */
.seatrial-grid { display: grid; grid-template-columns: 86px repeat(4, 1fr); gap: 6px; align-items: center; }
.seatrial-grid .st-head { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.seatrial-grid .st-label { font-size: 13px; font-weight: 600; }
.seatrial-grid input { border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 10px; font-size: 14px; min-width: 0; }
@media (max-width: 560px) {
  .seatrial-grid { grid-template-columns: 64px repeat(4, 1fr); gap: 4px; }
  .seatrial-grid input { padding: 8px 6px; font-size: 13px; }
}

/* battery bank / solar panel rows */
.elec-item { background: var(--bg); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.elec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.elec-grid .field { margin-bottom: 0; }

.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-thumb { position: relative; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; border: 1.5px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .del {
  position: absolute; top: 2px; right: 2px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: rgba(13,27,42,.75); color: #fff;
  font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.photo-thumb .move, .addphoto-thumb .move {
  position: absolute; right: 2px; bottom: 2px; width: 22px; height: 22px;
  border-radius: 6px; border: none; background: rgba(13,27,42,.75); color: #fff;
  font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.photo-add {
  width: 76px; height: 76px; border: 2px dashed var(--line); border-radius: 8px;
  background: none; color: var(--ink-soft); font-size: 22px;
}
.photo-add:hover { border-color: var(--steel); color: var(--steel); }

/* blank field-form (print-and-fill-by-hand) elements */
.fchk-item { margin-bottom: 14px; page-break-inside: avoid; border-bottom: 1px solid #E4EBF1; padding-bottom: 10px; }
.fchk-label { font-size: 12.5px; margin-bottom: 6px; }
.fchk-row { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; font-size: 12px; }
.fchk-opt { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
/* Boxes are deliberately large with heavy borders — they must survive print + re-scan and
   still be readable (mark vs. no mark) by the field-form AI extraction. */
.fchk { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--navy); border-radius: 2px; flex-shrink: 0; }
.fchk-gap { width: 14px; }
.fchk-notesline { border-bottom: 1px solid #B9C6D2; min-height: 22px; margin-top: 8px; font-size: 11.5px; color: #556; }
.fchk-line { display: inline-block; width: 100%; border-bottom: 1px solid #B9C6D2; min-height: 16px; }

/* PDF-import photo placement picker */
.import-photo-row { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.import-photo-row .photo-thumb { flex-shrink: 0; }
#import-photo-rows { max-height: 46vh; overflow-y: auto; margin-bottom: 4px; }

/* additional / end-of-report photo gallery */
.addphoto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.addphoto-item { display: flex; flex-direction: column; gap: 6px; }
.addphoto-thumb { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; border: 1.5px solid var(--line); }
.addphoto-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.addphoto-thumb .del {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px;
  border-radius: 50%; border: none; background: rgba(13,27,42,.75); color: #fff;
  font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.addphoto-item input { min-height: 38px; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 7px; font-size: 13px; }
.addphoto-add { width: 100%; aspect-ratio: 4 / 3; height: auto; font-size: 14px; line-height: 1.5; }

/* voice dictation */
.mic-wrap { position: relative; display: block; }
.mic-wrap textarea { padding-right: 46px !important; }
.check-item .mic-wrap { margin-top: 10px; }
.check-item .mic-wrap textarea { margin-top: 0; }
.mic-btn {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px;
  border-radius: 50%; border: 1.5px solid var(--line); background: #fff;
  font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
  z-index: 2; padding: 0;
}
.mic-btn:hover { border-color: var(--steel); }
.mic-btn.mic-live {
  background: var(--poor); border-color: var(--poor);
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, .45); }
  50% { box-shadow: 0 0 0 8px rgba(185, 28, 28, 0); }
}

/* known issues sidebar */
.sidebar { position: sticky; top: 130px; }
.known-issues {
  background: var(--amber-bg); border: 1.5px solid var(--amber-line);
  border-radius: var(--radius); padding: 18px;
}
.known-issues h3 { font-size: 15px; color: var(--amber); display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.known-issues li { margin: 0 0 10px 18px; font-size: 13.5px; color: #78350F; line-height: 1.45; }
.known-issues .none { font-size: 13.5px; color: #78350F; }
.sidebar .progress-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.sidebar .progress-card h3 { font-size: 15px; color: var(--navy); margin-bottom: 10px; }
.sidebar .progress-card .line { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); padding: 4px 0; }

/* summary / flagged review */
.flag-row { display: flex; gap: 12px; align-items: flex-start; border-bottom: 1px solid var(--line); padding: 12px 0; }
.flag-row:last-child { border-bottom: none; }
.flag-row .what { flex: 1; }
.flag-row .what .sec { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.flag-row .what .lbl { font-weight: 600; font-size: 14.5px; }
.flag-row .what .note { font-size: 13.5px; color: var(--ink-soft); margin-top: 2px; }

/* editor topbar */
.editor-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.editor-top .vessel-title { font-size: 21px; font-weight: 700; color: var(--navy); letter-spacing: -.01em; }
.editor-top .autosave { font-size: 12.5px; color: var(--ink-soft); }
.editor-top .spacer { flex: 1; }

/* admin tables */
table.admin { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.admin th { background: var(--navy); color: #fff; text-align: left; font-size: 13px; padding: 12px 14px; letter-spacing: .03em; }
table.admin td { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.admin tr:last-child td { border-bottom: none; }
table.admin tr:hover td { background: var(--steel-pale); }

.admin-tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-tabs button {
  min-height: 44px; padding: 8px 18px; border-radius: 9px; border: 1.5px solid var(--line);
  background: #fff; font-weight: 600; font-size: 14px; color: var(--ink-soft);
}
.admin-tabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(13, 27, 42, .55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; overflow-y: auto; padding: 26px;
  /* dvh (with vh fallback): iOS Safari's vh tracks the LARGEST viewport, so 88vh
     with browser chrome visible clipped the top/bottom of tall modals. */
  max-height: 88vh; max-height: 88dvh;
}
.modal h3 { font-size: 19px; color: var(--navy); margin-bottom: 18px; }
.modal .modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: 14.5px; box-shadow: var(--shadow-lg); z-index: 200;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* wizard steps (new survey) */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.wizard-steps .step { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.wizard-steps .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--line); color: var(--ink-soft); display: flex; align-items: center; justify-content: center; font-size: 13px; }
.wizard-steps .step.active .dot { background: var(--steel); color: #fff; }
.wizard-steps .step.done .dot { background: var(--good); color: #fff; }

.type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.type-card {
  border: 2px solid var(--line); border-radius: 12px; padding: 20px; background: #fff;
  cursor: pointer; text-align: left; transition: border-color .12s, background .12s;
}
.type-card:hover { border-color: var(--steel-light); }
.type-card.selected { border-color: var(--steel); background: var(--steel-pale); }
.type-card .tc-icon { font-size: 30px; }
.type-card .tc-name { font-weight: 700; color: var(--navy); font-size: 16px; margin-top: 8px; }
.type-card .tc-desc { font-size: 13px; color: var(--ink-soft); margin-top: 4px; line-height: 1.4; }

/* responsive */
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; order: -1; }
  .known-issues { margin-bottom: 4px; }
}
@media (max-width: 600px) {
  .main { padding: 16px 12px 70px; }
  .card { padding: 16px; }
  .app-header .who span.role-note { display: none; }

  /* app header: reclaim space so nav + account never force page-level scroll */
  .app-header { padding: 0 10px; padding-top: env(safe-area-inset-top, 0px); gap: 8px; }
  .app-header .brand-logo { height: 32px; width: 32px; }
  .app-header nav { margin-left: 0; gap: 4px; }
  .app-header nav button { padding: 8px 10px; font-size: 13px; }
  .app-header .who b { display: none; }

  .editor-top { gap: 8px; }
  .editor-top .vessel-title { font-size: 18px; word-break: break-word; }

  .card h3 { flex-wrap: wrap; }
  .card h3 .take-notes-btn { margin-left: 0; flex-basis: 100%; }

  .cost-row2 { flex-wrap: wrap; }
  .cost-row2 input { min-width: 140px; }

  .filter-bar input#dash-search { min-width: 0; flex-basis: 100%; }

  /* section tabs: a uniform two-column grid — every section one tap away, tidy rows.
     NOT sticky on phones: 13 tabs over 7 rows would pin ~450px of screen and leave a
     sliver of checklist visible; the grid scrolls away with the content instead. */
  .section-tabs {
    display: grid; grid-template-columns: 1fr 1fr; overflow-x: visible;
    position: static; gap: 6px;
  }
  .section-tabs button {
    justify-content: flex-start; text-align: left; white-space: normal;
    padding: 8px 10px; font-size: 13px; gap: 6px; min-height: 42px;
    min-width: 0; overflow-wrap: anywhere;
  }
  .section-tabs button .count { margin-left: auto; flex-shrink: 0; }
}
@media (max-width: 420px) {
  .cost-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   REPORT (print / PDF) styles
   ============================================================ */
#report-root { display: none; }

@media screen {
  body.report-open #report-root {
    display: block; position: fixed; inset: 0; z-index: 300; background: #525659;
    overflow-y: auto; padding: 30px 12px;
  }
  body.report-open #app-root { display: none; }
  .report-toolbar {
    position: sticky; top: -30px; margin: -30px auto 20px; max-width: 850px;
    background: var(--navy); border-radius: 0 0 12px 12px; padding: 12px 18px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center; z-index: 10;
  }
  .report-toolbar .spacer { flex: 1; }
  .report-page {
    background: #fff; max-width: 850px; margin: 0 auto 22px; padding: 60px 64px;
    box-shadow: 0 4px 20px rgba(0,0,0,.4); position: relative;
  }
  @media (max-width: 600px) {
    body.report-open #report-root { padding: 16px 8px; }
    .report-toolbar { top: -16px; margin: -16px auto 16px; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); gap: 8px; }
    .report-toolbar .spacer { flex-basis: 100%; height: 0; }
    .report-page { padding: 28px 20px; }
    .rp-hin-block { flex-wrap: wrap; }
    .rp-letterhead { flex-wrap: wrap; }
  }

  /* Summary hero card + jump nav — screen-only; @media print hides both further down
     so PDF/print output is untouched no matter what's collapsed on screen. */
  .rp-hero {
    max-width: 850px; margin: 0 auto 14px; background: #fff; border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.4); padding: 20px 26px;
    display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  }
  .rp-hero-photo img { width: 92px; height: 92px; object-fit: cover; border-radius: 8px; display: block; }
  .rp-hero-photo .placeholder {
    width: 92px; height: 92px; border-radius: 8px; background: var(--steel-pale);
    display: flex; align-items: center; justify-content: center; font-size: 30px;
  }
  .rp-hero-main { flex: 1; min-width: 220px; }
  .rp-hero-type { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--steel); font-weight: 700; }
  .rp-hero-vessel {
    font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    font-size: 21px; font-weight: 600; color: var(--navy); margin: 4px 0 8px; letter-spacing: -.005em;
  }
  .rp-hero-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); align-items: center; }
  .rp-hero-rating {
    background: var(--navy); color: #fff; border-radius: 999px; padding: 2px 12px;
    font-size: 11px; font-weight: 700; letter-spacing: .04em;
  }
  .rp-hero-stats { display: flex; gap: 20px; }
  .rp-hero-stat { text-align: center; }
  .rp-hero-stat .n { display: block; font-size: 21px; font-weight: 700; color: var(--navy); }
  .rp-hero-stat .n.poor { color: var(--poor); }
  .rp-hero-stat .n.fair { color: var(--fair); }
  .rp-hero-stat .lbl { font-size: 10.5px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }

  .rp-jumpnav {
    max-width: 850px; margin: 0 auto 18px; display: flex; gap: 6px; overflow-x: auto;
    background: #fff; border-radius: 999px; padding: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.3);
    position: sticky; top: 0; z-index: 9;
  }
  .rp-jumpnav a {
    flex: none; min-height: 44px; display: flex; align-items: center;
    font-size: 12.5px; font-weight: 600; color: var(--navy); text-decoration: none;
    padding: 0 14px; border-radius: 999px; background: var(--steel-pale); white-space: nowrap;
  }
  .rp-jumpnav a:hover { background: var(--navy); color: #fff; }

  @media (max-width: 600px) {
    .rp-hero { padding: 16px 18px; gap: 14px; }
    .rp-hero-stats { width: 100%; justify-content: space-around; }
  }

  /* Collapsible sections — click a heading to fold its body away. Cover, Purpose &
     Scope, and the Invoice (marked .rp-static) are always fully expanded. */
  .report-page:not(.rp-static) > h2 { cursor: pointer; user-select: none; padding-right: 30px; }
  .report-page:not(.rp-static) > h2::before {
    content: "▾"; position: absolute; right: 2px; top: 8px; font-size: 15px;
    color: var(--steel); transition: transform .15s;
  }
  .report-page.rp-collapsed:not(.rp-static) > h2::before { transform: rotate(-90deg); }
  .report-page.rp-collapsed { min-height: 0; }
  .report-page.rp-collapsed > *:not(:first-child) { display: none; }
}

/* Document typography: an almanac-style serif for display, clean sans for body,
   mono for identifiers — the register of a formal marine survey document. */
.report-page {
  font-size: 13.5px; color: #1D2833; line-height: 1.6;
  --rp-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}
/* Rating definitions: one per line, term set 2px larger than body text */
.report-page .rp-def { margin: 0 0 8px; }
.report-page .rp-def b { font-size: 15.5px; }
.report-page .rp-def .rp-pill {
  display: inline-block; border-radius: 999px; padding: 1px 14px 2px; color: #fff;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.rp-sig-img { display: block; max-height: 70px; max-width: 260px; margin-bottom: -8px; }
.rp-pill-excellent { background: var(--excellent); }
.rp-pill-good { background: var(--good); }
.rp-pill-fair { background: var(--amber); }
.rp-pill-poor { background: var(--poor); }
.report-page h1 { font-family: var(--rp-serif); font-size: 27px; font-weight: 600; color: var(--navy); letter-spacing: -.005em; }
.report-page h2 {
  font-family: var(--rp-serif); font-weight: 600; font-size: 22px; color: var(--navy);
  letter-spacing: -.005em; border-bottom: 1px solid #C9D6E2; padding-bottom: 9px;
  margin: 28px 0 16px; position: relative;
}
.report-page h2::after {
  content: ""; position: absolute; left: 0; bottom: -1px; width: 66px; height: 3px;
  background: var(--steel);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.report-page h3 {
  font-size: 12px; color: var(--steel); margin: 18px 0 9px;
  text-transform: uppercase; letter-spacing: .12em; font-weight: 700;
}
.report-page p { margin: 0 0 10px; }

.rp-cover { display: flex; flex-direction: column; min-height: 980px; }
.rp-letterhead { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.rp-letterhead .rp-logo-img { max-height: 56px; max-width: 220px; object-fit: contain; }
.rp-letterhead .rp-co-name { font-weight: 700; font-size: 16px; color: var(--navy); letter-spacing: -.01em; }
.rp-cover .rp-band {
  background: var(--navy); color: #fff; margin: -60px -64px 0; padding: 50px 64px 40px;
  border-bottom: 4px solid var(--steel);
}
.rp-letterhead + .rp-band { margin-top: -18px; }
.rp-cover .rp-band .rp-logo { display: flex; align-items: center; gap: 7px; font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: #8FB0CC; }
.rp-cover .rp-band .rp-logo-mark { height: 18px; width: 18px; border-radius: 4px; flex-shrink: 0; }
/* Sized so the longest survey type ("Pre-Purchase Condition & Valuation Survey")
   stays on ONE line at the report's fixed width — in print and on screen. */
.rp-cover .rp-band h1 { color: #fff; font-family: var(--rp-serif); font-weight: 600; font-size: 29px; margin-top: 14px; letter-spacing: -.005em; line-height: 1.15; white-space: nowrap; }
.rp-cover .rp-band .rp-sub { color: #AFC6DA; margin-top: 10px; font-size: 15.5px; font-family: var(--rp-serif); font-style: italic; }
.rp-cover .rp-photo { margin: 34px 0 10px; text-align: center; }
.rp-cover .rp-photo img { max-width: 100%; max-height: 380px; border-radius: 6px; }
.rp-cover .rp-photo .placeholder {
  height: 300px; border: 2px dashed #C9D6E2; border-radius: 6px; display: flex;
  align-items: center; justify-content: center; color: #8DA4B8; font-size: 14px;
}

/* These three MUST come after the base declarations above, not before: same-specificity
   selectors cascade by source order regardless of @media, so an earlier @media-wrapped
   rule loses to a later plain one. (This is exactly what silently broke the mobile cover
   title before — it was declared up in the earlier @media (max-width:600px) block, so the
   plain .rp-cover .rp-band h1 rule above always won, even on phones.) */
@media screen and (max-width: 600px) {
  .rp-cover .rp-band { margin: -28px -20px 0; padding: 26px 20px 22px; }
  .rp-cover .rp-photo .placeholder { height: 180px; }
}
/* 760px, not 600px: iPad Split View / slide-over / foldables sit at 601-740px, where
   the one-line title still overflows the band and gets clipped by overflow-x:hidden. */
@media screen and (max-width: 760px) {
  .rp-cover .rp-band h1 { white-space: normal; font-size: 23px; }
}
.rp-hin-block {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--steel-pale); border: 1px solid #D3E2EE; border-radius: 8px;
  padding: 12px 16px; margin-top: 14px;
}
.rp-hin-text { display: flex; flex-direction: column; gap: 3px; }
.rp-hin-text .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--steel); font-weight: 700; }
.rp-hin-text .val { font-size: 15px; font-weight: 700; color: var(--navy); font-family: 'SFMono-Regular', Consolas, monospace; letter-spacing: .02em; }
.rp-hin-photo { max-height: 84px; max-width: 200px; object-fit: cover; border-radius: 6px; border: 1px solid #C9D6E2; }
.rp-cover-table { width: 100%; border-collapse: collapse; margin-top: 26px; border-top: 2px solid var(--navy); }
.rp-cover-table td { padding: 8px 4px; border-bottom: 1px solid #E4EBF1; vertical-align: top; font-size: 13.5px; }
.rp-cover-table td:first-child { font-weight: 700; color: var(--steel); width: 38%; font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; padding-top: 10px; }
.rp-cover .rp-surveyor { margin-top: auto; padding-top: 30px; text-align: center; color: var(--ink-soft); font-size: 13px; }
.rp-cover .rp-surveyor b { display: block; color: var(--navy); font-size: 15px; }

.rp-toc { font-family: var(--rp-serif); font-size: 14.5px; }
.rp-toc li { margin: 7px 0 7px 20px; padding-left: 4px; }
.rp-toc li::marker { color: var(--steel); font-weight: 600; }
.rp-toc a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  color: inherit; text-decoration: none; border-bottom: 1px dotted transparent;
}
.rp-toc a:hover { border-bottom-color: var(--steel); }
.rp-toc-page { color: var(--steel); font-weight: 600; flex-shrink: 0; }

table.rp-items { width: 100%; border-collapse: collapse; margin: 8px 0 4px; }
table.rp-items th {
  background: var(--navy); color: #fff; text-align: left; padding: 8px 10px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em; font-weight: 700;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
table.rp-items tbody tr:nth-child(even) td { background: #F5F9FC; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
table.rp-items td { padding: 8px 10px; border-bottom: 1px solid #E1E9F0; vertical-align: top; }
table.rp-items td.rating { white-space: nowrap; font-weight: 700; width: 74px; }
table.rp-items td.rating.excellent { color: var(--excellent); }
table.rp-items td.rating.good { color: var(--good); }
table.rp-items td.rating.fair { color: var(--fair); }
table.rp-items td.rating.poor { color: var(--poor); }
table.rp-items .note { color: #444; font-size: 12.5px; margin-top: 2px; }
.rp-item-photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.rp-item-photos img { width: 130px; height: 98px; object-fit: cover; border-radius: 4px; border: 1px solid #D8E2EA; }

.rp-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-top: 8px; }
.rp-gallery figure { margin: 0; page-break-inside: avoid; }
.rp-gallery img { width: 100%; height: 165px; object-fit: cover; border-radius: 6px; border: 1px solid #D8E2EA; display: block; }
.rp-gallery figcaption { font-size: 12px; color: #556; margin-top: 6px; line-height: 1.4; }

.rp-finding {
  border: 1px solid #E1E9F0; border-left: 5px solid var(--steel); border-radius: 6px;
  padding: 13px 16px; margin-bottom: 12px; page-break-inside: avoid; background: #FBFDFE;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.rp-finding.f-poor { border-left-color: var(--poor); background: #FEF7F7; }
.rp-finding.f-fair { border-left-color: var(--amber); background: #FEFAF3; }
.rp-finding .fhead {
  display: flex; justify-content: space-between; gap: 10px; font-weight: 700;
  color: var(--steel); font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
}
.rp-finding.f-poor .fhead { color: var(--poor); }
.rp-finding.f-fair .fhead { color: var(--amber); }
.rp-finding .fbody { margin-top: 6px; font-size: 13px; color: #2A3540; }
.rp-finding .fbody b { font-family: var(--rp-serif); font-size: 14.5px; color: var(--navy); }

.rp-footer-note { margin-top: 30px; font-size: 11.5px; color: #667; border-top: 1px solid #E4EBF1; padding-top: 12px; }
.rp-sign { margin-top: 44px; }
.rp-sign .line { width: 300px; max-width: 100%; border-bottom: 1.5px solid #333; margin-bottom: 6px; height: 40px; }
.rp-sign b { font-family: var(--rp-serif); font-size: 15px; color: var(--navy); }
.rp-value { font-family: var(--rp-serif); font-size: 24px; font-weight: 600; color: var(--navy); letter-spacing: -.005em; margin: 6px 0 10px; }
.rp-cover .rp-surveyor b { font-family: var(--rp-serif); font-size: 16px; }

/* Running footer: repeats at the bottom of every printed page */
.rp-runfoot { display: none; }
@media print {
  .rp-runfoot {
    display: block; position: fixed; bottom: 0; left: 0; right: 0;
    font-size: 9.5px; color: #7A8B99; text-align: center;
    letter-spacing: .08em; text-transform: uppercase;
    border-top: .5px solid #D7E1EA; padding-top: 4px; background: #fff;
  }
}

@media print {
  @page { size: letter; margin: 0.55in 0.6in; }
  body { background: #fff; }
  body.report-open #report-root { display: block; }
  #app-root, .report-toolbar, .rp-hero, .rp-jumpnav { display: none !important; }
  /* Print always shows every section in full, regardless of on-screen collapse state. */
  .report-page.rp-collapsed > *:not(:first-child) { display: block !important; }
  .report-page:not(.rp-static) > h2::before { display: none !important; }
  .report-page { box-shadow: none; margin: 0; padding: 0; max-width: none; min-height: 0; page-break-after: always; }
  .report-page:last-child { page-break-after: auto; }
  .rp-cover .rp-band { margin: -0.0in -0in 0; padding: 40px 44px 34px; border-radius: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.rp-items th, .badge, .rp-finding, .cost-totals, .rp-hin-block { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  h2, h3 { page-break-after: avoid; }
  table.rp-items tr, .check-item { page-break-inside: avoid; }
}

/* Cargo (Sedgwick) photo-card caption input + placement select. font-size lives here
   (NOT inline) so the touch-device 16px override below can win by source order. */
.cg-ph-ctl { font-size: 11.5px; }

/* ============================================================
   TOUCH-DEVICE overrides (phones + tablets, any width)
   Kept at the END of the file on purpose: these repeat selectors declared above
   at the same specificity, so source order is what makes them win.
   ============================================================ */
@media (pointer: coarse) {
  /* iOS Safari/WKWebView auto-zooms (and stays zoomed) when a focused control's
     font-size is under 16px. Every sub-16px input in the app is listed here. */
  .check-item textarea,
  .seatrial-grid input,
  .filter-bar input, .filter-bar select,
  .moist-row input, .moist-row select, .inv-row input,
  .cost-grid input, .cost-row2 input,
  .license-check-row .lic-input,
  .addphoto-item input,
  .cg-ph-ctl,
  .bt-keyrow input, .bt-net-row input, .bt-net-row select {
    font-size: 16px;
  }

  /* Photo controls: 22px corner buttons on 76px thumbs are below any touch floor
     and ✕ (instant delete) sat 30px from ⇄. Bigger thumbs, bigger buttons, ⇄ moved
     to the bottom-left corner away from ✕, and an invisible extended hit area. */
  .photo-thumb { width: 96px; height: 96px; }
  .photo-thumb .del, .addphoto-thumb .del,
  .photo-thumb .move, .addphoto-thumb .move,
  .photo-thumb .annot, .addphoto-thumb .annot { width: 30px; height: 30px; font-size: 15px; }
  .photo-thumb .move, .addphoto-thumb .move { right: auto; left: 2px; bottom: 2px; }
  .photo-thumb .del::after, .addphoto-thumb .del::after,
  .photo-thumb .move::after, .addphoto-thumb .move::after,
  .photo-thumb .annot::after, .addphoto-thumb .annot::after {
    content: ''; position: absolute; inset: -7px;
  }
  .mic-btn { width: 40px; height: 40px; }
}
