@media print {
  @page {
    size: A4 portrait;
    margin: 20mm;
  }

  body {
    zoom: 0.75;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body::after {
    position: fixed;
    bottom: 0;
    right: 0;
    font-size: 14px;
  }

  .note {
    overflow: visible;
    page-break-inside: avoid;
  }

  button {
    display: none;
  }

  table {
    page-break-inside: avoid !important;
  }

  tr {
    page-break-inside: avoid !important;
  }

  .page-break {
    page-break-after: always !important;
  }

  /* Print-specific table styling */
  .print-table {
    display: table;
  }

  .screen-table {
    display: none;
  }
}

@media screen {
  .page-break {
    display: none !important;
  }

  /* Screen-specific table styling */
  .print-table {
    display: none;
  }

  .screen-table {
    display: table;
  }
}

body {
  width: 100%;
  max-width: 1050px;
  /* A4サイズの横幅 */
  margin: 0 auto;
  padding: 20px;
  box-sizing: border-box;
  font-size: 14px;
}

header h1 {
  text-align: center;
}

.head_area {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

/* Left block */
.header_left {
  width: 60%;
  word-break: break-word;
}

.header_left .subject {
  text-align: left;
  margin-top: 10px;
}

/* Right block */
.header_right {
  width: 38%;
}

.header_right table {
  width: 100%;
  border-collapse: collapse;
}

.header_right .label {
  width:61%;
  text-align: right;
  padding: 4px;
  border: none;
  white-space: nowrap;
}

.header_right .value {
  width:39%;
  text-align: right;
  padding: 4px;
  border: none;
  word-break: break-word; /* handles long invoice number */
}

.header_right .date {
  text-align: right;
  border: none;
  padding: 0;
}

.header_right .spacer {
  height: 17px;
  border: none;
}

.header_right .company {
  text-align: right;
  border: none;
  margin-top: 10px;
  word-break: break-word;
}


.billing_title {
  text-decoration: underline;
}

.total {
  font-weight: bold;
  font-size: 130%;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 14px;
}

table caption {
  font-weight: bold;
  text-align: left;
}

table th,
table td {
  border: 1px solid #000;
  padding: 5px;
  text-align: center;
  vertical-align: middle;
}

table th {
  background-color: #f0f0f0;
  font-weight: bold;
}

.sum {
  background-color: #e0f0ff;
}

table .subtotal {
  text-align: right;
  font-weight: bold;
}

.note p {
  border: solid 1px #000;
  min-height: 55px;
  padding: 10px 10px;
  font-size: 110%;
}

.note label {
  font-weight: bold;
  font-size: 110%;
}

button {
  background-color: #3498db;
  color: white;
  border: none;
  text-decoration: none;
  padding: 5px 10px;
  margin: 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  /* 軽い影を追加 */
  font-size: 12px;
  /* ボタン内のフォントサイズを少し小さめに */
  height: 30px;
  /* ボタンの高さをテーブル行に合わせて縮小 */
  min-width: 70px;
  /* ボタンの幅を少し狭く */
  text-align: center;
}

button:hover {
  background-color: #2980b9;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* 編集ボタンのクリック時のエフェクト */
.button:active {
  background-color: #1c5980;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2);
}

.buttons {
  display: flex;
  justify-content: flex-end;
  /* ボタンを右に寄せる */
}

.invoice-header-table td {
  padding: 4px 8px;
}
