@import url('assets/fonts/fonts.css');

:root {
  color-scheme: light;
  --ink: #191c1d;
  --muted: #737878;
  --line: #e4e5e1;
  --paper: #ffffff;
  --canvas: #f4f3ef;
  --soft: #f8f8f5;
  --red: #d42a26;
  --orange: #ee7c10;
  --green: #3e9b3a;
  --blue: #0b62a4;
  --radius: 8px;
  font-family: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px clamp(20px, 4vw, 62px); background: #fff; border-bottom: 1px solid var(--line); }
.brand { color: inherit; display: flex; align-items: center; gap: 15px; text-decoration: none; flex: 0 0 auto; }
.brand img { width: 147px; height: 59px; object-fit: contain; }
.brand-divider { width: 1px; height: 31px; background: var(--line); }
.brand-caption { color: #505556; font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; min-width: 0; }
.history-label { color: var(--muted); font-size: 12px; }
#report-picker { width: 150px; height: 37px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: white; font-size: 12px; }
.save-status { color: #607362; font-size: 11px; min-width: 108px; text-align: right; }
.button { display: inline-flex; min-height: 37px; align-items: center; justify-content: center; gap: 7px; padding: 0 13px; border: 1px solid transparent; border-radius: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-quiet { border-color: var(--line); background: white; }
.button-quiet:hover, .button-outline:hover { background: var(--soft); }
.button-dark { color: white; background: var(--ink); }
.button-dark:hover { background: #33393b; }
.button-accent { color: white; background: var(--red); }
.button-accent:hover { background: #b92521; }
.button-outline { min-height: 34px; color: var(--ink); background: white; border-color: var(--line); }

.page-shell { width: min(100% - 48px, 1120px); margin: 0 auto; padding: 38px 0 60px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 0 2px 25px; }
.eyebrow, .section-kicker { color: var(--muted); font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 500; letter-spacing: .11em; text-transform: uppercase; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 11px; }
.brand-spectrum { width: 22px; height: 3px; background: linear-gradient(90deg, var(--red) 0 25%, var(--orange) 25% 50%, var(--green) 50% 75%, var(--blue) 75%); }
.eyebrow-separator { color: #c0c2bd; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(27px, 3vw, 35px); letter-spacing: -.045em; line-height: 1.12; font-weight: 600; }
.page-intro { max-width: 580px; margin-top: 9px; color: #686f70; font-size: 14px; }
.local-note { display: flex; align-items: center; gap: 8px; color: #717775; padding: 8px 11px; border: 1px solid #e4e5e1; border-radius: 4px; background: #f9f9f6; font-size: 11px; white-space: nowrap; }
.local-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

#service-form { display: grid; gap: 14px; }
.paper-card { padding: 24px 27px; background: var(--paper); border: 1px solid #e9e9e5; border-radius: var(--radius); box-shadow: 0 2px 7px rgb(30 34 30 / 2.5%); }
.report-top-grid { display: contents; }
.report-heading { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 24px 28px; border-top: 3px solid transparent; border-image: linear-gradient(90deg, var(--red) 0 25%, var(--orange) 25% 50%, var(--green) 50% 75%, var(--blue) 75%) 1; }
.report-title-block h2 { margin-top: 3px; font-size: 26px; letter-spacing: -.04em; }
.report-subtitle { margin-top: 3px; color: var(--muted); font-size: 12px; }
.report-number-grid { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(145px, .8fr); gap: 12px; width: min(50%, 430px); }
.field { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.field > span { color: #727777; font-size: 11px; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; border: 1px solid #dcdfdb; border-radius: 4px; background: #fff; padding: 9px 10px; font-size: 13px; line-height: 1.35; transition: border-color .15s ease, box-shadow .15s ease; }
.field input, .field select { min-height: 39px; }
.field textarea { min-height: 82px; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #b9bfba; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgb(11 98 164 / 10%); }
.field input::placeholder, .field textarea::placeholder { color: #a3a8a4; }
.field select { appearance: auto; }
.section-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.section-heading--split { justify-content: space-between; }
.section-heading-main { display: flex; align-items: center; gap: 13px; }
.section-index { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: 50%; color: #585e5e; background: #f2f3f0; font-family: 'IBM Plex Mono', monospace; font-size: 10px; }
.section-heading h2 { margin-top: 1px; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.section-kicker { font-size: 9px; letter-spacing: .09em; }
.form-grid { display: grid; gap: 14px 13px; }
.form-grid--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field--span-2 { grid-column: span 2; }
.address-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.subform { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 17px; border: 1px solid var(--line); border-radius: 6px; }
.subform legend { padding: 0 6px; color: #323738; font-size: 13px; font-weight: 600; }
.form-grid--zip { grid-template-columns: minmax(88px, .45fr) 1fr; gap: 10px; }

.repeat-list { display: grid; gap: 12px; }
.equipment-card { padding: 17px 18px 18px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.equipment-card-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.equipment-number { display: flex; align-items: baseline; gap: 8px; color: #656b6b; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.equipment-position { color: var(--ink); font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.equipment-notes { margin-top: 14px; }
.equipment-notes textarea { min-height: 96px; }
.remove-button, .text-button { color: #888e8d; background: transparent; border: 0; font-size: 11px; }
.remove-button:hover, .text-button:hover { color: var(--red); }
.remove-button { padding: 5px 2px; }
.table-header { display: grid; align-items: center; gap: 9px; padding: 0 11px 7px; color: #7a807e; font-family: 'IBM Plex Mono', monospace; font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.material-header, .material-row { grid-template-columns: 46px minmax(130px, .9fr) minmax(220px, 2fr) minmax(95px, .55fr) 65px; }
.time-header, .time-row { grid-template-columns: minmax(80px, .65fr) minmax(130px, 1fr) minmax(150px, 1.2fr) minmax(85px, .65fr) minmax(85px, .65fr) minmax(90px, .65fr) 65px; }
.repeat-list--rows { gap: 7px; }
.repeat-row { display: grid; align-items: center; gap: 9px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 5px; }
.row-position { padding-left: 4px; color: #626967; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.repeat-row .field { gap: 0; }
.repeat-row .field input, .repeat-row .field select { min-height: 35px; padding: 7px 8px; font-size: 12px; }
.helper-text { margin-top: 9px; color: #858b87; font-size: 11px; }
.mobile-only { display: none; }
.print-only { display: none !important; }
.print-value { display: none; }

.acceptance-copy { margin: -5px 0 18px; padding: 12px 14px; border-left: 2px solid var(--green); background: #f7f9f5; color: #515958; font-size: 12px; }
.signoff-fields { margin-bottom: 18px; }
.signature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.signature-block { min-width: 0; }
.signature-topline { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; color: #646b69; font-size: 11px; }
.signature-pad { display: block; width: 100%; height: 135px; touch-action: none; border: 1px dashed #ccd1cc; border-radius: 4px; background: #fff; cursor: crosshair; }
.company-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 25px; padding-top: 15px; border-top: 1px solid var(--line); }
.company-footer img { width: 130px; height: 52px; object-fit: contain; object-position: left center; }
.company-footer address { color: #777d7a; font-size: 10px; font-style: normal; line-height: 1.65; text-align: right; }
.screen-footer { display: flex; justify-content: space-between; gap: 15px; margin-top: 18px; color: #858b87; font-size: 10px; }

@media (max-width: 1000px) {
  .topbar { align-items: flex-start; }
  .brand { padding-top: 2px; }
  .topbar-actions { flex-wrap: wrap; }
  .save-status { display: none; }
  .form-grid--four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .time-header, .time-row { grid-template-columns: minmax(70px, .6fr) minmax(115px, .9fr) minmax(135px, 1.2fr) repeat(2, minmax(74px, .6fr)) minmax(80px, .7fr) 55px; gap: 6px; }
}
@media (max-width: 760px) {
  .topbar { flex-direction: column; gap: 12px; padding: 10px 16px 13px; }
  .brand img { width: 122px; height: 49px; }
  .brand { gap: 10px; }
  .brand-caption { font-size: 12px; }
  .topbar-actions { display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 7px; }
  .history-label { display: none; }
  #report-picker { width: 100%; grid-column: 1 / -1; }
  .topbar-actions .button { width: 100%; padding-inline: 8px; }
  #save-button { display: none; }
  .page-shell { width: min(100% - 28px, 620px); padding-top: 25px; }
  .page-heading { display: block; padding-bottom: 18px; }
  .page-intro { font-size: 13px; }
  .local-note { display: inline-flex; margin-top: 13px; font-size: 10px; }
  .paper-card { padding: 19px 16px; }
  .report-heading { align-items: stretch; flex-direction: column; gap: 17px; padding: 20px 17px; }
  .report-number-grid { width: 100%; grid-template-columns: 1fr 1fr; }
  .form-grid--four, .form-grid--two, .address-grid, .signature-grid { grid-template-columns: 1fr; }
  .field--span-2 { grid-column: auto; }
  .subform { padding: 14px; }
  .section-heading--split { align-items: flex-start; gap: 10px; }
  .section-heading h2 { font-size: 15px; }
  .section-heading .button { min-height: 32px; padding-inline: 8px; font-size: 10px; }
  .equipment-card { padding: 14px; }
  .equipment-notes { gap: 11px; }
  .table-header { display: none; }
  .material-row, .time-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 11px; }
  .material-row .row-position { grid-column: 1 / -1; }
  .time-row .field:nth-child(3) { grid-column: 1 / -1; }
  .repeat-row .field { gap: 4px; }
  .mobile-only { display: block; color: #727777; font-size: 10px; }
  .repeat-row .remove-button { justify-self: start; }
  .company-footer { align-items: flex-start; flex-direction: column; gap: 10px; }
  .company-footer address { text-align: left; }
  .screen-footer { flex-direction: column; gap: 3px; }
}
@media (max-width: 380px) {
  .report-number-grid { grid-template-columns: 1fr; }
  .section-heading { gap: 9px; }
  .section-index { width: 28px; height: 28px; flex-basis: 28px; }
  .eyebrow { flex-wrap: wrap; gap: 6px; font-size: 8px; }
}

@page { size: A4; margin: 12mm 14mm 13mm; }
@media print {
  body { background: white; color: #111; font-size: 8pt; line-height: 1.22; }
  .screen-only, .screen-footer, .page-heading { display: none !important; }
  .print-only { display: block !important; }
  .page-shell { width: 100%; max-width: none; margin: 0; padding: 0; }
  #service-form { display: block; }
  .paper-card { margin: 0 0 5px; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; break-inside: auto; }
  .field { min-width: 0; gap: 1px; }
  .field > span { color: #111; font-size: 6.7pt; font-weight: 600; }
  .field input, .field select, .field textarea {
    width: 100%; min-width: 0; padding: 1px 2px; border: 0; border-radius: 0; background: transparent; box-shadow: none;
    font-size: 7.4pt; line-height: 1.18; appearance: none;
  }
  .field input, .field select { min-height: 0; height: auto; }
  .field textarea { display: none !important; min-height: 0; resize: none; overflow: visible; }
  .print-value { display: block; color: #111; font-size: 7.2pt; line-height: 1.16; white-space: pre-wrap; overflow-wrap: anywhere; }
  input, textarea, select { color: #111 !important; }
  input[type="date"]::-webkit-calendar-picker-indicator,
  input[type="time"]::-webkit-calendar-picker-indicator,
  input[type="date"]::-webkit-inner-spin-button,
  input[type="date"]::-webkit-clear-button { display: none !important; -webkit-appearance: none; }
  a { color: #111; text-decoration: none; }

  .report-top-grid {
    display: grid; grid-template-columns: 1.08fr .92fr; align-items: start; gap: 8mm; margin-bottom: 5px;
    break-inside: avoid; page-break-inside: avoid;
  }
  .report-top-grid > .paper-card { margin: 0; }
  .customer-section { grid-column: 1; grid-row: 1; }
  .report-heading {
    grid-column: 2; grid-row: 1; display: block; padding: 0; border: 1px solid #666; border-radius: 0;
    border-image: none; background: #f2f2f2;
  }
  .print-logo { display: block; width: 43mm; height: 17mm; margin: 0 0 3mm; object-fit: contain; object-position: left center; }
  .customer-section .section-heading { display: none !important; }
  .address-grid { display: block; }
  .customer-section .subform { display: grid; gap: 0; margin: 0 0 2mm; padding: 0; border: 0; border-radius: 0; break-inside: avoid; }
  .customer-section .subform legend { padding: 0; margin-bottom: 1px; color: #111; font-size: 7.4pt; font-weight: 700; }
  .customer-section .field { display: block; }
  .customer-section .field > span { display: none; }
  .customer-section .field input { padding: 0; font-size: 7.8pt; line-height: 1.25; }
  .customer-section input[name="invoiceName"], .customer-section input[name="siteName"] { font-weight: 600; }
  .customer-section .form-grid--zip { grid-template-columns: .26fr 1fr; gap: 0; }
  .report-title-block { padding: 5px 7px 4px; border-bottom: 1px solid #777; background: #ddd; text-align: center; }
  .report-title-block .section-kicker { display: none; }
  .report-title-block h2 { margin: 0; font-size: 13pt; line-height: 1.1; letter-spacing: 0; }
  .report-subtitle { margin-top: 2px; color: #111; font-size: 7pt; }
  .report-number-grid { display: grid; grid-template-columns: 1fr; width: 100%; gap: 1px; padding: 4px 7px 5px; }
  .report-number-grid .field { display: grid; grid-template-columns: 28mm 1fr; align-items: center; gap: 3px; }
  .report-number-grid .field > span { font-size: 7pt; font-weight: 500; }
  .report-number-grid .field input { padding: 0; font-size: 8pt; }
  .report-number-grid input[name="reportNo"] { font-weight: 700; }

  .job-section { padding: 4px 5px; border: 1px solid #777; margin: 2px 0 5px; }
  .job-section .section-heading { display: none !important; }
  .job-fields {
    display: grid; grid-template-columns: 1.05fr .95fr; gap: 1px 9px;
    grid-template-areas: "status order" "action customer" "comment priority" "caller scheduled" "phone technician";
  }
  .job-order-no { grid-area: order; }
  .job-customer-no { grid-area: customer; }
  .job-caller { grid-area: caller; }
  .job-phone { grid-area: phone; }
  .job-scheduled { grid-area: scheduled; }
  .job-technician { grid-area: technician; }
  .job-status { grid-area: status; }
  .job-priority { grid-area: priority; }
  .job-action { grid-area: action; }
  .job-comment { grid-area: comment; }
  .job-fields .field { display: flex; flex-direction: row; align-items: baseline; gap: 4px; }
  .job-fields .field > span { flex: 0 0 auto; white-space: nowrap; font-size: 6.5pt; font-weight: 500; }
  .job-fields .field input, .job-fields .field select { flex: 1 1 auto; padding: 0; font-size: 7.4pt; }
  .job-fields .job-action > span { min-width: 15mm; }
  .job-fields .job-comment > span { font-size: 5.7pt; }

  .notes-section { margin: 0 0 5px; padding: 0 1px; }
  .notes-section .section-heading { gap: 0; margin: 0 0 1px; }
  .notes-section .section-index, .notes-section .section-kicker { display: none; }
  .notes-section .section-heading h2 { margin: 0; font-size: 7.5pt; font-weight: 700; letter-spacing: 0; }
  .notes-section .field > span:not(.print-value) { display: none; }
  .notes-section textarea { width: 100%; padding: 0; border: 0; font-size: 7.4pt; }

  .equipment-section .section-heading, .material-section .section-heading, .time-section .section-heading { display: none !important; }
  .equipment-header, .material-header, .time-header {
    display: grid !important; align-items: center; padding: 3px 4px; margin-bottom: 1px; color: #111;
    background: #ddd; border-top: 1px solid #999; border-bottom: 1px solid #777; -webkit-print-color-adjust: exact; print-color-adjust: exact;
    font-size: 6.8pt; font-family: inherit; font-weight: 700; letter-spacing: 0; text-transform: none;
  }
  .equipment-header { grid-template-columns: 7mm 1.05fr 1fr .9fr 1.25fr; gap: 4px; }
  .equipment-card {
    display: grid; grid-template-columns: 7mm 1fr; grid-template-areas: "number fields" "notes notes";
    gap: 2px 4px; padding: 3px 2px 4px; border: 0; border-bottom: 1px solid #aaa; border-radius: 0; background: transparent;
    break-inside: avoid; page-break-inside: avoid;
  }
  .equipment-card-heading { grid-area: number; align-self: start; margin: 0; }
  .equipment-number { display: block; color: #111; font-size: 7pt; letter-spacing: 0; }
  .equipment-number span:last-child, .equipment-card-heading .remove-button { display: none !important; }
  .equipment-fields { grid-area: fields; grid-template-columns: 1.05fr 1fr .9fr 1.25fr; gap: 4px; }
  .equipment-fields .field > span { display: none; }
  .equipment-fields .field input { padding: 0; font-size: 7.2pt; }
  .equipment-notes { grid-area: notes; grid-template-columns: .85fr 1.5fr; gap: 4px 8px; margin-top: 2px; }
  .equipment-notes .field > span { font-size: 6.7pt; }
  .equipment-notes .print-value { padding: 0; font-size: 7.2pt; line-height: 1.16; }
  .equipment-section, .material-section { margin-bottom: 5px; }

  .material-header { grid-template-columns: 9mm minmax(30mm, .9fr) minmax(65mm, 2fr) minmax(18mm, .55fr) 0; gap: 4px; }
  .material-row { grid-template-columns: 9mm minmax(30mm, .9fr) minmax(65mm, 2fr) minmax(18mm, .55fr) 0; gap: 4px; padding: 2px 4px; border: 0; border-bottom: 1px solid #ccc; border-radius: 0; }
  .repeat-row .field input, .repeat-row .field select { min-height: 0; height: auto; }
  .material-row .row-position { grid-column: auto !important; }
  .material-row .field > span, .material-row .remove-button { display: none !important; }
  .material-row .field input { padding: 0; font-size: 7.2pt; }
  .row-position { padding-left: 0; color: #111; font-size: 7pt; }
  .helper-text { margin: 2px 0 0; color: #444; font-size: 6.2pt; }
  .time-section { margin: 0 0 7px; break-inside: avoid; page-break-inside: avoid; }
  .time-header { grid-template-columns: minmax(12mm, .65fr) minmax(25mm, 1fr) minmax(32mm, 1.2fr) repeat(2, minmax(19mm, .65fr)) minmax(25mm, .65fr) 0; gap: 4px; }
  .time-row { grid-template-columns: minmax(12mm, .65fr) minmax(25mm, 1fr) minmax(32mm, 1.2fr) repeat(2, minmax(19mm, .65fr)) minmax(25mm, .65fr) 0; gap: 4px; padding: 3px 4px; border: 0; border-radius: 0; border-bottom: 1px solid #ccc; }
  .time-row .field:nth-child(3) { grid-column: auto !important; }
  .time-row .field > span, .time-row .remove-button { display: none !important; }
  .time-row .field input, .time-row .field select { padding: 0; font-size: 7.2pt; }
  .time-section .helper-text { display: none; }
  .signoff-card { padding: 0; margin-top: 7px; break-inside: avoid; page-break-inside: avoid; }
  .signoff-card .section-heading { gap: 5px; margin: 0 0 3px; }
  .signoff-card .section-index, .signoff-card .section-kicker { display: none; }
  .signoff-card .section-heading h2 { margin: 0; font-size: 8pt; }
  .acceptance-copy { margin: 0 0 5px; padding: 0; border: 0; background: transparent; color: #111; font-size: 7.2pt; }
  .signoff-fields { grid-template-columns: 1fr 1fr; gap: 2px 8px; margin-bottom: 5px; }
  .signoff-fields .field input { padding: 0; }
  .signature-grid { grid-template-columns: 1fr 1fr; gap: 9mm; }
  .signature-topline { margin-bottom: 1px; color: #111; font-size: 7.2pt; }
  .signature-pad { width: 78%; height: 15mm; margin: 0 auto; border: 0; border-bottom: 1px solid #555; border-radius: 0; background: transparent; }
  .company-footer { margin-top: 8px; padding-top: 5px; border-top: 1px solid #777; break-inside: avoid; }
  .company-footer img { width: 32mm; height: 12mm; }
  .company-footer address { color: #333; font-size: 6.3pt; line-height: 1.4; }
  .mobile-only { display: none !important; }
}
