/* src/public/css/calculator/cost_ratio.css … 原価計算（/calculator/cost-ratio）
   💡 入力欄・カード・表は money.css（mc-…）。ここは「求めるもの」の切り替えと、結果の一覧・赤字の注意だけ */

/* 求めるもの（3つのボタンのように並べる） */
.cr-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 10px; padding: 0; border: 0; min-width: 0; }
.cr-modes legend { float: left; width: 100%; margin: 0 0 4px; padding: 0; font-weight: bold; font-size: 0.9rem; color: #334155; }
.cr-modes label { position: relative; flex: 1 1 0; min-width: 0; margin: 0; cursor: pointer; }
.cr-modes input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cr-modes span {
    display: block; padding: 8px 6px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff;
    text-align: center; font-weight: bold; font-size: 0.92rem; color: #334155; line-height: 1.3; overflow-wrap: anywhere;
}
.cr-modes input:checked + span { border-color: #2a5298; background: #2a5298; color: #fff; }
.cr-modes input:focus-visible + span { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* 原価率の例のボタン：1行。はみ出す分は横にずらす */
.cr-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }

/* 税込のチェックと税率（隣に並べる） */
.cr-tax-check { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-weight: bold; font-size: 0.9rem; }
.cr-tax-row { display: flex; align-items: center; gap: 8px; }
.cr-tax-rate-label { margin: 0 !important; font-size: 0.85rem; font-weight: bold; white-space: nowrap; }
.cr-tax-rate { max-width: 9em; }
.cr-tax-rate input:disabled { background: #f1f5f9; color: #94a3b8; }

/* 結果の一覧 */
.cr-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin: 12px 0 0; }
.cr-row { min-width: 0; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; }
.cr-row dt { font-size: 0.78rem; color: #475569; overflow-wrap: anywhere; }
.cr-row dd { margin: 2px 0 0; font-weight: bold; font-size: 1.05rem; color: #1e293b; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cr-row.is-total { background: #eef3fb; border-color: #bfd0ee; }
.cr-row.is-loss dd { color: #b91c1c; }
.cr-loss { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: #fef2f2; color: #991b1b; font-weight: bold; font-size: 0.9rem; }
#cr-message { overflow-wrap: anywhere; }
.mc-message.is-error { color: #b91c1c; }
#cr-quick tr.is-current th, #cr-quick tr.is-current td { background: #eef3fb; font-weight: bold; }

/* ダークモード */
:root[data-theme="dark"] .cr-modes legend { color: var(--dk-text, #e2e8f0); }
:root[data-theme="dark"] .cr-modes span { background: var(--dk-surface, #1e293b); border-color: var(--dk-border, #334155); color: var(--dk-text, #e2e8f0); }
:root[data-theme="dark"] .cr-modes input:checked + span { background: #36518a; border-color: #7aa7e9; color: #fff; }
:root[data-theme="dark"] .cr-tax-rate input:disabled { background: var(--dk-raised, #172033); color: #6b7280; }
:root[data-theme="dark"] .cr-row { background: var(--dk-surface, #1e293b); border-color: var(--dk-border, #334155); }
:root[data-theme="dark"] .cr-row dt { color: var(--dk-text-sub, #a3b1c6); }
:root[data-theme="dark"] .cr-row dd { color: var(--dk-text, #e2e8f0); }
:root[data-theme="dark"] .cr-row.is-total { background: #1c2c4a; border-color: #36518a; }
:root[data-theme="dark"] .cr-row.is-loss dd { color: #f0787f; }
:root[data-theme="dark"] .cr-loss { background: #3b1d22; color: #fca5a5; }
:root[data-theme="dark"] .mc-message.is-error { color: var(--dk-danger, #f0787f); }
:root[data-theme="dark"] #cr-quick tr.is-current th,
:root[data-theme="dark"] #cr-quick tr.is-current td { background: #1c2c4a; }

/* スマホでは、詳細オプションの欄を1列に（端数の処理・通貨の選択肢が切れないように。批評1回目） */
@media (max-width: 480px) {
    .pc-options .mc-grid { grid-template-columns: minmax(0, 1fr); }
}
