:root {
  --ink: #20231f;
  --paper: #f2f0e8;
  --sheet: #fffdf5;
  --field: #fffaf0;
  --line: #c7c1b2;
  --muted: #68675f;
  --work: #2f342f;
  --stamp: #b6422f;
  --marker: #e7b94d;
  --green: #506d55;
  --shadow: 0 18px 46px rgba(32, 35, 31, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(47, 52, 47, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(47, 52, 47, 0.055) 1px, transparent 1px),
    var(--paper);
  background-size: 30px 30px;
  font-family: "Aptos", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
.sample-button {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--work);
  border-radius: 5px;
  background: var(--sheet);
  color: var(--work);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
  cursor: pointer;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease-out, box-shadow 120ms ease-out, background-color 120ms ease-out;
}

button:hover,
.sample-button:hover {
  background: #fff7df;
  box-shadow: 0 8px 18px rgba(32, 35, 31, 0.12);
  transform: translateY(-1px);
}

.primary {
  background: var(--work);
  color: white;
}

.topbar {
  min-height: 64px;
  border-bottom: 1px solid rgba(47, 52, 47, 0.2);
  background: rgba(242, 240, 232, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand span {
  width: 34px;
  height: 34px;
  border-radius: 5px;
  background: var(--stamp);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

nav a {
  text-decoration: none;
}

main {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  min-height: 440px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 26px;
  align-items: end;
  padding: 54px 0 22px;
}

.eyebrow,
.doc-kicker {
  margin: 0 0 10px;
  color: var(--stamp);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 6vw, 76px);
  line-height: 0.99;
  letter-spacing: 0;
}

.lede {
  max-width: 860px;
  color: #4d514b;
  font-size: 18px;
  line-height: 1.58;
}

.dispatch-strip,
.demand-note,
.paper-form,
.output-panel {
  border: 1px solid var(--line);
  background: rgba(255, 253, 245, 0.96);
  box-shadow: var(--shadow);
}

.dispatch-strip {
  border-radius: 7px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.dispatch-strip div {
  min-height: 104px;
  background: var(--sheet);
  padding: 16px;
}

.dispatch-strip span,
.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dispatch-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.05;
}

.demand-note {
  border-left: 7px solid var(--marker);
  border-radius: 7px;
  padding: 16px 18px;
  margin-bottom: 22px;
}

.demand-note p {
  margin: 0;
  color: #3f443e;
  line-height: 1.55;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  gap: 22px;
  align-items: start;
  padding-bottom: 54px;
}

.paper-form,
.output-panel {
  border-radius: 7px;
}

.paper-form {
  padding: 20px;
}

fieldset {
  border: 0;
  border-top: 2px solid var(--work);
  margin: 0 0 24px;
  padding: 14px 0 0;
}

legend {
  padding-right: 10px;
  color: var(--work);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bdb6a7;
  border-radius: 4px;
  background: var(--field);
  color: var(--ink);
  padding: 11px 12px;
  font: inherit;
  font-size: 15px;
  letter-spacing: 0;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(231, 185, 77, 0.38);
  border-color: var(--work);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-help {
  margin-bottom: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.defect-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.defect-row {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #faf7ea;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  color: var(--ink);
  font-weight: 750;
}

.defect-row input {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--stamp);
}

.defect-row span {
  min-width: 0;
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}

.status-message {
  min-height: 22px;
  margin: 14px 0;
  color: var(--green);
  font-weight: 800;
}

.instrumentation {
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

.instrumentation h2 {
  margin-bottom: 8px;
  font-size: 16px;
}

code {
  border: 1px solid rgba(47, 52, 47, 0.16);
  border-radius: 4px;
  background: #efead9;
  padding: 2px 5px;
  color: #3b3a35;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
}

.output-panel {
  position: sticky;
  top: 84px;
  padding: 18px;
}

.panel-label {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.dvir-document {
  border: 1px solid #9e988e;
  background: white;
  color: #151712;
  padding: 22px;
  box-shadow: 0 8px 20px rgba(32, 35, 31, 0.08);
}

.document-head {
  border-bottom: 3px double #282b27;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
}

.document-head h2 {
  margin-bottom: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
}

.document-head strong {
  min-width: 96px;
  height: 50px;
  border: 2px solid var(--stamp);
  color: var(--stamp);
  display: grid;
  place-items: center;
  padding: 0 12px;
  transform: rotate(0.8deg);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-left: 1px solid #c7c1b2;
  border-top: 1px solid #c7c1b2;
  margin: 18px 0;
}

.summary-grid div {
  min-height: 72px;
  border-right: 1px solid #c7c1b2;
  border-bottom: 1px solid #c7c1b2;
  padding: 10px;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.report-block,
.certification-block {
  border-top: 1px solid #c7c1b2;
  padding-top: 14px;
  margin-top: 16px;
}

.report-block h3,
.certification-block h3 {
  margin-bottom: 8px;
  font-size: 17px;
  text-transform: uppercase;
}

.report-block p,
.certification-block p,
.report-block li {
  line-height: 1.5;
}

.report-block ul {
  margin: 0;
  padding-left: 22px;
}

@media (max-width: 980px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .output-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  nav {
    justify-content: flex-start;
  }

  main {
    width: min(100% - 20px, 1220px);
  }

  .hero {
    padding-top: 32px;
  }

  .field-grid,
  .defect-list,
  .actions,
  .summary-grid,
  .dispatch-strip {
    grid-template-columns: 1fr;
  }

  .paper-form,
  .output-panel,
  .dvir-document {
    padding: 14px;
  }

  .document-head {
    display: grid;
  }

  .document-head h2 {
    font-size: 24px;
  }

  button {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .hero,
  .demand-note,
  .paper-form,
  .panel-label {
    display: none;
  }

  main,
  .workspace {
    width: 100%;
    display: block;
  }

  .output-panel,
  .dvir-document {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}
