/* ============================================================
   E-計算！ Math — 人と仕事の最適な割り当て（assignment.html）だけで使う見た目
   色は共通の変数（--accent / --ink / --muted / --grid / --page / --surface ほか）だけを使う
   ============================================================ */

/* 表を入れる欄を広めに（PC：入力 1.1 : 結果 1）。スマホは共通CSSどおり1列 */
@media (min-width: 861px) {
  .tool-layout.as-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
}
.as-quick { margin: 0 0 22px; max-width: 46em; }
.as-quick ul { margin: 2px 0 0; }
.as-quick li { margin: 2px 0; }

/* ---- 入力の表（行が人、列が仕事）。横にはみ出す分は枠の中だけで横スクロール ---- */
.as-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 4px; padding-bottom: 4px; border-radius: var(--r); }
.as-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.as-grid { border-collapse: separate; border-spacing: 0; }
.as-grid th, .as-grid td { padding: 3px; vertical-align: middle; font-weight: 400; }
.as-grid input {
  height: 40px; width: 64px; min-width: 0; 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: 8px; text-align: right;
}
.as-grid input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.as-grid .as-pname { width: 82px; text-align: left; font-size: 14px; font-weight: 600; }
.as-grid .as-jname { width: 64px; height: 34px; padding: 0 6px; text-align: left; font-size: 13px; font-weight: 600; }
.as-corner { font-size: 11.5px; color: var(--muted); text-align: left; white-space: nowrap; }
/* 名前の列は横スクロールしても見えるように */
.as-grid tbody th, .as-grid thead th.as-corner { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.as-colhead { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.as-rowhead { display: flex; align-items: center; gap: 2px; }
.as-del {
  flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: var(--page); color: var(--muted);
  font: inherit; font-size: 16px; line-height: 1; cursor: pointer;
}
.as-coldel { height: 22px; font-size: 14px; }
.as-del svg { display: block; margin: 0 auto; }
.as-del:hover { background: var(--accent-soft); color: var(--accent); }
.as-del:disabled { opacity: .35; cursor: default; }
/* 不可（×）・空欄・読めない数・選ばれたマス（色だけに頼らず、✓ と枠の太さでも区別する） */
.as-grid td.as-no input {
  text-align: center; color: var(--muted);
  background: repeating-linear-gradient(135deg, var(--page) 0 5px, var(--surface) 5px 10px);
}
.as-grid td.as-blank input { border-style: dashed; }
.as-grid input.bad { border-color: var(--s2, #B4442C); border-width: 2px; }
.as-grid td.on { position: relative; }
.as-grid td.on input { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 700; }
.as-grid td.on::after {
  content: "✓"; position: absolute; top: 0; left: 1px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 10px; line-height: 15px; text-align: center; font-weight: 700; pointer-events: none;
}
/* 全員を組にできない理由になった人・仕事 */
.as-grid th.grp input { border: 2px solid var(--tint-warn-ink); background: var(--tint-warn); }
.as-unit { max-width: 180px; }
.as-unit input { text-align: left !important; }
.as-actions { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 10px; font-size: 13px; }
.as-actions .hint { margin: 0 !important; }

/* ---- 今の割り当て（任意） ---- */
.as-cur { display: grid; gap: 6px; margin-top: 10px; }
.as-cur-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 8px; align-items: center; font-size: 13.5px; }
.as-cur-row label { font-weight: 600; overflow-wrap: anywhere; }
.as-cur-row select {
  width: 100%; height: 40px; padding: 0 8px; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
}
.as-cur-row select[aria-invalid="true"] { border-color: var(--s2, #B4442C); border-width: 2px; }
.as-curbox > summary { font-size: 13.5px; }

/* ---- 結果 ---- */
#resultPanel { min-height: 360px; }
table.data.as-res td, table.data.as-res th { text-align: left; }
table.data.as-res td.n, table.data.as-res th.n { text-align: right; }
table.data.as-res td.none { color: var(--muted); }
table.data.as-res td.as-wrapcell { white-space: normal; overflow-wrap: anywhere; min-width: 5em; }
.as-chg { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 11px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.as-fig { margin: 20px 0 0; padding: 14px 14px 10px; border: 1px solid var(--grid); border-radius: var(--r); background: var(--surface); min-width: 0; }
.as-fig figcaption { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 6px; line-height: 1.6; }
.as-fig svg { display: block; width: 100%; max-width: 400px; height: auto; margin: 0 auto; }
.as-fig .lg { font-size: 11.5px; color: var(--ink-2); margin: 6px 0 0; line-height: 1.7; }
.as-fig .lg i { display: inline-block; width: 18px; height: 0; vertical-align: middle; margin: 0 4px 0 0; border-top: 3px solid var(--accent); }
.as-fig .lg i.cur { border-top: 2px dashed var(--muted); }
.as-svg-node rect { fill: var(--page); stroke: var(--baseline); stroke-width: 1; }
.as-svg-node.on rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.as-svg-node.off rect { stroke-dasharray: 4 3; }
.as-svg-node text { fill: var(--ink); font-size: 13px; }
.as-svg-node.off text { fill: var(--muted); }
.as-svg-head { fill: var(--muted); font-size: 12px; font-weight: 600; }
.as-svg-link { stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.as-svg-cur { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.as-svg-val { fill: var(--accent); font-size: 12px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
/* 確かめの表 */
table.data.as-proof td.z { color: var(--accent); font-weight: 700; }
table.data.as-proof td.no { color: var(--muted); }
table.data.as-proof th.sum, table.data.as-proof td.sum { background: var(--page); }
.as-note-list { margin: 8px 0 0; padding-left: 1.3em; font-size: 13px; line-height: 1.8; color: var(--ink-2); }
/* 本文の表（数の例） */
.article table.data.as-ex td.on { color: var(--accent); font-weight: 700; }
