/* =========================================================
   追加の共通部品（DADS のコンポーネントに対応）
   style.css のあとに読み込む
   ========================================================= */
h2, h3 { color: var(--green-900); line-height: 1.4; }
.sidebar__foot p { margin: 0 0 4px; }
.sidebar__foot .btn { padding-inline: 0; min-height: 44px; white-space: normal; text-align: left; line-height: 1.3; }
.nav__ext { margin-left: auto; display: inline-flex; }
.nav__link .nav__ext svg { width: 16px; height: 16px; color: var(--gray-600); }
.stack { display: grid; gap: 20px; }
.row { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; }
.row--end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.small { font-size: 14px; }
.btn--danger { background: var(--white); color: var(--error-700); border-color: var(--error-700); }
.btn--danger:hover { background: var(--error-50); text-decoration: underline; }
button.btn { font-family: inherit; }

/* ノティフィケーションバナー（スタンダードスタイル：アイコンとタイトルは必須） */
.nb { display: flex; gap: 12px; padding: 16px 20px; border: 3px solid; border-radius: var(--radius-l); background: var(--white); margin-bottom: 20px; }
.nb__icon { flex: none; display: inline-flex; }
.nb__icon svg { width: 28px; height: 28px; stroke-width: 2; }
.nb__body { min-width: 0; flex: 1; }
.nb__title { margin: 0; font-weight: 700; font-size: 17px; line-height: 1.5; color: var(--gray-900); }
.nb__desc { margin-top: 4px; line-height: 1.6; }
.nb__desc ul { margin: 4px 0 0; padding-left: 1.4em; }
.nb__desc p { margin: 0; }
.nb__actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.nb--success { border-color: var(--success-700); } .nb--success .nb__icon { color: var(--success-700); }
.nb--error { border-color: var(--error-700); } .nb--error .nb__icon { color: var(--error-700); }
.nb--warning { border-color: var(--warn-700); } .nb--warning .nb__icon { color: var(--warn-700); }
.nb--info { border-color: var(--green-800); } .nb--info .nb__icon { color: var(--green-800); }
.nb--s { padding: 12px 14px; border-width: 2px; margin-bottom: 12px; }
.nb--s .nb__icon svg { width: 24px; height: 24px; }
.nb--s .nb__title { font-size: 16px; }

/* 入力（項目ラベル・要否ラベル・サポートテキスト・エラーテキストを縦に積む） */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field label, .field .label, .fs legend { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.filters .field label, .filters .field .label, .filters .fs legend, .field--s label, .field--s .label { font-size: 14px; color: var(--gray-700); }
.req { font-weight: 400; font-size: 14px; color: var(--error-700); margin-left: 6px; }
.opt { font-weight: 400; font-size: 14px; color: var(--gray-700); margin-left: 6px; }
.support { font-size: 14px; color: var(--gray-700); line-height: 1.5; margin: 0; font-weight: 400; }
.error-text { font-size: 14px; color: var(--error-700); line-height: 1.5; margin: 0; font-weight: 700; }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border: 2px solid var(--error-700); }
.input--s { width: 8em; } .input--xs { width: 6em; } .input--m { width: 16em; max-width: 100%; }
textarea.input { min-height: 88px; line-height: 1.5; resize: vertical; width: 100%; font: inherit; }
.fs { border: none; margin: 0; padding: 0; min-width: 0; }
.fs legend { padding: 0; margin-bottom: 4px; }
.choices { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.choice { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 400 !important; font-size: 16px !important; color: var(--gray-900) !important; }
.choice input { width: 22px; height: 22px; accent-color: var(--green-800); flex: none; margin: 0; cursor: pointer; }

/* 絞り込み・表示切替（ラジオボタンを横に並べたもの。タブは絞り込みに使わない） */
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--radius-m); background: var(--white); white-space: nowrap; font-size: 16px; font-weight: 400; color: var(--gray-900); }
.seg label:hover { border-color: var(--gray-900); text-decoration: underline; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg label:has(input:checked) { background: var(--green-800); border-color: var(--green-800); color: var(--white); font-weight: 700; }
.seg label:has(input:checked)::before { content: "✓"; }
.seg label:has(input:focus-visible) { outline: 4px solid var(--black); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-yellow); }
.seg .cnt { font-variant-numeric: tabular-nums; font-size: 14px; background: var(--white); color: var(--gray-900); border: 1px solid var(--gray-420); border-radius: 999px; padding: 0 8px; line-height: 20px; font-weight: 700; }
.seg .seg--alert .cnt { background: var(--error-700); color: var(--white); border-color: var(--error-700); }

/* タブ（同じ主題の内容を観点ごとに切り替える） */
.tabs { display: flex; gap: 4px; padding: 12px 20px 0; box-shadow: inset 0 -2px 0 var(--gray-900); overflow-x: auto; overflow-y: hidden; }
.tab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 1px solid var(--line-strong); border-bottom: none;
  border-radius: 8px 8px 0 0; background: var(--gray-50); cursor: pointer; white-space: nowrap; color: var(--gray-900); margin-bottom: 2px; font: inherit; }
.tab:hover { text-decoration: underline; }
.tab[aria-selected="true"] { background: var(--white); color: var(--green-900); font-weight: 700; border: 2px solid var(--gray-900); border-bottom: none; margin-bottom: 0; padding-bottom: 10px; }
.tab:focus-visible { outline-offset: -4px; }

/* ステップナビゲーション */
.steps { list-style: none; margin: 0; padding: 0; display: flex; counter-reset: step; }
.steps li { flex: 1; position: relative; padding-top: 44px; text-align: center; font-size: 14px; line-height: 1.4; color: var(--gray-700); counter-increment: step; min-width: 0; }
.steps li b { display: block; font-size: 16px; color: var(--gray-900); }
.steps li::before { content: counter(step); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--gray-536); background: var(--white); display: grid; place-items: center; font-weight: 700; color: var(--gray-700); z-index: 1; }
.steps li::after { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: var(--gray-536); }
.steps li:first-child::after { display: none; }
.steps li.is-done::before { content: "✓"; background: var(--green-800); border-color: var(--green-800); color: var(--white); }
.steps li.is-done::after, .steps li.is-current::after { background: var(--green-800); height: 4px; top: 14px; }
.steps li.is-current::before { border: 4px solid var(--green-800); color: var(--green-900); width: 36px; height: 36px; top: -2px; }
.steps li.is-current b { color: var(--green-900); text-decoration: underline; text-underline-offset: 4px; }

/* 数値の見出し */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; border-radius: var(--radius-m); background: var(--green-50); }
.kpi span { display: block; font-size: 14px; color: var(--gray-700); }
.kpi b { display: block; font-size: 24px; line-height: 1.3; font-variant-numeric: tabular-nums; color: var(--green-900); }
.kpi b small { font-size: 14px; font-weight: 400; margin-left: 2px; }
.kpi--warn { background: var(--warn-50); box-shadow: inset 4px 0 0 var(--warn-700); } .kpi--warn b { color: var(--warn-700); }
.kpi--alert { background: var(--error-50); box-shadow: inset 4px 0 0 var(--error-700); } .kpi--alert b { color: var(--error-700); }

/* 帯グラフ（上限の目盛りつき） */
.meter2 { position: relative; height: 12px; background: var(--gray-50); border-radius: 6px; box-shadow: inset 0 0 0 1px var(--gray-420); min-width: 120px; }
.meter2 i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: var(--green-700); max-width: 100%; }
.meter2 i.is-warn { background: var(--warn-700); } .meter2 i.is-over { background: var(--error-700); }
.meter2 em { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--gray-900); }

.table td, .table th { vertical-align: top; }
.sub { display: block; font-size: 14px; color: var(--gray-700); }
.table--dense th, .table--dense td { padding: 7px 10px; }
.table tfoot td, .table tfoot th { border-top: 2px solid var(--gray-900); border-bottom: none; font-weight: 700; }
.table td .input { min-height: 40px; padding: 6px 8px; }
.empty { padding: 40px 20px; text-align: center; color: var(--gray-700); }
.master-detail { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.pick { list-style: none; margin: 0; padding: 8px; max-height: calc(100vh - 200px); overflow-y: auto; }
.pick button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; min-height: 56px; border: 1px solid transparent; border-radius: var(--radius-m); background: none; cursor: pointer; line-height: 1.35; font: inherit; color: inherit; }
.pick button:hover { background: var(--green-50); }
.pick button[aria-current="true"] { background: var(--green-50); border-color: var(--green-800); box-shadow: inset 4px 0 0 var(--green-800); }
.pick button b { display: block; } .pick button .end { margin-left: auto; text-align: right; font-size: 14px; white-space: nowrap; }

/* 帳票（画面でのプレビューと印刷） */
.sheet { background: var(--white); border: 1px solid var(--line-strong); padding: 40px 44px; max-width: 880px; margin: 0 auto; color: var(--black); line-height: 1.6; }
.sheet h2 { text-align: center; font-size: 24px; letter-spacing: .3em; margin: 0 0 24px; color: var(--black); }
.sheet h3 { font-size: 16px; margin: 24px 0 8px; color: var(--black); border-bottom: 2px solid var(--black); padding-bottom: 4px; }
.sheet__head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.sheet__to { font-size: 20px; font-weight: 700; border-bottom: 2px solid var(--black); padding-bottom: 4px; margin: 0 0 8px; }
.sheet__from { text-align: right; font-size: 14px; margin-left: auto; }
.sheet__from img { width: 150px; margin-left: auto; margin-bottom: 6px; }
.sheet__total { display: flex; align-items: baseline; gap: 16px; border: 2px solid var(--black); padding: 10px 16px; margin: 16px 0; font-weight: 700; }
.sheet__total b { font-size: 26px; margin-left: auto; font-variant-numeric: tabular-nums; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sheet th, .sheet td { border: 1px solid var(--gray-700); padding: 6px 8px; text-align: left; vertical-align: top; }
.sheet thead th { background: var(--gray-50); border-bottom: 2px solid var(--black); }
.sheet td.r, .sheet th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet .note { font-size: 14px; margin-top: 16px; }
.sheet dl { display: grid; grid-template-columns: 12em 1fr; margin: 0; border-top: 1px solid var(--gray-700); border-left: 1px solid var(--gray-700); font-size: 15px; }
.sheet dt, .sheet dd { margin: 0; padding: 7px 10px; border-right: 1px solid var(--gray-700); border-bottom: 1px solid var(--gray-700); }
.sheet dt { background: var(--gray-50); font-weight: 700; }
.sheet-scroll { overflow-x: auto; }

@media (max-width: 1080px) { .master-detail { grid-template-columns: minmax(0, 1fr); } .pick { max-height: 300px; } }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .sheet { padding: 20px 16px; }
  .sheet dl { grid-template-columns: minmax(0, 1fr); } .sheet dt { border-bottom: none; }
  .steps li span { display: none; }
  .tabs { padding-left: 12px; padding-right: 12px; }
}
@media print {
  .sidebar, .topbar, .demo-note, .no-print, .toast, .skip-link { display: none !important; }
  .app { display: block; } .content { padding: 0; } body { background: #fff; }
  .panel { box-shadow: none; } .sheet { border: none; padding: 0; max-width: none; }
}

/* ---- 受注の登録・詳細（フェーズ5） ---- */
.cols--form { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.aside-sticky { position: sticky; top: 72px; }
.fees { display: grid; gap: 4px; }
.fee-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 4px 12px; border-radius: var(--radius-m); border: 1px solid var(--line); }
.fee-row.is-on { background: var(--green-50); border-color: var(--green-700); }
.fee-row.is-none { color: var(--gray-700); background: var(--gray-50); }
.fee-row .support { margin: 0; flex: 1 1 14em; }
.fee-amt { font-variant-numeric: tabular-nums; }
.steps--7 li { min-width: 0; }
.mates { list-style: none; margin: 0; padding: 0; }
.mates li { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.mates li:last-child { border-bottom: none; }
.mates li.is-me { background: var(--green-50); }
.mates li > div { flex: 1; min-width: 0; }
.mates__n { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--green-800); min-width: 3em; }
.diffs { list-style: none; margin: 8px 0 0; padding: 0; color: var(--warn-700); font-size: 14px; line-height: 1.5; }
@media (max-width: 1080px) { .cols--form { grid-template-columns: minmax(0, 1fr); } .aside-sticky { position: static; } }
