/* railplan 共通デザイン — ツール本体(index.html)と静的ページ(build.mjs生成)の両方が読む */
:root {
  color-scheme: light dark;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface2: #eef1f6;
  --text: #1c2430;
  --muted: #5c6675;
  --faint: #8b95a5;
  --border: #dde3ea;
  --divider: #e9edf2;
  --accent: #1e5fd6;
  --accent-soft: #e9f0fc;
  --warn: #c0392b;
  --warn-soft: #fdeeea;
  --paper: #ffffff;
  --grid: #eef1f5;
  --rail: #2c3e50;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141a;
    --surface: #171d26;
    --surface2: #1f2732;
    --text: #e7ebf1;
    --muted: #9aa5b4;
    --faint: #6d7888;
    --border: #2a3341;
    --divider: #232c39;
    --accent: #6ca0f5;
    --accent-soft: #1d2b45;
    --warn: #ff8672;
    --warn-soft: #3a221d;
    --paper: #1c2430;
    --grid: #263040;
    --rail: #aec3dd;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, "Noto Sans JP", sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 14px;
}
a { color: var(--accent); }

.shell { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
main.shell { padding-top: 26px; padding-bottom: 48px; }

/* ── ヘッダー ── */
.siteheader { background: var(--surface); border-bottom: 1px solid var(--border); }
.nav-shell { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 18px; min-height: 52px; padding-top: 6px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; color: var(--text); text-decoration: none; }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; flex: none; }
.sitenav { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-left: auto; }
.sitenav a { color: var(--muted); text-decoration: none; font-size: 13px; padding: 5px 10px; border-radius: 7px; }
.sitenav a:hover { color: var(--text); background: var(--surface2); }

/* ── 見出し・リード ── */
h1 { font-size: 22px; margin: 0 0 8px; line-height: 1.4; }
h2 { font-size: 16px; margin: 32px 0 10px; }
.lead { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; max-width: 76ch; }
.lead strong { color: var(--text); }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 22px; padding: 0; list-style: none; }
.facts li { font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; }
.facts .ok::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.facts .no::before { content: "− "; color: var(--faint); font-weight: 700; }

/* ── ツールの2カラム ── */
.wrap { display: grid; grid-template-columns: 348px minmax(0, 1fr); gap: 26px; align-items: start; }
@media (max-width: 920px) { .wrap { grid-template-columns: 1fr; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 14px 16px 12px; box-shadow: var(--shadow); margin: 0 0 12px; }
.panel > h2 { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }

/* プリセット */
.presets { display: flex; flex-wrap: wrap; gap: 7px; }
.presets button { font: inherit; font-size: 12px; color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; cursor: pointer; text-align: left; }
.presets button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* 在庫入力の行 */
.rows .row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--divider); }
.rows .row:first-child { border-top: none; }
.row .nm-wrap { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.row .nm { font-size: 13px; font-weight: 600; }
.row .sub { font-size: 11px; color: var(--faint); }
.row.has .nm { color: var(--accent); }
.stepper { display: flex; align-items: stretch; margin-left: auto; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); flex: none; }
.row.has .stepper { border-color: var(--accent); }
.stepper .st { font: inherit; font-size: 15px; line-height: 1; width: 28px; padding: 0; border: none; background: var(--surface2); color: var(--muted); cursor: pointer; }
.stepper .st:hover { color: var(--accent); }
.stepper input { width: 42px; border: none; background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 700; text-align: center; padding: 4px 0; appearance: textfield; -moz-appearance: textfield; }
.stepper input:focus { outline: none; background: var(--accent-soft); }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.opt { display: flex; gap: 7px; align-items: center; font-size: 12px; color: var(--muted); margin: 2px 2px 12px; cursor: pointer; }
.opt input { accent-color: var(--accent); }

/* ボタン */
.actions { display: flex; gap: 8px; }
.btn { font: inherit; border-radius: 9px; cursor: pointer; padding: 10px 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.btn.primary { flex: 1; background: var(--accent); border-color: var(--accent); color: #fff; font-size: 14px; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { font-size: 12.5px; color: var(--muted); }
.btn.ghost:hover { color: var(--warn); border-color: var(--warn); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0d1523; } }

#status { font-size: 12.5px; color: var(--muted); background: var(--surface2); border-radius: 10px; padding: 10px 13px; white-space: pre-wrap; margin-top: 12px; }

/* ── プランカード ── */
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 15px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 7px; }
.plan-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.plan h3 { font-size: 13.5px; margin: 0; margin-right: auto; }
.badge { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface2); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.plan .space { font-size: 12px; color: var(--muted); margin: 0; }
.plan .space strong { color: var(--text); font-size: 13px; }
.plan .use { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.plan .use li { font-size: 11px; color: var(--muted); border: 1px solid var(--divider); border-radius: 999px; padding: 1px 8px; }
.plan svg { display: block; width: 100%; height: auto; border-radius: 9px; border: 1px solid var(--divider); background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px; }
.plan svg path { stroke: var(--rail); }
.plan details { margin-top: 2px; }
.plan summary { font-size: 11px; color: var(--faint); cursor: pointer; user-select: none; }
.plan summary:hover { color: var(--accent); }
.plan .seq { font-size: 10.5px; color: var(--faint); word-break: break-all; margin: 4px 0 0; line-height: 1.7; }
.alert { font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 8px; padding: 6px 10px; margin: 0; }

/* ── テーブル(静的ページ) ── */
table { border-collapse: separate; border-spacing: 0; font-size: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
th, td { border: none; border-top: 1px solid var(--divider); padding: 7px 14px; text-align: left; }
tr:first-child > th, tr:first-child > td { border-top: none; }
th { background: var(--surface2); font-size: 12px; color: var(--muted); }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

ul { padding-left: 22px; }
li { margin: 3px 0; }

/* ── フッター ── */
.sitefoot { margin-top: 56px; border-top: 1px solid var(--border); background: var(--surface); font-size: 12px; color: var(--muted); }
.sitefoot .shell { padding-top: 18px; padding-bottom: 30px; }
.sitefoot p { margin: 6px 0; }
.sitefoot .sitenav { margin-left: 0; justify-content: flex-start; }
.sitefoot .sitenav a:first-child { padding-left: 0; }
