:root {
  --invoice-page-width: 794px;
  --invoice-page-height: 1123px;
  --invoice-left: 66px;
  --invoice-content-width: 662px;
  --invoice-emphasis-font: "Inter", "Noto Sans SC", Arial, Helvetica, sans-serif;
  --invoice-label-font: "Inter", "Noto Sans SC", Arial, Helvetica, sans-serif;
  --invoice-body-font: "Noto Sans SC", "Inter", Arial, Helvetica, sans-serif;
  --invoice-font: var(--invoice-body-font);
  --invoice-title-left: 0px;
  --invoice-title-top: 27px;
  --tomato-logo-left: 527px;
  --tomato-logo-top: 0px;
  --company-block-left: 66px;
  --company-block-top: 123px;
  --date-grid-left: 460px;
  --date-grid-top: 171px;
  --bill-to-left: 66px;
  --bill-to-top: 263px;
  --line-items-left: 66px;
  --line-items-top: 356px;
}

.invoice-paper {
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: 0 2px 16px rgb(0 0 0 / 14%);
  color: #000;
  font-family: var(--invoice-font);
  font-size: 14px;
  font-weight: 400;
  height: var(--invoice-page-height);
  line-height: 1.35;
  margin: 16px auto 0;
  overflow: visible;
  padding: 0;
  position: relative;
  width: var(--invoice-page-width);
}

.invoice-paper * {
  letter-spacing: 0;
}

.invoice-paper input,
.invoice-paper textarea {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #000;
  font-family: var(--invoice-font);
  min-height: 0;
  outline: 0;
  padding: 0;
  resize: none;
}

.invoice-paper input:focus,
.invoice-paper textarea:focus {
  border: 0;
  box-shadow: inset 0 -1px 0 rgb(22 119 255 / 65%);
}

.invoice-paper input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
}

.invoice-head,
.invoice-meta {
  display: block;
  margin: 0;
  min-height: 0;
}

.invoice-title {
  position: static;
  text-align: left;
}

.invoice-title h2 {
  font-family: var(--invoice-emphasis-font);
  font-size: 26px;
  font-weight: 600;
  left: var(--invoice-title-left);
  line-height: 1;
  margin: 0;
  position: absolute;
  text-align: center;
  top: var(--invoice-title-top);
  width: var(--invoice-page-width);
}

.invoice-title img {
  height: auto;
  left: var(--tomato-logo-left);
  margin: 0;
  position: absolute;
  top: var(--tomato-logo-top);
  width: 200px;
}

.company-block {
  font: 400 14px/1.35 var(--invoice-body-font);
  height: 96px;
  left: var(--company-block-left);
  min-height: 0;
  position: absolute;
  top: var(--company-block-top);
  width: 440px;
}

.company-block p {
  font-size: 16px;
  font-family: var(--invoice-emphasis-font);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  position: absolute;
  top: 0;
  white-space: nowrap;
}

.company-block textarea,
.company-address-output {
  font: 400 14px/1.35 var(--invoice-body-font);
  height: 42px;
  left: 0;
  overflow: hidden;
  position: absolute;
  top: 22px;
  white-space: pre;
  width: 440px;
}

.company-block .stamp {
  height: auto;
  left: 0;
  object-fit: contain;
  opacity: 0.85;
  pointer-events: none;
  position: absolute;
  top: -42px;
  touch-action: none;
  width: 150px;
  z-index: 2;
}

.invoice-paper.stamp-editing {
  box-shadow:
    0 2px 16px rgb(0 0 0 / 14%),
    0 0 0 2px rgb(22 119 255 / 20%);
}

.invoice-paper.stamp-editing .company-block .stamp {
  cursor: grab;
  outline: 1px dashed var(--primary, #1677ff);
  outline-offset: 3px;
  pointer-events: auto;
}

.invoice-paper.stamp-editing .company-block .stamp.is-dragging {
  cursor: grabbing;
  opacity: 0.95;
}

.date-grid {
  display: grid;
  font: 400 14px/1.2 var(--invoice-body-font);
  gap: 8px 0;
  grid-template-columns: 112px minmax(0, 1fr);
  left: var(--date-grid-left);
  margin: 0;
  position: absolute;
  top: var(--date-grid-top);
  width: 270px;
}

.date-grid label {
  display: contents;
}

.date-grid label > span,
.date-grid input,
.date-field,
.date-grid .pdf-field {
  height: 17px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.date-grid label > span {
  font: 500 14px/1.2 var(--invoice-label-font);
}

.date-grid input,
.date-grid .pdf-field {
  font: 600 14px/1.2 var(--invoice-emphasis-font);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

.date-field {
  position: relative;
  width: 100%;
}

.date-field input:not(.date-picker-native) {
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
}

.date-field input:not(.date-picker-native):hover,
.date-field input:not(.date-picker-native):focus {
  background: #f8fbff;
  box-shadow: inset 0 0 0 1px #91caff;
}

.date-picker-native {
  height: 100%;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  width: 100%;
}

.bill-to {
  font: 400 14px/1.35 var(--invoice-body-font);
  left: var(--bill-to-left);
  position: absolute;
  top: var(--bill-to-top);
  width: 500px;
}

.bill-to span {
  font-family: var(--invoice-label-font);
  font-size: 15px;
  font-weight: 600;
  display: block;
  margin: 0;
}

.bill-to input,
.bill-to .pdf-field {
  display: block;
  font: 600 15px/1.35 var(--invoice-emphasis-font);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  height: 22px;
  margin-top: 10px;
  overflow: hidden;
  white-space: nowrap;
  width: 500px;
}

.bill-to textarea {
  display: block;
}

.bill-to textarea,
.customer-address-output {
  font: 400 13px/1.35 var(--invoice-body-font);
  height: 20px;
  margin-top: 2px;
  overflow: hidden;
  white-space: nowrap;
  width: 500px;
}

.line-items {
  left: var(--line-items-left);
  margin: 0;
  position: absolute;
  top: var(--line-items-top);
  width: var(--invoice-content-width);
}

.table-head,
.item-row,
.table-total {
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1fr) 170px;
}

.table-head {
  border-bottom: 2px solid #000;
  font: 500 15px/24px var(--invoice-label-font);
  padding: 0 8px 8px 0;
}

.table-head span:first-child {
  font-weight: 600;
}

.table-head span:last-child {
  grid-column: auto;
  text-align: right;
}

.rows {
  display: block;
}

.item-row {
  border-bottom: 1px solid #bfbfbf;
  font: 400 15px/22px var(--invoice-body-font);
  align-items: stretch;
  min-height: 32px;
  padding: 0 8px 0 18px;
  position: relative;
}

.rows .item-row:last-child {
  border-bottom: 0;
}

.item-row input,
.item-row textarea,
.item-row span {
  font: 400 15px/22px var(--invoice-body-font);
  min-width: 0;
}

.item-row textarea {
  display: block;
  height: 32px;
  min-height: 32px;
  overflow: hidden;
  padding: 5px 0;
  resize: none;
  white-space: pre-wrap;
  width: 100%;
}

.item-row textarea:first-child {
  font-family: var(--invoice-body-font);
  font-weight: 400;
  padding-left: 0;
}

.item-description {
  display: block;
  min-height: 32px;
  overflow: visible;
  padding-bottom: 5px;
  padding-left: 0;
  padding-top: 5px;
  white-space: pre-wrap;
}

.item-row input.amount,
.item-amount {
  align-self: center;
  font-family: var(--invoice-emphasis-font);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  height: auto;
  line-height: 20px;
  min-height: 20px;
  overflow: hidden;
  text-align: right;
  white-space: nowrap;
}

.item-row input.amount.is-negative,
.item-amount.is-negative,
.table-total strong.is-negative {
  color: #d92d20;
}

.icon-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--danger, #ff4d4f);
  display: inline-flex;
  font-size: 18px;
  height: 26px;
  justify-content: center;
  line-height: 1;
  min-height: 0;
  padding: 0;
  position: absolute;
  right: -32px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
}

.icon-button:hover {
  background: transparent;
  color: #ff7875;
}

.line-add {
  align-items: center;
  background: #fff;
  border: 1px solid #91caff;
  border-radius: 6px;
  color: var(--primary, #1677ff);
  display: inline-flex;
  font-size: 20px;
  height: 28px;
  justify-content: center;
  margin: 0;
  min-height: 0;
  padding: 0;
  position: absolute;
  right: -34px;
  top: var(--line-add-top, 70px);
  width: 28px;
}

.line-add:hover {
  background: #f8fbff;
  border-color: var(--primary-hover, #4096ff);
}

.table-total {
  border-top: 2px solid #000;
  font: 600 16px/30px var(--invoice-emphasis-font);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  margin-top: 18px;
  padding: 9px 8px 0 0;
}

.table-total strong {
  font-weight: 600;
  grid-column: auto;
  text-align: right;
}

.bank-block {
  font: 400 14px/24px var(--invoice-body-font);
  margin-top: 44px;
  width: var(--invoice-content-width);
}

.bank-block dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.bank-block div {
  display: grid;
  gap: 0;
  grid-template-columns: 160px 1fr;
}

.bank-block dt,
.bank-block dd {
  color: #000;
  margin: 0;
}

.bank-block dt {
  font-family: var(--invoice-label-font);
  font-weight: 500;
}

.bank-block dd {
  font-family: var(--invoice-body-font);
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
}

.pdf-paper {
  box-shadow: none;
  margin: 0;
  overflow: hidden;
}

.pdf-paper .line-add,
.pdf-paper .icon-button {
  display: none;
}

.invoice-paper.layout-editing [data-layout-key] {
  cursor: move;
  outline: 1px dashed var(--primary, #1677ff);
  outline-offset: 4px;
}

.invoice-paper.layout-editing [data-layout-key]::after {
  background: var(--primary, #1677ff);
  border-radius: 4px;
  color: #fff;
  content: attr(data-layout-key);
  font: 11px/1 var(--invoice-label-font);
  left: 0;
  opacity: 0.88;
  padding: 3px 5px;
  pointer-events: none;
  position: absolute;
  top: -20px;
  white-space: nowrap;
}

.invoice-paper.layout-editing .is-layout-dragging {
  opacity: 0.84;
  z-index: 10;
}

.pdf-paper [data-layout-key]::after {
  display: none;
}
