:root {
  --ink: #111;
  --paper: #fff;
  --desk: #e8e8e2;
  --accent: #164f7a;
  --rule: #252525;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--desk);
  color: var(--ink);
  font-family: "Times New Roman", Times, serif;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 12px;
  background: #f8f8f6;
  border-bottom: 1px solid #c8c8c0;
}

button,
.button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #9da8ad;
  border-radius: 6px;
  background: #fff;
  color: #10212c;
  font: 600 14px/36px Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
}

#addRowBtn,
#printBtn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button:focus-visible,
.button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #2274a5;
  outline-offset: 2px;
}

.page {
  width: min(100%, 900px);
  margin: 24px auto;
  padding: 0 14px;
}

form {
  width: 100%;
  max-width: 760px;
  min-height: 1180px;
  margin: 0 auto;
  padding: 48px 72px 68px;
  background: var(--paper);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.18);
  font-size: 16px;
  line-height: 1.25;
}

h1 {
  margin: 0 0 34px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

p {
  margin: 0 0 11px;
}

.center {
  text-align: center;
}

.right {
  text-align: right;
}

.versus {
  margin: 8px 0 12px;
  text-align: center;
}

.line {
  display: inline-block;
  width: var(--line-width, var(--min-line-width, 80px));
  min-width: var(--min-line-width, 80px);
  max-width: calc(100% - 10px);
  height: 22px;
  margin: 0 2px;
  padding: 0 4px 1px;
  border: 0;
  border-bottom: 2px dotted var(--rule);
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1;
  vertical-align: baseline;
}

.suit-no {
  --min-line-width: 58px;
}

.year-short {
  --min-line-width: 28px;
}

.party-line {
  --min-line-width: 500px;
}

.hearing-date {
  --min-line-width: 142px;
}

.filed-by {
  --min-line-width: 126px;
}

.date-day {
  --min-line-width: 46px;
}

.date-month {
  --min-line-width: 48px;
}

.filed-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 26px;
  margin-bottom: 12px;
}

.table-wrap {
  margin: 10px 0 28px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 15px;
}

th,
td {
  border: 1px solid var(--rule);
  vertical-align: top;
}

th {
  padding: 7px 5px;
  text-align: left;
  font-weight: 400;
}

.column-numbers th {
  padding: 3px 5px;
  text-align: center;
}

th:nth-child(1),
td:nth-child(1) {
  width: 42px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 118px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 116px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 116px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 140px;
}

th:nth-child(6),
td:nth-child(6) {
  width: 80px;
}

textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  resize: vertical;
  overflow: hidden;
  padding: 5px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 15px/1.2 "Times New Roman", Times, serif;
}

.row-actions {
  width: 74px;
  text-align: center;
}

.delete-row {
  min-height: 28px;
  margin: 8px 4px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 26px;
}

.signature {
  margin-top: 58px;
  text-align: right;
}

@media (max-width: 760px) {
  .page {
    margin: 12px auto;
    padding: 0 8px;
  }

  form {
    padding: 34px 18px 48px;
    font-size: 16px;
  }

  .filed-row {
    flex-wrap: wrap;
  }

  table {
    min-width: 720px;
  }
}

@media print {
  @page {
    size: legal;
    margin: 12mm;
  }

  body {
    background: #fff;
  }

  .toolbar,
  .row-actions {
    display: none;
  }

  .page {
    width: auto;
    margin: 0;
    padding: 0;
  }

  form {
    width: auto;
    max-width: none;
    min-height: auto;
    margin: 0;
    padding: 0;
    box-shadow: none;
    font-size: 12.8pt;
  }

  table {
    font-size: 9.8pt;
  }

  th {
    padding: 4px;
  }

  textarea {
    min-height: 34px;
    padding: 3px;
    font-size: 9.8pt;
    resize: none;
  }

  .line {
    border-bottom-color: #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
