/* ============================================================
   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;
  --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%; }

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-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; height: 60px;
  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 .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; 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: 66px; z-index: 40;
}
.section-tabs button {
  flex: 0 0 auto; display: flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 8px 14px; border: none; border-radius: 9px;
  background: transparent; color: var(--ink-soft); font-size: 14px; font-weight: 600;
  white-space: nowrap;
}
.section-tabs button.active { background: var(--navy); color: #fff; }
.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; }
.section-tabs button.flagged { box-shadow: inset 0 0 0 1.5px var(--amber-line); }

.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-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-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); }

/* 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; }

/* 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; } }

/* 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-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); }

/* 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; max-height: 88vh; overflow-y: auto; padding: 26px;
}
.modal h3 { font-size: 19px; color: var(--navy); margin-bottom: 18px; }
.modal .modal-actions { display: flex; 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; 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%; }
}
@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;
    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); min-height: 1100px; 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; gap: 8px; }
    .report-toolbar .spacer { flex-basis: 100%; height: 0; }
    .report-page { padding: 28px 20px; }
    .rp-cover .rp-band { margin: -28px -20px 0; padding: 26px 20px 22px; }
    .rp-hin-block { flex-wrap: wrap; }
    .rp-letterhead { flex-wrap: wrap; }
    .rp-cover .rp-photo .placeholder { height: 180px; }
  }
}

.report-page { font-size: 13.5px; color: #1a1a1a; line-height: 1.55; }
.report-page h1 { font-size: 26px; color: var(--navy); }
.report-page h2 {
  font-size: 17px; color: var(--navy); text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 2.5px solid var(--steel); padding-bottom: 6px; margin: 26px 0 14px;
}
.report-page h3 { font-size: 14px; color: var(--steel); margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .04em; }

.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: 46px 64px 38px; }
.rp-letterhead + .rp-band { margin-top: -18px; }
.rp-cover .rp-band .rp-logo { display: flex; align-items: center; gap: 7px; font-size: 13px; letter-spacing: .25em; text-transform: uppercase; color: #9DB8D2; }
.rp-cover .rp-band .rp-logo-mark { height: 18px; width: 18px; border-radius: 4px; flex-shrink: 0; }
.rp-cover .rp-band h1 { color: #fff; font-size: 30px; margin-top: 10px; letter-spacing: -.01em; }
.rp-cover .rp-band .rp-sub { color: #B9CCDD; margin-top: 6px; font-size: 15px; }
.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;
}
.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; }
.rp-cover-table td { padding: 7px 4px; border-bottom: 1px solid #E4EBF1; vertical-align: top; }
.rp-cover-table td:first-child { font-weight: 700; color: var(--navy); width: 38%; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.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 li { margin: 6px 0 6px 20px; }

table.rp-items { width: 100%; border-collapse: collapse; margin: 8px 0 4px; }
table.rp-items th { background: var(--steel-pale); color: var(--navy); text-align: left; padding: 7px 9px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.rp-items td { padding: 7px 9px; border-bottom: 1px solid #E7EDF3; vertical-align: top; }
table.rp-items td.rating { white-space: nowrap; font-weight: 700; width: 74px; }
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 #E7EDF3; border-left: 4px solid var(--steel); border-radius: 6px; padding: 12px 14px; margin-bottom: 12px; page-break-inside: avoid; }
.rp-finding.f-poor { border-left-color: var(--poor); }
.rp-finding.f-fair { border-left-color: var(--amber-line); }
.rp-finding .fhead { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; color: var(--navy); font-size: 13.5px; }
.rp-finding .fbody { margin-top: 5px; font-size: 13px; color: #333; }

.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; border-bottom: 1.5px solid #333; margin-bottom: 6px; height: 40px; }

@media print {
  @page { size: letter; margin: 0.55in 0.6in; }
  body { background: #fff; }
  body.report-open #report-root { display: block; }
  #app-root, .report-toolbar { 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; }
}
