/* ============================================
   請求書 源泉徴収計算ツール
   ============================================ */

/* --- 源泉徴収トグル --- */
.invoiceCalc__toggleRow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.invoiceCalc__toggleLabel {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.invoiceCalc__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 44px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 2px solid #e5e7eb;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  background-color: #fff;
  color: #6b7280;
}

.invoiceCalc__toggleKnob {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background-color: #d1d5db;
  border-radius: 50%;
  transition: all 0.2s;
}

.invoiceCalc__toggle_state_on {
  border-color: #059669;
  background-color: #ecfdf5;
  color: #059669;
}

.invoiceCalc__toggle_state_on .invoiceCalc__toggleKnob {
  background-color: #059669;
}

.invoiceCalc__toggle_state_off {
  border-color: #e5e7eb;
  background-color: #fff;
  color: #9ca3af;
}

.invoiceCalc__toggle_state_off .invoiceCalc__toggleKnob {
  background-color: #d1d5db;
}

/* --- 明細テーブル --- */
.invoiceCalc__tableWrap {
  overflow-x: auto;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.invoiceCalc__table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.invoiceCalc__th {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b7280;
  padding: 8px 6px;
  text-align: left;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}

.invoiceCalc__th_col_desc {
  width: 35%;
}

.invoiceCalc__th_col_price {
  width: 22%;
}

.invoiceCalc__th_col_qty {
  width: 10%;
}

.invoiceCalc__th_col_tax {
  width: 12%;
}

.invoiceCalc__th_col_subtotal {
  width: 16%;
  text-align: right;
}

.invoiceCalc__th_col_action {
  width: 5%;
}

.invoiceCalc__row {
  animation: fadeIn 0.2s ease;
}

.invoiceCalc__td {
  padding: 8px 6px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.invoiceCalc__td_type_subtotal {
  text-align: right;
  font-weight: 600;
  color: #111827;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.invoiceCalc__input {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.9375rem;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  background-color: #fff;
  color: #111827;
  transition: border-color 0.2s;
  font-family: inherit;
}

.invoiceCalc__input:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.invoiceCalc__input_type_number {
  font-family: 'Noto Sans JP', monospace;
  font-variant-numeric: tabular-nums;
}

.invoiceCalc__input_size_sm {
  width: 70px;
}

.invoiceCalc__select {
  padding: 8px 10px;
  font-size: 0.9375rem;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  background-color: #fff;
  color: #111827;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s;
}

.invoiceCalc__select:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.invoiceCalc__removeBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background-color: #fee2e2;
  color: #dc2626;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.invoiceCalc__removeBtn:hover:not(:disabled) {
  background-color: #fecaca;
}

.invoiceCalc__removeBtn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* --- 行追加ボタン --- */
.invoiceCalc__addBtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 2px dashed #a7f3d0;
  border-radius: 8px;
  background-color: #ecfdf5;
  color: #059669;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  margin-bottom: 20px;
}

.invoiceCalc__addBtn:hover {
  border-color: #6ee7b7;
  background-color: #d1fae5;
}

/* --- アクションボタン群 --- */
.invoiceCalc__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* --- 請求書プレビュー --- */
.invoicePreview {
  background-color: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  margin-top: 24px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.invoicePreview__header {
  background-color: #065f46;
  color: #fff;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.invoicePreview__title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.3em;
}

.invoicePreview__date {
  font-size: 0.875rem;
  opacity: 0.9;
}

.invoicePreview__body {
  padding: 24px;
}

.invoicePreview__table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.invoicePreview__th {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  padding: 10px 8px;
  text-align: left;
  border-bottom: 2px solid #065f46;
}

.invoicePreview__th_align_right {
  text-align: right;
}

.invoicePreview__td {
  font-size: 0.9375rem;
  color: #111827;
  padding: 10px 8px;
  border-bottom: 1px solid #f3f4f6;
}

.invoicePreview__td_align_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.invoicePreview__summary {
  border-top: 2px solid #e5e7eb;
  padding-top: 16px;
  max-width: 320px;
  margin-left: auto;
}

.invoicePreview__summaryRow {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9375rem;
  color: #4b5563;
}

.invoicePreview__summaryRow_type_total {
  border-top: 2px solid #065f46;
  padding-top: 12px;
  margin-top: 8px;
  font-size: 1.125rem;
  font-weight: 700;
  color: #065f46;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive (Mobile) --- */
@media (max-width: 639px) {
  .invoiceCalc__tableWrap {
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .invoicePreview__header {
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  .invoicePreview__body {
    padding: 16px;
  }

  .invoicePreview__summary {
    max-width: 100%;
  }
}
