/* 見積書に添える「前提・含まない・未確定」と稟議用の説明文（/soufu-haikei-memo/）。日英共通。
   左（スマホでは上）に欄、右（下）にできあがる3つの文をタブで切り替えて出す。書くたびに文が変わる */
[hidden] { display: none !important; }
.sm { --s-line: var(--hairline, #e5e7eb); --s-soft: var(--ink-soft, #4b5563); --s-acc: var(--accent, #b45309);
  display: grid; gap: 0; border: 1px solid var(--s-line); background: var(--panel, #fff); margin-bottom: 8px; }
@media (min-width: 1100px) {
  .sm { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sm-form-wrap { border-right: 1px solid var(--s-line); }
  .sm-out { border-top: 0 !important; }
}

/* 欄 */
.sm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--s-line); background: var(--accent-wash, #fffbeb); }
.sm-bar-t { flex: 1 1 auto; font-size: 13px; font-weight: 700; color: var(--s-soft); }
.sm-mini { min-height: 36px; padding: 0 12px; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; font: inherit; font-size: 13px; color: var(--ink, #1f2937); cursor: pointer; }
.sm-mini:hover { border-color: var(--ink, #1f2937); }
.sm-form { padding: 12px 16px 16px; }
.sm-heads { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.sm-f { display: grid; gap: 3px; min-width: 0; font-size: 12px; font-weight: 700; color: var(--s-soft); }
.sm-f-wide { grid-column: 1 / -1; }
.sm-f input { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; font: inherit; font-size: 15px; font-weight: 400; color: var(--ink, #1f2937); box-sizing: border-box; }
.sm-f input:focus, .sm-list textarea:focus { outline: none; border-color: var(--ink, #1f2937); box-shadow: 0 0 0 1px var(--ink, #1f2937); }
.sm-hint { margin: 14px 0 4px; font-size: 13px; line-height: 1.6; color: var(--s-soft); }
.sm-list { display: grid; gap: 3px; margin-top: 12px; }
.sm-list label { display: flex; align-items: baseline; gap: 8px; font-size: 15px; }
.sm-list.is-key label b { color: var(--s-acc); }
.sm-c { font-family: var(--mono); font-size: 12px; color: var(--s-soft); }
.sm-list small { font-size: 12px; line-height: 1.5; color: var(--s-soft); }
.sm-list textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; font: inherit; font-size: 14px; line-height: 1.6; color: var(--ink, #1f2937); resize: vertical; }
/* 印の出た欄: 橙の枠と、ラベルの横の短い文（できあがる文の上の印と同じ内容） */
.sm-f input.is-warn, .sm-list textarea.is-warn { border-color: var(--s-acc); background: #fff7ed; }
.sm-warn { margin-left: auto; padding: 1px 6px; font-size: 11px; font-weight: 700; color: var(--s-acc); background: #fff7ed; border: 1px solid #fed7aa; }
.sm-f > span:first-child { display: flex; align-items: baseline; gap: 6px; }

/* できあがる文 */
.sm-out { padding: 14px 16px 16px; border-top: 1px solid var(--s-line); min-width: 0; }
.sm-h { margin: 0 0 8px; font-size: 16px; }
.sm-notes { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
.sm-notes li { display: flex; align-items: flex-start; gap: 8px; padding: 6px 10px; border-radius: 4px; background: #fff7ed; font-size: 13px; line-height: 1.55; }
.sm-notes li > span { flex: 1 1 auto; min-width: 0; }
.sm-goto { flex: 0 0 auto; min-height: 32px; padding: 0 10px; border: 1px solid var(--s-acc); background: #fff; font: inherit; font-size: 12px; font-weight: 700; color: var(--s-acc); cursor: pointer; white-space: nowrap; }
.sm-goto:hover { background: var(--s-acc); color: #fff; }
.sm-notes li.is-ok { background: #f0fdf4; }
.sm-tabs { display: flex; border-bottom: 1px solid var(--ink, #1f2937); }
.sm-tab { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 4px 6px; border: 1px solid var(--s-line); border-bottom: 0; margin-right: -1px; background: #f9fafb; font: inherit; color: var(--s-soft); cursor: pointer; display: grid; place-content: center; gap: 0; line-height: 1.25; transition: background-color .12s; }
.sm-tab b { font-size: 14px; }
.sm-tab small { font-size: 11px; }
.sm-tab[aria-selected="true"] { background: var(--ink, #1f2937); border-color: var(--ink, #1f2937); color: #fff; }
.sm-tab:focus-visible { outline: 2px solid var(--s-acc); outline-offset: 2px; }
.sm-panel { padding-top: 10px; }
.sm-panel-note { margin: 0 0 8px; font-size: 13px; line-height: 1.6; color: var(--s-soft); }
.sm-text { margin: 0; padding: 12px 14px; border: 1px solid var(--s-line); background: #f9fafb; font-family: inherit; font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink, #1f2937); }
.sm-text.is-md { font-family: var(--mono); font-size: 12.5px; }
.sm-text.is-flash { animation: sm-flash .5s ease-out; }
@keyframes sm-flash { from { opacity: .55; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sm-text.is-flash { animation: none; } .sm-tab { transition: none; } }
.sm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.sm-btn { min-height: 44px; padding: 0 16px; border: 1px solid var(--ink, #1f2937); background: #fff; font: inherit; font-size: 14px; font-weight: 700; color: var(--ink, #1f2937); cursor: pointer; }
.sm-btn.is-main { background: var(--ink, #1f2937); color: #fff; }
.sm-btn.is-main.is-done { background: #15803d; border-color: #15803d; }
.sm-btn:active { transform: scale(.98); }
.sm-status { font-size: 13px; font-weight: 700; color: #15803d; }
.sm-fine { margin: 10px 0 0; font-size: 12px; line-height: 1.6; color: var(--s-soft); }

/* 見出し: 語の途中で折らない（日本語は <wbr> の位置だけで折る）・行の長さをそろえる */
.sm-h1 { word-break: keep-all; overflow-wrap: break-word; text-wrap: balance; }

/* 1行が3つの文のどこに入るか: 左の1行から、右の3つの文の該当箇所へ線でつなぐ */
.sm-map { display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr); gap: 0 28px; align-items: center; margin: 14px 0 0; }
.sm-map-in { position: relative; display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--ink, #1f2937); background: #fff; }
.sm-map-in span { font-size: 12px; font-weight: 700; color: var(--accent, #b45309); }
.sm-map-in b { font-size: 16px; }
.sm-map-in::after { content: ""; position: absolute; left: 100%; top: 50%; width: 29px; border-top: 1px solid var(--ink, #1f2937); }
.sm-map-out { position: relative; margin: 0; padding-left: 14px; border-left: 1px solid var(--ink, #1f2937); display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: 10px 12px; }
.sm-map-out dt { position: relative; font-size: 13px; font-weight: 700; padding-top: 6px; }
.sm-map-out dt::before { content: ""; position: absolute; left: -14px; top: 1em; width: 10px; border-top: 1px solid var(--ink, #1f2937); }
.sm-map-out dd { margin: 0; display: grid; gap: 3px; min-width: 0; }
.sm-map-out code { display: block; padding: 6px 10px; background: #f9fafb; border: 1px solid var(--hairline, #e5e7eb); font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink, #1f2937); }
.sm-map-out dd span { font-size: 12px; color: var(--ink-soft, #4b5563); }

/* 見積の前後に使うツールの行（絵・番号・名前・このページから使う理由）は共通の .tool-nav a.tn（scripts/sync-related.mjs が作る） */
.sm-about-h { margin: 18px 0 8px; font-size: 16px; }

@media (max-width: 640px) {
  .sm-heads { grid-template-columns: 1fr; }
  .sm-form, .sm-out { padding-left: 12px; padding-right: 12px; }
  .sm-bar { padding: 8px 12px; }
  .sm-map { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sm-map-in { justify-self: start; }
  .sm-map-in::after { left: 14px; top: 100%; width: 0; height: 14px; border-top: 0; border-left: 1px solid var(--ink, #1f2937); }
  .sm-map-out { margin: 14px 0 0 14px; grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .sm-map-out dd { margin-bottom: 8px; }
}
/* 欄より上の「できあがる文の書き出し」: 文が欄の下に来る幅（1100px 未満）だけ出す。押すと結果の枠へ */
.sm-peek { display: grid; gap: 4px; margin: 0; padding: 10px 16px 12px; border-bottom: 1px solid var(--s-line); background: #f9fafb; color: var(--ink, #1f2937); text-decoration: none; }
.sm-peek-h { font-size: 12px; font-weight: 700; color: var(--s-soft); }
.sm-peek-text { margin: 0; padding: 6px 10px; border: 1px solid var(--s-line); background: #fff; font-family: inherit; font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.sm-peek b { font-size: 13px; color: var(--s-acc); }
.sm-peek:hover b { text-decoration: underline; }
@media (min-width: 1100px) { .sm-peek { display: none; } }
@media (max-width: 640px) {
  .sm-peek { padding: 8px 12px 10px; }
  .sm-bar { gap: 6px; }
  .sm-mini { padding: 0 8px; font-size: 12px; }
}

/* 右の列（カテゴリ・前後のリンク）は本文の下へ回し、欄と文の2列に幅を使う（1280px で名前が切れないように） */
.sm-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
.sm-layout .tool-aside { flex-direction: row; flex-wrap: wrap; gap: 20px 40px; padding-top: 20px; border-top: 1px solid var(--hairline, #e5e7eb); }
.sm-layout .tool-aside .aside-block { flex: 1 1 280px; min-width: 0; }

/* 印刷（PDFとして保存）: app.js が body の直下に写した今の文だけを出す */
#sm-print-sheet { display: none; }
@media print {
  @page { size: A4; margin: 18mm 20mm; }
  html.sm-printing body > :not(#sm-print-sheet) { display: none !important; }
  html.sm-printing #sm-print-sheet { display: block; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: "IBM Plex Sans JP", sans-serif; font-size: 10.5pt; line-height: 1.8; color: #000; }
}
@media (max-width: 640px) { .sm-bar-t { flex-basis: 100%; } }
