/* ===== 発注書・注文請書メーカー 画面用スタイル ===== */
.hts-privacy-note {
  background-color: var(--accent-bg, #eef6ff);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 auto 20px;
  max-width: 1080px;
  font-size: 0.95rem;
  color: #333;
  text-align: center;
}

.hts-layout {
  display: flex;
  gap: 28px;
  max-width: 1080px;
  margin: 24px auto 40px;
  padding: 0 4px;
  align-items: flex-start;
}

/* --- フォーム --- */
.hts-form {
  width: 400px;
  flex-shrink: 0;
  text-align: left;
}

/* 発注書／注文請書の切替タブ */
.hts-mode-tabs {
  display: flex;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.hts-mode-tab {
  flex: 1;
  padding: 12px 6px;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
  color: #555;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.hts-mode-tab + .hts-mode-tab {
  border-left: 1px solid #ccc;
}

.hts-mode-tab.active {
  background: var(--accent);
  color: #fff;
}

.hts-form .fs-title {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  margin: 20px 0 8px;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--accent, #2a9d8f);
}

.hts-form label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #555;
  margin: 10px 0 4px;
}

.hts-form input[type="text"],
.hts-form input[type="date"],
.hts-form input[type="number"],
.hts-form input[type="email"],
.hts-form select,
.hts-form textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  color: #333;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
}

.hts-form textarea {
  resize: vertical;
  line-height: 1.6;
}

.hts-form .fg-row {
  display: flex;
  gap: 8px;
}

.hts-form .fg-row > div {
  flex: 1;
  min-width: 0;
}

.hts-form .field-hint {
  font-size: 11.5px;
  color: #888;
  margin: 4px 0 0;
  line-height: 1.5;
}

.hts-form .field-hint a {
  color: var(--accent, #2a9d8f);
}

.hts-form .check-line {
  margin: 10px 0 4px;
}

.hts-form .check-line label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin: 0;
  cursor: pointer;
}

.hts-form .check-line input[type="checkbox"] {
  width: auto;
}

/* 注文請書モードのみ表示するセクション */
.hts-form.mode-hatchu .hts-inshi-only {
  display: none;
}

.hts-inshi-note {
  font-size: 11.5px;
  color: #888;
  margin: 6px 0 0;
  line-height: 1.6;
}

/* 明細リスト */
.hts-item-head {
  display: flex;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #777;
  margin-bottom: 3px;
  padding-right: 36px;
}

.hts-item-head .h-name { flex: 1; }
.hts-item-head .h-qty { width: 52px; flex-shrink: 0; }
.hts-item-head .h-price { width: 78px; flex-shrink: 0; }
.hts-item-head .h-rate { width: 62px; flex-shrink: 0; }

.hts-item-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.hts-item-row .item-name {
  flex: 1;
  min-width: 0;
}

.hts-item-row .item-qty {
  width: 52px !important;
  flex-shrink: 0;
  text-align: right;
  padding: 8px 6px !important;
}

.hts-item-row .item-price {
  width: 78px !important;
  flex-shrink: 0;
  text-align: right;
  padding: 8px 6px !important;
}

.hts-item-row .item-rate {
  width: 62px !important;
  flex-shrink: 0;
  padding: 8px 4px !important;
}

.hts-item-row .item-del {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #999;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.hts-item-row .item-del:hover {
  color: #c0392b;
  border-color: #c0392b;
}

.hts-item-add {
  width: 100%;
  padding: 8px;
  border: 1px dashed #aaa;
  border-radius: 6px;
  background: #fafafa;
  color: #555;
  font-size: 13px;
  cursor: pointer;
  margin-top: 2px;
}

.hts-item-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hts-calc-note {
  font-size: 12.5px;
  color: #333;
  background: #f6f8f7;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
  line-height: 1.6;
}

/* 印影 */
.hts-stamp-controls input[type="file"] {
  font-size: 12.5px;
  color: #555;
  border: none;
  padding: 4px 0;
}

.hts-stamp-controls input[type="range"] {
  width: 100%;
}

.hts-stamp-clear {
  padding: 5px 12px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #555;
  cursor: pointer;
  margin-top: 4px;
}

/* --- プレビュー側 --- */
.hts-preview {
  flex: 1;
  min-width: 0;
  position: sticky;
  top: 16px;
  align-self: flex-start;
  text-align: center;
}

.hts-print-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.hts-print-btn:hover {
  opacity: 0.85;
}

.hts-print-note {
  font-size: 12px;
  color: #888;
  margin: 8px 0 12px;
  line-height: 1.5;
}

.hts-sheet-wrap {
  overflow: hidden;
  border-radius: 4px;
}

.hts-preview-caption {
  font-size: 12px;
  color: #888;
  margin-top: 8px;
}

/* 書類フロー図 */
.hts-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  margin: 14px 0;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.92rem;
  line-height: 1.6;
}

.hts-flow .flow-step {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
}

.hts-flow a.flow-step:hover {
  border-color: var(--accent, #2a9d8f);
  color: var(--accent, #2a9d8f);
}

.hts-flow .flow-step.current {
  background: var(--accent, #2a9d8f);
  border-color: var(--accent, #2a9d8f);
  color: #fff;
  font-weight: 600;
}

.hts-flow .flow-arrow {
  color: #94a3b8;
  flex-shrink: 0;
}

/* ===== A4シート（プレビュー兼 印刷対象） ===== */
.hts-sheet {
  position: relative;
  width: 210mm;
  height: 297mm;
  background: #fff;
  padding: 15mm 18mm;
  box-sizing: border-box;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "MS PMincho", serif;
  font-size: 10pt;
  color: #000;
  line-height: 1.7;
  text-align: left;
  transform-origin: top left;
  overflow: hidden;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
}

/* common.cssのレガシーグローバル（* { font-size:14px; color:#313838 }）対策 */
.hts-sheet * {
  font-size: inherit;
  color: #000;
  font-family: inherit;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- 発注書・注文請書レイアウト --- */
.od-title {
  text-align: center;
  font-size: 18pt;
  letter-spacing: 0.5em;
  margin-bottom: 3mm;
}

.od-meta {
  text-align: right;
  font-size: 9.5pt;
  line-height: 1.6;
}

.od-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 3mm;
  gap: 8mm;
}

.od-to {
  max-width: 92mm;
  padding-top: 2mm;
}

.od-to-co {
  font-size: 12.5pt;
  border-bottom: 0.3mm solid #000;
  padding-bottom: 0.5mm;
  display: inline-block;
  min-width: 60mm;
}

.od-to-name {
  font-size: 11pt;
  margin-top: 1mm;
}

.od-lead {
  margin-top: 3mm;
  font-size: 10pt;
}

.od-from {
  position: relative;
  font-size: 9pt;
  line-height: 1.65;
  max-width: 76mm;
  padding-right: 12mm;
}

.od-from-co {
  font-size: 10.5pt;
}

.hts-stamp {
  position: absolute;
  right: -2mm;
  top: 2mm;
  opacity: 0.92;
  mix-blend-mode: multiply;
}

/* 収入印紙の貼付欄（注文請書モード） */
.od-inshi {
  width: 24mm;
  height: 28mm;
  border: 0.3mm dashed #555;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 8.5pt;
  line-height: 1.6;
  margin-top: 3mm;
}

.od-inshi .in-sub {
  font-size: 7pt;
  color: #333;
}

.od-total-box {
  display: flex;
  align-items: stretch;
  border: 0.5mm solid #000;
  margin-top: 5mm;
  width: 110mm;
}

.od-total-box .tb-label {
  background: #efefef;
  font-size: 10.5pt;
  padding: 2mm 4mm;
  display: flex;
  align-items: center;
  white-space: nowrap;
  border-right: 0.3mm solid #000;
}

.od-total-box .tb-value {
  flex: 1;
  font-size: 16pt;
  font-weight: 600;
  padding: 1.5mm 4mm;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 2mm;
}

.od-total-box .tb-tax {
  font-size: 9pt;
  font-weight: normal;
}

.od-items {
  width: 100%;
  border-collapse: collapse;
  margin-top: 5mm;
  table-layout: fixed;
}

.od-items th {
  background: #efefef;
  border: 0.3mm solid #000;
  font-size: 9.5pt;
  font-weight: 600;
  padding: 1.6mm 2mm;
  text-align: center;
}

.od-items td {
  border: 0.3mm solid #000;
  font-size: 9.5pt;
  padding: 1.6mm 2.5mm;
  height: 7.2mm;
  overflow: hidden;
  white-space: nowrap;
}

.od-items .c-qty { width: 16mm; text-align: right; }
.od-items .c-price { width: 27mm; text-align: right; }
.od-items .c-rate { width: 15mm; text-align: center; }
.od-items .c-amount { width: 30mm; text-align: right; }

.od-krate-note {
  font-size: 8.5pt;
  margin-top: 1mm;
}

.od-below {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8mm;
  margin-top: 4mm;
}

.od-cond {
  flex: 1;
  max-width: 84mm;
}

.od-cond-box {
  border: 0.3mm solid #000;
  padding: 2mm 3mm;
  font-size: 9.5pt;
  line-height: 1.7;
}

.od-cond-box .cd-label {
  font-size: 8.5pt;
  font-weight: 600;
}

.od-cond-box .cd-key {
  display: inline-block;
  min-width: 18mm;
}

.od-sum {
  width: 78mm;
  border-collapse: collapse;
  flex-shrink: 0;
}

.od-sum td {
  border: 0.3mm solid #000;
  font-size: 9.5pt;
  padding: 1.6mm 3mm;
}

.od-sum .s-label {
  background: #efefef;
  width: 40mm;
}

.od-sum .s-value {
  text-align: right;
}

.od-sum .s-total td {
  font-size: 11.5pt;
  font-weight: 600;
  padding: 2mm 3mm;
}

.od-remarks {
  margin-top: 5mm;
  font-size: 9.5pt;
  line-height: 1.7;
}

.od-remarks .rm-label {
  font-size: 8.5pt;
  font-weight: 600;
}

.od-remarks-box {
  border: 0.3mm solid #000;
  padding: 2mm 3mm;
  min-height: 14mm;
}

/* ===== レスポンシブ ===== */
@media (max-width: 940px) {
  .hts-layout {
    flex-direction: column;
  }

  .hts-form {
    width: 100%;
  }

  .hts-preview {
    position: static;
    width: 100%;
  }
}

/* ===== 印刷用：プレビューのシートだけをA4いっぱいに ===== */
@media print {
  @page {
    size: A4;
    margin: 0;
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    height: auto !important;
  }

  body > *:not(.container) {
    display: none !important;
  }

  .container {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: auto !important;
  }

  .container > *:not(.hts-layout) {
    display: none !important;
  }

  .hts-layout {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  .hts-layout > *:not(.hts-preview) {
    display: none !important;
  }

  .hts-preview {
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
  }

  .hts-preview > *:not(.hts-sheet-wrap) {
    display: none !important;
  }

  .hts-sheet-wrap {
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    border-radius: 0 !important;
  }

  .hts-sheet {
    transform: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    width: 210mm !important;
    height: 296mm !important;
    overflow: hidden !important;
  }
}
