/* LOGI NET TOOL — 詳細計算画面（/detail）専用CSS。
   構成: 0.配色（チャコール×サンド）/ 1.レイアウト / 2.入力セクション / 3.入力欄・エラー・警告 / 4.自動値と手入力 /
         5.結果 / 6.レスポンシブ / 7.結果の読み取りの補助（判断・運賃の比較・原価の内訳）・入力の補助 */

/* ---- 0. 配色: style.css の旧トークン（青緑）を、この画面だけ theme.css のチャコール×サンドへ置き換える
   （2026-09-30。HTML の構造・クラス名は変えない。警告色は赤字・損失・エラーだけ。黒字は緑にせず通常の文字色） ---- */
.page-detail {
  --color-bg: var(--lnt-bg);
  --color-panel: var(--lnt-surface);
  --color-surface: var(--lnt-surface);
  --color-border: var(--lnt-border);
  --color-border-soft: var(--lnt-border);
  --color-text: var(--lnt-text);
  --color-muted: var(--lnt-muted);
  --color-teal: var(--lnt-accent);
  --color-primary: var(--lnt-primary);
  --color-primary-dark: var(--lnt-primary-hover);
  --color-primary-soft: var(--lnt-surface-sub);
  --color-accent: var(--lnt-accent);
  --color-danger: var(--lnt-alert);
  --color-profit-pos: var(--lnt-text);
  --color-profit-neg: var(--lnt-alert);
  background: var(--lnt-bg);
  color: var(--lnt-text);
  font-family: var(--lnt-font);
}

/* ---- 1. レイアウト（PCは入力と結果の2列、狭い画面は1列） ---- */
.detail-main {
  display: block;
  max-width: 1320px;
}

.detail-intro {
  margin-bottom: 16px;
}

.detail-intro p {
  margin: 0 0 6px;
}

.section-index {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.section-index a {
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  text-decoration: none;
}

.section-index a.to-result {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.detail-result {
  position: sticky;
  top: calc(var(--header-height) + 12px);
  max-height: calc(100vh - var(--header-height) - 24px);
  overflow-y: auto;
  min-width: 0;
}

/* ---- 2. 入力セクション ---- */
.d-section {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 0 18px 12px;
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--header-height) + 8px);
}

.d-section > summary {
  cursor: pointer;
  padding: 14px 0 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-teal);
  margin-bottom: 12px;
}

.sec-no {
  display: inline-block;
  min-width: 1.6em;
  margin-right: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  text-align: center;
  font-size: 13px;
}

.d-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 4px 16px;
}

.d-grid-4 {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.d-subhead {
  margin: 10px 0 6px;
  font-size: 13px;
  color: var(--color-muted);
}

.method-block {
  border-left: 3px solid var(--color-primary-soft);
  padding-left: 12px;
  margin: 6px 0 10px;
}

.method-label {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-muted);
}

.d-period {
  border-top: 1px dashed var(--color-border);
  padding-top: 8px;
  margin-top: 8px;
}

.d-period-title {
  margin: 0 0 2px;
  font-weight: 700;
  font-size: 14px;
}

.d-pair {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 16px;
}

.lease-note {
  display: none;
  margin: 2px 0 8px;
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 700;
}

.is-lease-included .lease-note {
  display: block;
}

.is-lease-included input[type="text"] {
  background: #f0ede6;
  color: var(--color-muted);
}

/* ---- 3. 入力欄・エラー・警告 ---- */
.d-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  min-width: 0;
}

.d-field label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.badge-req,
.badge-opt,
.mode-badge {
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: 1px;
}

.badge-req {
  background: var(--color-primary);
  color: #fff;
}

.badge-opt {
  background: var(--color-bg);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}

.input-unit {
  display: flex;
  align-items: center;
  gap: 6px;
}

.d-field input[type="text"],
.d-field select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
  color: var(--color-text);
  font-size: 16px; /* スマホでの自動ズームを防ぐ */
}

.input-unit input[type="text"] {
  text-align: right;
}

.d-field input:focus,
.d-field select:focus {
  outline: 2px solid var(--color-teal);
  outline-offset: 1px;
}

.unit {
  flex: 0 0 auto;
  min-width: 2.5em;
  font-size: 13px;
  color: var(--color-muted);
}

.d-field.has-error input[type="text"],
.d-choice.has-error {
  border-color: var(--color-danger);
  background: var(--color-danger-bg);
}

.d-field.has-warning input[type="text"] {
  border-color: var(--color-accent);
}

.field-error,
.field-warning {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.field-error {
  color: var(--color-danger);
}

.field-warning {
  color: #7a5310;
}

/* 2026-10-19 独立監査（優先5）: スマホの最初の画面に STEP 1 と月間稼働日数（ラベル・入力欄）が下部のメニューに隠れずに入るよう、
   冒頭の説明は閉じた開閉 1 行に（_tools.html の intro の fold_on_phone）、入力例の行の「保存した車両を呼び出す」は
   すぐ下の「保存した車両・保存した案件」と同じ入口のため出さない。PC の幅は変えない */
.page-intro-fold { display: none; }
@media (max-width: 767px) {
  .lnt dl.page-intro-wide { display: none; } /* lnt.css の .lnt .page-intro（同じ詳細度・後に読む）に負けないよう要素名を付ける */
  .lnt .page-intro-fold { display: block; margin: 8px 0 0; border-left: 3px solid var(--line-strong); background: var(--surface);
    border-radius: 0 8px 8px 0; }
  .lnt .page-intro-fold > summary { min-height: 44px; display: flex; align-items: center; padding: 0 12px; font-size: 14px;
    font-weight: 700; color: var(--ink-2); cursor: pointer; }
  .lnt .page-intro-fold > .page-intro { margin: 0; padding: 0 0 8px; }
  .lnt .page-intro-fold > .page-intro > div { border-left: 0; background: transparent; padding: 4px 12px; }
  .lnt .d-quick-row .d-store-quick { display: none; }
}


.msg-kind {
  display: inline-block;
  flex: none; /* 横並び（.lnt .field-error は flex）の中で縮めない。縮むと「エラ／ー」と折り返す（2026-10-19 監査） */
  white-space: nowrap;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.field-error .msg-kind {
  background: var(--color-danger);
}

.field-warning .msg-kind {
  background: #a0701a;
}

.d-choice {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 12px 10px;
  margin: 0 0 12px;
  min-width: 0;
}

.d-choice legend {
  padding: 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.choice-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  font-size: 14px;
  cursor: pointer;
}

.choice-option input {
  width: 18px;
  height: 18px;
}

.detail-errors a,
.warning-box a,
.warning-list a {
  color: inherit;
}

.warning-box {
  background: #fdf6e3;
  border: 1px solid var(--color-accent);
  color: #6b4a0e;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 14px;
}

.warning-box ul,
.detail-errors ul {
  margin: 6px 0 0 20px;
  padding: 0;
  overflow-wrap: anywhere;
}

/* ---- 4. 自動値と手入力 ---- */
.mode-badge {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.d-auto.is-manual .mode-badge {
  background: var(--color-accent-sub);
  color: #fff;
}

.auto-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin-top: 4px;
  font-size: 13px;
}

.manual-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
}

.btn-link {
  padding: 4px 0;
  border: none;
  background: none;
  color: var(--color-primary);
  text-decoration: underline;
  font-size: 13px;
  cursor: pointer;
}

.submit-bar {
  position: sticky;
  bottom: 0;
  padding: 10px 0;
  background: linear-gradient(to top, var(--color-bg) 70%, transparent);
}

/* ---- 5. 結果（数値カード .kpi は style.css の共通部品） ---- */
.detail-result h3 {
  margin: 18px 0 6px;
  font-size: 15px;
  color: var(--color-primary);
}

.cost-table .group-row th,
.cost-table .group-row td {
  background: var(--color-primary-soft);
  font-weight: 700;
}

.cost-table .item-name {
  padding-left: 16px;
  font-weight: 400;
}

.cost-table .sub-row th,
.cost-table .sub-row td {
  font-size: 13px;
  color: var(--color-muted);
}

.cost-table .total-row th,
.cost-table .total-row td {
  font-weight: 700;
  border-top: 2px solid var(--color-teal);
}

.cost-table th {
  text-align: left;
}

.cost-table td {
  white-space: nowrap;
  vertical-align: top;
}

.basis {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--color-muted);
  text-align: left;
  overflow-wrap: anywhere;
}

.basis-note {
  color: var(--color-muted);
}

.fare-table th,
.fare-table td {
  white-space: nowrap;
}

.assumption-list,
.warning-list {
  margin: 4px 0 0 18px;
  padding: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.warning-list {
  color: #6b4a0e;
}

/* ---- 6. レスポンシブ ---- */
@media (max-width: 1100px) {
  .detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-result {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .d-section {
    padding: 0 12px 10px;
  }

  .d-grid,
  .d-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .d-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 共通の .result-table は見出し列を55%幅にしているため、詳細計算の多列の表では幅を自動にする */
.fare-table th,
.cost-table th {
  width: auto;
}

/* 詳細計算の原価指標の推移（公的データ）への入口 */
.detail-trends-link {
  margin: var(--space-3) 0 0;
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-border);
  font-size: 14px;
}

/* ---- 7. 結果の読み取りの補助・入力の補助（2026-09-30） ---- */
/* ① 判断: 黒字・赤字・収支ゼロ。赤字だけ警告色（文字と左の線だけ。面は白） */
.judge-banner {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--lnt-border);
  border-left: 5px solid var(--lnt-primary);
  border-radius: var(--lnt-radius-sm);
  background: var(--lnt-surface);
}

.judge-banner.is-loss {
  border-left-color: var(--lnt-alert);
}

.judge-banner.is-even {
  border-left-color: var(--lnt-accent);
}

.judge-banner p {
  margin: 0;
}

.judge-label {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
}

.page-detail .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.judge-label .judge-amount {
  display: inline-block;
  margin-left: 10px;
  color: var(--lnt-text);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.judge-banner.is-slight_profit {
  border-left-color: var(--lnt-accent);
}

.judge-banner.is-loss .judge-label {
  color: var(--lnt-alert);
}

.judge-text {
  margin-top: 6px !important;
  font-size: var(--lnt-fs-body);
}

.judge-banner.is-loss .judge-amount,
.judge-banner.is-loss .judge-text strong {
  color: var(--lnt-alert);
}

.judge-next {
  margin-top: 4px !important;
  color: var(--lnt-muted);
  font-size: var(--lnt-fs-note);
}

.judge-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 8px !important;
  font-size: var(--lnt-fs-note);
}

/* ③ 運賃の比較（金額の高い順。現在運賃の行を強調） */
.fare-ladder {
  margin: 8px 0 12px;
  padding: 0;
  border: 1px solid var(--lnt-border);
  border-radius: var(--lnt-radius-sm);
  list-style: none;
  background: var(--lnt-surface);
}

.ladder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 7.5em;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--lnt-border);
  font-size: 14px;
}

.ladder-row:last-child {
  border-bottom: none;
}

.ladder-amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.ladder-state {
  color: var(--lnt-muted);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.ladder-row.is-met .ladder-label,
.ladder-row.is-met .ladder-amount {
  color: var(--lnt-muted);
}

.ladder-row.is-current {
  background: var(--lnt-accent-soft);
  font-weight: 700;
}

.ladder-row.is-current .ladder-state {
  color: var(--lnt-text);
}

.ladder-row.is-break_even {
  border-top: 2px solid var(--lnt-border-strong);
}

.ladder-mark {
  margin-right: 4px;
  color: var(--lnt-accent);
}

/* ④ 原価の内訳（帯グラフ。区分の色はチャコールからサンドへの濃淡。凡例に金額と割合） */
.cost-bar {
  display: block;
  width: 100%;
  height: 28px;
  margin: 8px 0;
  border-radius: 4px;
}

.seg-1 { fill: #292D2B; background: #292D2B; }
.seg-2 { fill: #4A4F4C; background: #4A4F4C; }
.seg-3 { fill: #C28A3D; background: #C28A3D; }
.seg-4 { fill: #6E736F; background: #6E736F; }
.seg-5 { fill: #D9B98A; background: #D9B98A; }
.seg-6 { fill: #9A9E9A; background: #9A9E9A; }
.seg-7 { fill: #E8D6BA; background: #E8D6BA; }
.seg-8 { fill: #BFC2BD; background: #BFC2BD; }

.cost-bar rect + rect {
  stroke: #FFFFFF;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.cost-legend {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px 16px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.cost-legend li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto 3.8em;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--lnt-border);
}

.cost-legend .swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.legend-amount,
.legend-share {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.legend-share {
  color: var(--lnt-muted);
}

.detail-result h4 {
  margin: 12px 0 4px;
  font-size: 14px;
}

.result-reentry {
  margin: 16px 0 0;
  text-align: center;
}

.btn-secondary-link {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--lnt-border-strong);
  border-radius: var(--lnt-radius-sm);
  background: var(--lnt-surface);
  color: var(--lnt-primary);
  font-weight: 600;
  text-decoration: none;
}

/* 入力の補助: 金額の読み上げ（桁の確認）・区画の誤りの件数・用意するもの */
.amount-echo {
  margin: 4px 0 0;
  color: var(--lnt-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.sec-badge {
  margin-left: auto;
  padding: 1px 8px;
  border: 1px solid var(--lnt-alert);
  border-radius: 999px;
  background: var(--lnt-surface);
  color: var(--lnt-alert);
  font-size: 12px;
  font-weight: 700;
}

.prep-list {
  margin: 10px 0 0;
}

.prep-list > summary {
  cursor: pointer;
  font-weight: 600;
}

.prep-list ul {
  margin: 6px 0 4px 1.2em;
  padding: 0;
  font-size: 13px;
}

.prep-list li + li {
  margin-top: 2px;
}

#error-summary:focus,
#result:focus {
  outline: 2px solid var(--lnt-accent);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .cost-legend {
    grid-template-columns: minmax(0, 1fr);
  }

  .ladder-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ladder-state {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* ---- 8. 保存した車両（static/detail-vehicles.js。2026-10-06） ---- */
.vehicle-store {
  margin-bottom: 16px;
}

.vehicle-store h2 {
  margin: 0 0 6px;
  font-size: 17px;
  color: var(--lnt-primary);
}

.vehicle-store .notice {
  margin: 0 0 6px;
}

.vs-row {
  display: grid;
  grid-template-columns: 10em minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
  margin-top: 10px;
}

.vs-row label {
  font-size: 14px;
  font-weight: 600;
}

.vs-row select,
.vs-row input[type="text"] {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--lnt-border);
  border-radius: 6px;
  background: #fff;
  color: var(--lnt-text);
  font-size: 16px; /* スマホでの自動ズームを防ぐ */
}

.vs-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vs-button {
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--lnt-border-strong);
  border-radius: var(--lnt-radius-sm);
  background: var(--lnt-surface);
  color: var(--lnt-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.vs-button.is-primary {
  border-color: var(--lnt-primary);
  background: var(--lnt-primary);
  color: #fff;
}

.vs-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.vs-button:focus-visible,
.vs-row select:focus,
.vs-row input:focus {
  outline: 2px solid var(--lnt-accent);
  outline-offset: 1px;
}

.vs-count,
.vs-status,
.vs-active,
.vs-unavailable {
  margin: 8px 0 0;
  font-size: 13px;
}

.vs-count {
  color: var(--lnt-muted);
}

.vs-active {
  font-weight: 700;
}

.vs-status:empty {
  display: none;
}

.vs-status,
.vs-unavailable {
  padding: 6px 10px;
  border-left: 3px solid var(--lnt-accent);
  background: var(--lnt-accent-soft);
}

/* 呼び出した後、計算し直すまでの古い結果は薄く表示する */
.detail-result.is-stale > :not(.stale-note) {
  opacity: 0.45;
}

.stale-note {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-left: 4px solid var(--lnt-accent);
  background: var(--lnt-accent-soft);
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .vs-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .vs-button {
    flex: 1 1 auto;
  }
}
/* ---- 9. 現場判断の要約（結果の先頭。2026-10-06）。原価割れだけ警告色、要確認はサンド、利益確保は主色 ---- */
.field-summary {
  margin: 0 0 16px;
  padding: 14px 16px 10px;
  border: 1px solid var(--lnt-border);
  border-top: 5px solid var(--lnt-primary);
  border-radius: var(--lnt-radius-sm);
  background: var(--lnt-surface);
}

.field-summary.is-loss {
  border-top-color: var(--lnt-alert);
}

.field-summary.is-check {
  border-top-color: var(--lnt-accent);
}

.field-status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0 0 10px;
}

.field-badge {
  display: inline-block;
  padding: 2px 14px;
  border-radius: 999px;
  background: var(--lnt-primary);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
}

.field-summary.is-check .field-badge {
  background: var(--lnt-accent-soft);
  color: var(--lnt-text);
  border: 2px solid var(--lnt-accent);
}

.field-summary.is-loss .field-badge {
  background: var(--lnt-alert);
}

.field-reason {
  font-size: 14px;
  font-weight: 600;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  margin: 0 0 8px;
}

.field-item {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--lnt-border);
  border-radius: var(--lnt-radius-sm);
}

.field-item dt {
  color: var(--lnt-muted);
  font-size: 12px;
}

.field-item dd {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.field-item dd small {
  display: block;
  color: var(--lnt-muted);
  font-size: 11px;
  font-weight: 400;
}

.field-item.is-key {
  background: var(--lnt-accent-soft);
}

.field-item.is-negative dd {
  color: var(--lnt-alert);
}

.field-rule {
  margin: 0;
  font-size: 12px;
}

@media (max-width: 720px) {
  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-item dd {
    font-size: 16px;
  }
}
/* 上部＝即時の判断（要約）、下部＝詳細の根拠。要約の下の既存の判断（黒字・赤字の説明）は根拠として控えめに表示する */
.basis-heading {
  margin-top: 4px !important;
  padding-top: 10px;
  border-top: 1px dashed var(--lnt-border);
}

.field-summary ~ .judge-banner .judge-label {
  font-size: 18px;
}

.field-summary ~ .judge-banner .judge-label .judge-amount {
  font-size: 16px;
}
/* ---- 10. 入力の段階表示（STEP 1〜3。2026-10-06）。区画（details）はこれまでどおり開閉できる ---- */
.d-stage {
  margin: 0 0 18px;
}

.d-stage-head {
  margin: 0 0 10px;
  padding: 10px 14px;
  border-left: 5px solid var(--lnt-primary);
  border-radius: var(--lnt-radius-sm);
  background: var(--lnt-surface);
}

.d-stage-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0;
  font-size: 18px;
  color: var(--lnt-primary);
}

.stage-no {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--lnt-primary);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.d-stage-note,
.d-stage-vehicle,
.d-stage-tools {
  margin: 4px 0 0;
  font-size: 13px;
}

.d-stage-note {
  color: var(--lnt-muted);
}

.d-stage-vehicle {
  padding: 4px 8px;
  border-left: 3px solid var(--lnt-accent);
  background: var(--lnt-accent-soft);
  font-weight: 600;
}

.d-stage-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
}

.d-stage-tools .btn-link {
  min-height: 32px;
}

.d-section > summary:focus-visible {
  outline: 2px solid var(--lnt-accent);
  outline-offset: 2px;
}

.d-section:not([open]) > summary {
  margin-bottom: 0;
  border-bottom-color: transparent;
}
.d-section:not([open]) {
  padding-bottom: 0;
  margin-bottom: 8px;
}

.d-section:not([open]) > summary {
  padding-bottom: 12px;
}
/* ---- 11. 印刷・PDF 保存（2026-10-06）。画面では印刷用の見出しを出さない ---- */
.print-only {
  display: none;
}

.print-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 0 0 12px;
}

.print-hint {
  color: var(--lnt-muted);
  font-size: 12px;
}

@media print {
  @page {
    size: A4;
    margin: 12mm 12mm 14mm;
  }

  html,
  body,
  .page-detail {
    background: #fff !important;
  }

  .page-detail {
    font-size: 10.5pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* 印刷に不要なもの: ヘッダー・メニュー・入力欄・保存の部品・ボタン・画面内の移動リンク・フッター */
  .site-header,
  .side-nav,
  .page-heading,
  .detail-intro,
  .vehicle-store,
  .case-store,
  .detail-form,
  .detail-errors,
  .warning-box,
  .print-actions,
  .judge-links,
  .result-reentry,
  .app-footer,
  .stale-note {
    display: none !important;
  }

  .app-shell,
  .detail-layout {
    display: block !important;
  }

  .app-content,
  .app-main,
  .detail-main {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .detail-result {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .detail-result.is-stale > * {
    opacity: 1 !important;
  }

  .print-only {
    display: block;
  }

  .print-head {
    margin: 0 0 10px;
    padding: 0 0 8px;
    border-bottom: 2px solid #292D2B;
  }

  .print-title {
    margin: 0 0 6px;
    font-size: 15pt;
    font-weight: 700;
  }

  .print-subtitle {
    margin: 8px 0 4px;
    font-weight: 700;
  }

  .print-meta,
  .print-conditions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 16px;
    margin: 0;
  }

  .print-meta div,
  .print-conditions div {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #ddd;
    padding: 2px 0;
  }

  .print-meta dt,
  .print-conditions dt {
    flex: 0 0 9em;
    color: #555;
  }

  .print-meta dd,
  .print-conditions dd {
    margin: 0;
  }

  .print-meta [hidden] {
    display: none;
  }

  .print-disclaimer {
    margin: 14px 0 0;
    padding-top: 6px;
    border-top: 1px solid #999;
    font-size: 9pt;
  }

  .field-summary,
  .judge-banner,
  .fare-ladder,
  .cost-legend li,
  .result-table tr,
  .print-head {
    break-inside: avoid;
  }

  .detail-result h2,
  .detail-result h3,
  .detail-result h4 {
    break-after: avoid;
  }

  .field-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .field-item dd {
    font-size: 13pt;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
/* 印刷は A4 1ページの要約版（2026-10-06 所有者の指示）: 見出し・現場判断の要約・判定の基準・試算の旨だけを出す。
   原価の明細・運賃の比較・計算の前提などの詳細は画面で確認する（印刷しない） */
@media print {
  .detail-result > :not(.print-head):not(.field-summary):not(.print-only) {
    display: none !important;
  }

  .field-summary .field-rule {
    display: none !important;
  }

  .field-summary {
    margin: 0 0 8px;
  }

  .print-note {
    margin: 8px 0 0;
    font-size: 9.5pt;
  }
}
/* ---- 12. 入力例・かんたん計算からの引き継ぎ・バックアップ（2026-10-06） ---- */
.sample-inputs {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--lnt-border);
}

.sample-title,
.vs-label {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.sample-inputs .hint,
.vs-backup .hint {
  margin: 2px 0 6px;
  font-size: 12px;
  color: var(--lnt-muted);
}

.handoff-note {
  margin-top: 10px;
}
/* ---- 10. 保存した案件（見積・実績。static/detail-cases.js）と見積→実績の比較（templates/detail_compare.html。2026-10-06） ---- */
.case-store {
  margin-bottom: 16px;
}

.case-store h2 {
  margin: 0 0 6px;
  font-size: 17px;
  color: var(--lnt-primary);
}

.case-store .notice {
  margin: 0 0 6px;
}

.cs-mode {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 2px solid var(--lnt-accent);
  border-radius: var(--lnt-radius-sm);
  background: var(--lnt-accent-soft);
}

.cs-mode-title {
  margin: 0;
  font-weight: 700;
}

.cs-mode-text,
.cs-mode-links {
  margin: 4px 0 6px;
  font-size: 13px;
}

.cs-mode-links a {
  display: inline-block;
  margin: 2px 10px 2px 0;
}

.cs-selected {
  margin: 0;
  font-size: 13px;
  color: var(--lnt-muted);
}

.cs-actual-note {
  margin-top: 8px;
  font-size: 12px;
}

.compare-section h2 {
  margin: 0 0 6px;
  font-size: 17px;
  color: var(--lnt-primary);
}

.compare-case {
  margin: 0 0 6px;
  font-size: 16px;
}

.compare-actual-note {
  padding: 6px 10px;
  border-left: 3px solid var(--lnt-accent);
  background: var(--lnt-accent-soft);
}

.compare-table th {
  width: auto;
}

.compare-table td {
  white-space: nowrap;
}

.compare-diff {
  font-weight: 700;
}

.compare-meaning {
  display: block;
  font-size: 12px;
  color: var(--lnt-muted);
}

.compare-table tr.is-worse .compare-diff,
.compare-table tr.is-worse .compare-meaning {
  color: var(--lnt-alert);
}

.compare-top {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 4px solid var(--lnt-primary);
  background: var(--lnt-surface-sub);
}

.compare-top-message,
.compare-top-heading {
  margin: 0;
  font-weight: 700;
}

.compare-top-list {
  margin: 4px 0 0;
  padding-left: 1.4em;
}

/* スマホ: 比較の表は行ごとのカード（見出し → 見積・実績・差を縦に並べる）にして、横にはみ出さない */
@media (max-width: 720px) {
  .compare-table thead {
    display: none;
  }

  .compare-table,
  .compare-table tbody,
  .compare-table tr,
  .compare-table th,
  .compare-table td {
    display: block;
    width: auto;
  }

  .compare-table tr {
    padding: 6px 0;
    border-bottom: 1px solid var(--lnt-border);
  }

  .compare-table th,
  .compare-table td {
    padding: 2px 4px;
    border: 0;
    text-align: left;
    white-space: normal;
  }

  .compare-table td::before {
    content: attr(data-label) "：";
    display: inline-block;
    min-width: 4em;
    color: var(--lnt-muted);
    font-size: 12px;
  }
}

/* 結果から「運賃の判断・交渉」（/detail/decision）へ進むボタン（2026-10-08） */
.decision-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 12px 0 4px;
}
