article.tool {
  max-width: 1040px;
}
.tool-copy {
  max-width: 760px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin: 20px 0;
  padding: 14px 18px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 18px;
  font-size: 14px;
}
.toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.toolbar select {
  font: inherit;
  font-weight: 400;
  padding: 6px 8px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  max-width: 100%;
}
.toolbar .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}
.toolbar-group {
  display: contents;
}
.toolbar-group[hidden] {
  display: none;
}
button.btn {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn-quiet {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  padding: 10px 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.privacy-note {
  color: var(--muted);
  font-size: 13px;
  margin: -8px 0 20px;
}

.sheet {
  background: #fff;
  color: #000;
  border: 2px solid var(--line);
  border-radius: 6px;
  box-shadow: 6px 6px 0 var(--line);
  padding: 32px 36px;
  margin: 0 0 32px;
  font-size: 14px;
  line-height: 1.45;
}
.sheet input,
.sheet textarea,
.sheet select {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed #b9b2c6;
  border-radius: 0;
  padding: 2px 0;
  width: 100%;
  min-width: 0;
}
.sheet textarea {
  resize: none;
  overflow: hidden;
  display: block;
}
.sheet select {
  width: auto;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.sheet input:focus,
.sheet textarea:focus,
.sheet select:focus {
  outline: 2px solid var(--sun);
  outline-offset: 1px;
}
.sheet-head {
  text-align: center;
  display: grid;
  gap: 2px;
  padding-bottom: 12px;
  border-bottom: 2px solid #000;
}
.sheet-head input,
.sheet-head textarea {
  text-align: center;
}
.sheet-head .shop-name {
  font-size: 22px;
  font-weight: 800;
}
.sheet-title {
  text-align: center;
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 14px 0 12px;
}
.sheet-title input {
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.sheet table {
  margin: 0;
  font-size: 13px;
}
.sheet th,
.sheet td {
  border: 1px solid #000;
  padding: 6px 8px;
  vertical-align: middle;
}
.sheet th {
  background: #f4f1ea;
}
.sheet .num {
  width: 34px;
  text-align: center;
}
.sheet .amount,
.sheet .amount input {
  text-align: right;
}
.sheet-foot {
  margin: 18px 0 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
  color: #555;
}
.signature {
  min-width: 180px;
  padding-top: 26px;
  border-top: 1px solid #000;
  text-align: center;
  color: #000;
}

.fill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0 0 14px;
}
.fill-grid .wide {
  grid-column: span 2;
}
.fill {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  font-weight: 600;
}
.fill::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #000;
  min-width: 40px;
}
.measure td {
  height: 32px;
}
.measure .hi {
  color: #555;
  font-weight: 400;
}
.measure .value {
  width: 18%;
}
.measure .notes {
  width: 34%;
}
.form-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.form-columns h3 {
  margin: 0 0 6px;
  font-size: 14px;
}
.form-columns .measure td {
  height: 28px;
}
.ticks {
  display: grid;
  gap: 6px;
  margin: 14px 0 0;
  font-size: 13px;
}
.ticks p {
  margin: 0;
}
.ticks b {
  display: inline-block;
  min-width: 92px;
}
.form-columns .ticks b {
  display: block;
}
.tick {
  margin-right: 14px;
  white-space: nowrap;
}
.tick::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 1px solid #000;
  margin-right: 5px;
  vertical-align: -1px;
}
.sketches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 14px 0 0;
}
.sketch {
  border: 1px solid #000;
  height: 130px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
}
.lined {
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 600;
}
.lined span {
  display: block;
  height: 26px;
  border-bottom: 1px solid #000;
}

.bill-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 24px;
  margin: 0 0 14px;
}
.bill-meta label {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  white-space: nowrap;
  align-items: baseline;
  gap: 8px;
  font-weight: 600;
}
.bill-meta input {
  font-weight: 400;
}
.bill-items .qty {
  width: 56px;
}
.bill-items .rate {
  width: 96px;
}
.bill-items .sac {
  width: 84px;
}
.bill-items .gst {
  width: 64px;
}
.bill-items td.amount {
  width: 104px;
  white-space: nowrap;
}
.bill-items td.qty input {
  text-align: center;
}
.row-tools {
  width: 36px;
  text-align: center;
}
.sheet th.row-tools,
.sheet td.row-tools {
  border: 0;
  background: transparent;
}
.row-remove {
  font: inherit;
  font-size: 18px;
  line-height: 1;
  width: 28px;
  height: 28px;
  border: 1px solid #b9b2c6;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  color: var(--muted);
}
.add-row {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  margin: 8px 0 0;
  padding: 6px 14px;
  border: 2px dashed var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.bill-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 24px;
  margin: 16px 0 0;
  align-items: start;
}
.bill-bottom h3 {
  font-size: 12px;
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.bill-bottom h3:not(:first-child) {
  margin-top: 14px;
}
.bill-totals th {
  white-space: nowrap;
  font-weight: 600;
  background: transparent;
}
.bill-totals td {
  text-align: right;
  white-space: nowrap;
}
.bill-totals input {
  text-align: right;
  width: 72px;
}
.bill-totals .grand th,
.bill-totals .grand td {
  font-weight: 800;
  font-size: 15px;
  background: #f4f1ea;
}
.bill-totals select {
  font-size: 12px;
  color: #555;
  margin-right: 6px;
}
.declaration {
  margin: 14px 0 0;
  font-weight: 700;
  font-size: 13px;
}

.rate-section {
  margin: 0 0 14px;
}
.rate-section h3 {
  margin: 0 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.rate-table .price {
  width: 120px;
  white-space: nowrap;
}
.rate-table .price input {
  width: calc(100% - 14px);
}
.rate-table .item {
  width: 38%;
}
.rate-table td {
  padding: 4px 8px;
}

.print-copy {
  display: none;
  white-space: pre-wrap;
}
[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .sheet {
    padding: 20px 14px;
    box-shadow: 4px 4px 0 var(--line);
  }
  .fill-grid,
  .bill-meta,
  .form-columns,
  .bill-bottom {
    grid-template-columns: minmax(0, 1fr);
  }
  .fill-grid .wide {
    grid-column: auto;
  }
  .bill-meta label {
    grid-template-columns: 110px minmax(0, 1fr);
  }
  .toolbar label {
    display: grid;
    width: 100%;
  }
  .toolbar label:has(input[type="checkbox"]) {
    display: inline-flex;
    width: auto;
  }
  .toolbar select {
    width: 100%;
  }
  .bill-items .sac,
  .bill-items .num {
    display: none;
  }
  .bill-items .qty {
    width: 40px;
  }
  .bill-items .rate {
    width: 64px;
  }
  .bill-items td.amount {
    width: 72px;
  }
  .row-tools {
    width: 30px;
  }
  .sheet th,
  .sheet td {
    padding: 5px 4px;
  }
  .toolbar .actions {
    margin-left: 0;
  }
  .rate-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 104px 34px;
    border-bottom: 1px solid #000;
    padding: 4px 0;
  }
  .rate-table td {
    border: 0;
    width: auto;
  }
  .rate-table td.item,
  .rate-table td.price {
    width: auto;
    font-weight: 600;
  }
  .rate-table td:nth-child(3) {
    grid-column: 1 / 3;
    grid-row: 2;
    font-size: 12px;
  }
  .rate-table td.row-tools {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
  }
}

@media print {
  @page {
    margin: 12mm;
  }
  body {
    background: #fff;
  }
  .nav,
  footer,
  .no-print,
  .row-tools,
  .add-row {
    display: none !important;
  }
  article.tool {
    width: 100%;
    max-width: none;
    padding: 0;
  }
  .sheet {
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
  .sheet input,
  .sheet textarea,
  .sheet select {
    border-bottom: 0;
  }
  .sheet ::placeholder {
    color: transparent;
  }
  .bill-items .is-empty {
    display: none;
  }
  .sheet textarea {
    display: none;
  }
  .print-copy {
    display: block;
  }
  .measure td {
    height: 25px;
    padding-top: 3px;
    padding-bottom: 3px;
  }
  .form-columns .measure td {
    height: 24px;
  }
  .sketch {
    height: 96px;
  }
  .ticks {
    gap: 3px;
  }
  .fill-grid,
  .bill-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .bill-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-columns,
  .sketches {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bill-bottom {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .sheet {
    font-size: 13px;
  }
  .sheet-head .shop-name {
    font-size: 20px;
  }
  .rate-table td {
    padding: 1px 8px;
  }
  .rate-table .price {
    width: 90px;
  }
  .rate-section {
    margin-bottom: 10px;
  }
  .bill-items .sac,
  .bill-items .num {
    display: table-cell;
  }
  .bill-items .sac[hidden] {
    display: none !important;
  }
}
