/* Property records follow the Headwaters paper record sheet. */
.record-browser {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
}
.record-sidebar { display: grid; gap: 8px; min-width: 0; align-content: start; }
.record-sidebar > * { min-width: 0; }

.record-nav {
  display: grid;
  gap: 5px;
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.record-nav b, .record-nav strong { color: var(--navy); font-size: .95rem; }
.record-nav:hover { border-color: var(--glass); }
.record-nav[aria-current="true"] { border-color: var(--glass); border-left-color: var(--glass); background: var(--glass-soft); }
.record-nav:focus-visible { outline: 3px solid var(--glass); outline-offset: 2px; }
.record-nav .row { gap: 4px; }
.record-nav .chip { font-size: .68rem; }
.record-detail { display: grid; gap: 10px; min-width: 0; }
.record-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.record-toolbar > * { min-width: 0; }
.record-empty { padding: 30px 18px; border: 1px dashed var(--line); color: var(--muted); text-align: center; border-radius: 6px; }

.record-sheet {
  --sheet-navy: #19264c;
  --sheet-ink: #222c3c;
  --sheet-label: #35527c;
  --sheet-line: #bac6d7;
  --sheet-soft: #f5f7fa;
  --sheet-focus: #2379ad;
  color-scheme: light;
  display: grid;
  gap: 7px;
  width: 100%;
  min-width: 0;
  max-width: 1040px;
  margin-inline: auto;
  padding: clamp(14px, 2.2vw, 27px);
  color: var(--sheet-ink);
  background: #fff;
  border: 1px solid #ccd3de;
  border-radius: 2px;
  box-shadow: 0 3px 14px rgb(18 35 62 / 6%);
  font-family: var(--body, Arial, sans-serif);
  font-size: 12px;
  line-height: 1.4;
}
.record-sheet > * { min-width: 0; }
.sheet-heading {
  margin: 0;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--sheet-navy);
  color: var(--sheet-navy);
  font-family: var(--display, Georgia, serif);
  font-size: clamp(24px, 2.7vw, 35px);
  font-weight: 700;
  line-height: 1.15;
}
.sheet-heading h1, .sheet-heading h2 { color: inherit; font: inherit; margin: 0; }
.sheet-subtitle { margin: 0 0 14px; color: #374458; font-size: 11px; line-height: 1.5; }
.sheet-row { display: grid; gap: 4px; min-width: 0; }
.sheet-property-main { grid-template-columns: 1.2fr 2.75fr 1fr; }
.sheet-property-address { grid-template-columns: 2.35fr 1.05fr .45fr .6fr 1.4fr; }
.sheet-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 3px;
  min-width: 0;
  min-height: 43px;
  margin: 0;
  padding: 5px 7px;
  color: var(--sheet-ink);
  border: 1px solid var(--sheet-line);
  background: #fff;
  font-weight: 400;
}
.sheet-label { display: block; color: var(--sheet-label); font-size: 10px; font-weight: 700; line-height: 1.25; }
.sheet-value { min-width: 0; min-height: 18px; color: var(--sheet-ink); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; font-weight: 400; }
.sheet-choices { display: flex; flex-wrap: wrap; gap: 5px 12px; align-items: center; }
.sheet-choice { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: var(--sheet-ink); font-size: 11px; font-weight: 400; line-height: 1.4; }
.sheet-table-scroll { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain; }
.record-sheet .sheet-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: var(--sheet-ink);
  background: #fff;
  font-size: 12px;
}
.record-sheet .sheet-table th {
  padding: 4px 6px;
  border: 1px solid var(--sheet-line);
  background: var(--sheet-navy);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
}
.record-sheet .sheet-table td { min-width: 0; padding: 5px 6px; border: 1px solid var(--sheet-line); color: var(--sheet-ink); vertical-align: top; overflow-wrap: anywhere; }
.record-sheet .sheet-contact-table { min-width: 500px; }
.sheet-contact-table th:nth-child(1) { width: 25%; }
.sheet-contact-table th:nth-child(2) { width: 21%; }
.sheet-contact-table th:nth-child(3) { width: 31%; }
.sheet-contact-table th:nth-child(4) { width: 17%; }
.sheet-contact-table th:nth-child(5) { width: 6%; }
.record-sheet .sheet-contact-table td { height: 43px; }
.sheet-contact-table .sheet-value { white-space: pre-wrap; }
.sheet-time-equipment { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; gap: 8px; min-width: 0; }
.sheet-times, .sheet-equipment { min-width: 0; }
.record-sheet .sheet-times { min-width: 285px; }
.record-sheet .sheet-times th:first-child { width: 29%; }
.record-sheet .sheet-times td { height: 25px; padding-block: 3px; }
.sheet-equipment { display: flex; flex-direction: column; border: 1px solid var(--sheet-line); }
.sheet-bar { padding: 4px 7px; color: #fff; background: var(--sheet-navy); font-size: 11px; font-weight: 700; line-height: 1.4; }
.sheet-bar small, .sheet-bar span { color: #d4dceb; font-size: 10px; font-weight: 400; }
.sheet-equipment > .sheet-value, .record-sheet .sheet-equipment > textarea {
  flex: 1;
  min-height: 175px;
  padding: 2px 7px;
  border: 0;
  border-radius: 0;
  line-height: 25px;
  background-color: #fff;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 24px, var(--sheet-line) 24px, var(--sheet-line) 25px);
  background-origin: content-box;
}
.sheet-status-row { grid-template-columns: 1.55fr 1fr; }
.sheet-quote-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.record-sheet .sheet-prices { min-width: 450px; }
.sheet-prices th:first-child { width: 28%; }
.record-sheet .sheet-prices td { padding: 0; vertical-align: middle; }
.record-sheet .sheet-prices td:first-child { padding: 8px; background: #fff; font-weight: 700; }
.sheet-price-cell { display: flex; gap: 5px; align-items: center; min-width: 0; min-height: 38px; padding: 7px 8px; background: #f8f9fb; color: var(--sheet-ink); }
.sheet-price-cell.selected { background: #e8f2f9; }
.sheet-price-cell .sheet-value { min-height: 0; }
.sheet-check { display: inline-block; position: relative; flex: 0 0 14px; width: 14px; height: 14px; border: 1px solid #29384f; background: #fff; vertical-align: -2px; }
.sheet-check.selected::after { content: ""; position: absolute; left: 3px; top: 0; width: 5px; height: 9px; border: solid var(--sheet-navy); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.sheet-notes { margin-top: 9px; border: 1px solid var(--sheet-navy); min-width: 0; }
.sheet-notes > .sheet-value, .record-sheet .sheet-notes > textarea {
  display: block;
  width: 100%;
  min-height: 160px;
  margin: 0;
  padding: 4px 8px;
  border: 0;
  border-radius: 0;
  color: var(--sheet-ink);
  line-height: 23px;
  background-color: #fff;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 22px, var(--sheet-line) 22px, var(--sheet-line) 23px);
  background-origin: content-box;
}
.sheet-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 15px; margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--sheet-line); color: #627087; font-size: 10px; }
.record-sheet input:not([type="checkbox"]):not([type="radio"]), .record-sheet select, .record-sheet textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 23px;
  margin: 0;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid #dce3ec;
  border-radius: 0;
  color: var(--sheet-ink);
  background-color: #fff;
  font: 12px/1.4 var(--body, Arial, sans-serif);
  box-shadow: none;
}
.record-sheet textarea { resize: vertical; overflow-wrap: anywhere; }
.record-sheet input[readonly] { color: #465a74; background-color: #f7f9fc; }
.record-sheet input::placeholder, .record-sheet textarea::placeholder { color: #708198; opacity: 1; }
.record-sheet input[type="checkbox"], .record-sheet input[type="radio"] {
  appearance: none;
  position: relative;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
  border: 1px solid #29384f;
  border-radius: 0;
  background: #fff;
  cursor: pointer;
}
.record-sheet input[type="checkbox"]:checked::after, .record-sheet input[type="radio"]:checked::after { content: ""; position: absolute; left: 3px; top: 0; width: 5px; height: 9px; border: solid var(--sheet-navy); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.record-sheet input:focus-visible, .record-sheet select:focus-visible, .record-sheet textarea:focus-visible, .record-sheet button:focus-visible, .record-sheet summary:focus-visible { outline: 2px solid var(--sheet-focus); outline-offset: 2px; }
.record-sheet .sheet-price-cell input:not([type="checkbox"]):not([type="radio"]) { flex: 1; width: 0; background-color: transparent; }
.record-sheet .sheet-contact-table textarea { min-height: 36px; }
.sheet-line-actions { width: 55px; text-align: center; white-space: nowrap; }
.record-sheet .sheet-line-actions { width: 55px; }
.sheet-editor-tools, .sheet-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; min-width: 0; }
.sheet-editor-tools { margin: 1px 0 4px; }
.sheet-actions { padding-top: 8px; }
.sheet-routing, .sheet-photo-review { min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.sheet-routing summary, .sheet-photo-review summary { cursor: pointer; font-size: 12px; font-weight: 600; }
.sheet-routing[open] > summary, .sheet-photo-review[open] > summary { margin-bottom: 10px; }
.sheet-photo-review img { display: block; max-width: 100%; height: auto; max-height: 520px; object-fit: contain; object-position: left top; }
.record-sheet .btn { color: var(--sheet-ink); background: #fff; border-color: var(--sheet-line); }
.record-sheet .btn.primary { color: #fff; background: var(--sheet-navy); border-color: var(--sheet-navy); }
.record-sheet .btn.danger { color: #a52a24; border-color: #c69c98; }
.record-sheet .muted { color: #627087; }
.record-sheet .sheet-routing, .record-sheet .sheet-photo-review { color: var(--sheet-ink); background: #f8fafc; border-color: var(--sheet-line); }
.record-sheet .sheet-routing label.f { color: var(--sheet-label); }

@media (max-width: 1040px) {
  .record-browser { grid-template-columns: 205px minmax(0, 1fr); gap: 12px; }
  .sheet-property-address { grid-template-columns: 2fr 1fr .5fr .7fr; }
  .sheet-property-address > :last-child { grid-column: 1 / -1; }
  .sheet-quote-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet-time-equipment { grid-template-columns: minmax(0, 1fr); }
  .sheet-equipment > .sheet-value, .record-sheet .sheet-equipment > textarea { min-height: 100px; }
}
@media (max-width: 760px) {
  .record-browser { grid-template-columns: minmax(0, 1fr); }
  .record-sidebar { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); max-height: 265px; overflow-y: auto; padding: 3px; margin: -3px; }
  .record-sheet { padding: 16px; }
  .sheet-subtitle { margin-bottom: 8px; }
  .sheet-time-equipment { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sheet-equipment > .sheet-value, .record-sheet .sheet-equipment > textarea { min-height: 175px; }
}
@media (max-width: 560px) {
  .record-sheet { padding: 12px; gap: 6px; }
  .sheet-heading { font-size: 27px; }
  .sheet-property-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sheet-property-main > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .sheet-property-address { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet-property-address > :first-child, .sheet-property-address > :nth-child(2), .sheet-property-address > :last-child { grid-column: 1 / -1; }
  .sheet-property-address > :nth-child(3) { grid-column: 1; }
  .sheet-property-address > :nth-child(4) { grid-column: 2 / -1; }
  .sheet-status-row { grid-template-columns: minmax(0, 1fr); }
  .sheet-quote-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-time-equipment { grid-template-columns: minmax(0, 1fr); }
  .sheet-equipment > .sheet-value, .record-sheet .sheet-equipment > textarea { min-height: 100px; }
  .record-sheet input:not([type="checkbox"]):not([type="radio"]), .record-sheet select, .record-sheet textarea { font-size: 16px; }
  .sheet-footer { margin-top: 12px; }
}

#view > .panel + .record-browser, #view > .panel + .record-empty { margin-top: 14px; }
.record-sheet .sheet-table tbody th { color: var(--sheet-ink); background: #fff; font-size: 12px; font-weight: 400; }
.record-sheet .sheet-prices tbody th { font-weight: 700; padding: 8px; }
.record-sheet .sheet-bar { font-family: var(--body); }

#record-printout { display: none; }
@media print {
  @page { size: letter portrait; margin: .5in; }
  body.records-printing { margin: 0; padding: 0; background: #fff; color: #222c3c; color-scheme: light; }
  body.records-printing > :not(#record-printout) { display: none !important; }
  body.records-printing #record-printout { display: block; }
  #record-printout .record-sheet {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    font-size: 8.5pt;
    line-height: 1.2;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  #record-printout .record-sheet + .record-sheet { break-before: page; page-break-before: always; }
  #record-printout .record-sheet > * { margin-top: 0; margin-bottom: 4pt; }
  #record-printout .record-sheet > header { break-after: avoid; }
  #record-printout .sheet-heading { font-size: 22pt; line-height: 1.15; padding-bottom: 3pt; }
  #record-printout .sheet-subtitle { font-size: 7pt; line-height: 1.2; margin: 3pt 0 9pt; }
  #record-printout .sheet-row { gap: 3pt; break-inside: avoid; }
  #record-printout .sheet-property-main { grid-template-columns: 1.2fr 2.75fr 1fr; }
  #record-printout .sheet-property-address { grid-template-columns: 2.35fr 1.05fr .45fr .6fr 1.4fr; }
  #record-printout .sheet-property-main > *, #record-printout .sheet-property-address > * { grid-column: auto; grid-row: auto; }
  #record-printout .sheet-field { min-height: 27pt; padding: 3pt 4pt; gap: 2pt; }
  #record-printout .sheet-label { font-size: 7pt; }
  #record-printout .sheet-value { min-height: 10pt; font-size: 8pt; line-height: 1.25; }
  #record-printout .sheet-choice { font-size: 7.5pt; gap: 3pt; }
  #record-printout .sheet-choices { gap: 3pt 6pt; }
  #record-printout .sheet-check { width: 9pt; height: 9pt; flex-basis: 9pt; }
  #record-printout .sheet-check.selected::after { left: 2pt; top: 0; width: 3pt; height: 6pt; border-width: 0 1.2pt 1.2pt 0; }
  #record-printout .sheet-table-scroll { overflow: visible; }
  #record-printout .sheet-table { min-width: 0; font-size: 8pt; }
  #record-printout .sheet-table th { font-size: 7pt; padding: 3pt 4pt; }
  #record-printout .sheet-table tbody th { font-size: 8pt; }
  #record-printout .sheet-table td { padding: 3pt 4pt; }
  #record-printout .sheet-table tr { break-inside: avoid; page-break-inside: avoid; }
  #record-printout .sheet-table thead { display: table-header-group; }
  #record-printout .sheet-contact-table td { height: 24pt; }
  #record-printout .sheet-time-equipment { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6pt; }
  #record-printout .sheet-times td { height: 14pt; padding: 2pt 4pt; }
  #record-printout .sheet-times tbody th { padding: 2pt 4pt; }
  #record-printout .sheet-bar { font-size: 8pt; line-height: 1.2; padding: 3pt 5pt; break-after: avoid; }
  #record-printout .sheet-bar span { font-size: 7pt; }
  #record-printout .sheet-equipment > .sheet-value { min-height: 98pt; line-height: 14pt; padding: 2pt 5pt; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 13.5pt, var(--sheet-line) 13.5pt, var(--sheet-line) 14pt); }
  #record-printout .sheet-status-row { grid-template-columns: 1.55fr 1fr; }
  #record-printout .sheet-quote-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #record-printout .sheet-prices td { padding: 0; }
  #record-printout .sheet-prices tbody th { padding: 5pt; }
  #record-printout .sheet-price-cell { min-height: 22pt; padding: 4pt 5pt; gap: 4pt; }
  #record-printout .sheet-notes > .sheet-value { min-height: 98pt; padding: 3pt 6pt; line-height: 14pt; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 13.5pt, var(--sheet-line) 13.5pt, var(--sheet-line) 14pt); }
  #record-printout .sheet-footer { margin-top: 12pt; margin-bottom: 0; padding-top: 5pt; font-size: 7pt; break-inside: avoid; }
}
