/* ============================================================
   証拠金・維持率・ロスカットの計算（money/fx-margin.html）だけの見た目
   色は共通の変数だけを使う（money.css・ek.css の v2 層の上に重ねる）
   ============================================================ */

/* ポジションの行 */
.fm-rows { display: grid; gap: 10px; }
.fm-row { margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); min-width: 0; }
.fm-row legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.fm-g { display: grid; gap: 8px; margin-top: 6px; }
.fm-g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fm-g3.fm-top { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.fm-top .fm-name { grid-column: 1 / -1; }
.fm-c { display: flex; flex-direction: column; gap: 3px; min-width: 0; margin: 0; }
.fm-c[hidden] { display: none; }
.fm-c > span { font-size: 12px; color: var(--muted); line-height: 1.4; }
html[data-ui="v2"] .fm-c input, html[data-ui="v2"] .fm-c select, html[data-ui="v2"] #form select#moving {
  width: 100%; min-width: 0; height: 42px; padding: 0 8px; font: inherit; font-size: 15px; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); box-sizing: border-box;
}
html[data-ui="v2"] .fm-c input { text-align: right; }
html[data-ui="v2"] .fm-c.fm-name input { text-align: left; }
html[data-ui="v2"] .fm-c input:focus, html[data-ui="v2"] .fm-c select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
html[data-ui="v2"] .fm-c input.bad { border-color: var(--s2, #B4442C); border-width: 2px; }
html[data-ui="v2"] #form select#moving { height: 44px; padding: 0 10px; }
.fm-del-c { justify-content: flex-end; }
.fm-del {
  height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface);
  color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer;
}
.fm-del:hover { background: var(--accent-soft); color: var(--ink); }
.fm-del:focus-visible { outline: 2px solid var(--accent); }
.fm-row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fm-btn {
  display: inline-flex; align-items: center; height: 38px; padding: 0 14px; border: 1px solid var(--accent); border-radius: var(--r);
  background: var(--surface); color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.fm-btn:hover { background: var(--accent-soft); }
.fm-btn[hidden] { display: none; }
@media (max-width: 560px) {
  html[data-ui="v2"] .fm-c input, html[data-ui="v2"] .fm-c select, html[data-ui="v2"] #form select#moving { font-size: 16px; }
}
@media (max-width: 420px) {
  .fm-row { padding: 8px 8px 10px; }
  .fm-g3:not(.fm-top) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 結果のそばの注意（いつも出す） */
.fm-warn { margin: 14px 0 0; padding: 10px 14px 10px 30px; border-radius: var(--r); background: var(--tint-warn, #FFF4E5); color: var(--tint-warn-ink, #8A4B00); font-size: 13px; line-height: 1.75; }
.fm-warn li { margin: 0; }

/* 表 */
table.data.fm-tbl { margin-top: 8px; }
table.data.fm-tbl caption { caption-side: top; text-align: left; font-size: 13px; font-weight: 700; color: var(--ink-2); padding: 8px 0 4px; }
table.data.fm-tbl th:first-child, table.data.fm-tbl td:first-child { text-align: left; }
table.data.fm-tbl td.n .sub { font-size: 11.5px; white-space: normal; }
table.data.fm-tbl tr.sum td { font-weight: 700; }
table.data td.down { color: var(--s2, #B4442C); }
#formula .fl { overflow-wrap: anywhere; }
html[data-ui="v2"] #result .res-hero .sub, html[data-ui="v2"] #result .res-mini .v { overflow-wrap: anywhere; }
@media (max-width: 560px) { table.data.fm-tbl th, table.data.fm-tbl td { padding-left: 6px; padding-right: 6px; } }
