/* どのページでも使う見た目 */
:root { --accent: #2a78d6; --accent-soft: #e8f1fc; --line: #e2e2de; --muted: #6b6a66; --bg: #f7f7f5; --ink: #1f1f1d; --danger: #d03b3b; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; font-size: 13px; color: var(--ink); background: #fff;
       display: flex; flex-direction: column; }
.sp { flex: 1; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.chk { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; cursor: pointer; white-space: nowrap; }
select, input[type=number] { font: inherit; height: 28px; padding: 0 6px; border: 1px solid #d3d3ce; border-radius: 6px; background: #fff; }
.seg { display: inline-flex; border: 1px solid #d3d3ce; border-radius: 7px; overflow: hidden; width: 100%; }
.seg button { flex: 1; height: 30px; border: none; border-right: 1px solid #d3d3ce; background: #fff; cursor: pointer; font: inherit; font-size: 12px;
              display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; color: var(--ink); }
.seg button:last-child { border-right: none; }
.seg button:hover { background: #f1f1ee; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg svg { width: 22px; height: 16px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid #d3d3ce; border-radius: 7px; overflow: hidden; }
.stepper button { width: 30px; height: 30px; border: none; background: #fff; cursor: pointer; font-size: 16px; }
.stepper button:hover { background: #f1f1ee; }
.stepper input { width: 52px; height: 30px; border: none; border-left: 1px solid #d3d3ce; border-right: 1px solid #d3d3ce; border-radius: 0; text-align: center; }
.btn { height: 30px; padding: 0 10px; border: 1px solid #d3d3ce; border-radius: 7px; background: #fff; cursor: pointer; font: inherit; font-size: 12px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.wide { width: 100%; }
.btn.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn.danger { color: var(--danger); border-color: #ecc6c6; }
.btn.danger:hover { background: #fdf3f3; border-color: var(--danger); }
.sec { margin-bottom: 14px; }
.sec h4 { margin: 0 0 6px; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid3 .btn { padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.grid3 svg { width: 20px; height: 20px; }
.empty { color: var(--muted); line-height: 1.7; font-size: 12px; }
.empty b { color: var(--ink); font-weight: 600; }
.kbd { display: inline-block; padding: 0 5px; border: 1px solid #d3d3ce; border-bottom-width: 2px; border-radius: 4px; font-size: 11px; background: #fafaf8; color: var(--ink); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; background: #f1f1ee; padding: 0 3px; border-radius: 3px; }
.btn:disabled { opacity: .4; cursor: default; border-color: #d3d3ce; color: var(--ink); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #1f66bd; color: #fff; }

/* いちばん上の帯:図の一覧・名前・一時保存・書き出し */
#bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: #fff; }
#bar .home { color: var(--muted); text-decoration: none; font-size: 12px; padding: 4px 6px; border-radius: 6px; }
#bar .home:hover { background: #ecece8; color: var(--ink); }
#bar .title { font-weight: 600; font-size: 14px; margin-right: 6px; }
#bar label.fld { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
#d_pick { max-width: 240px; }
#d_name { font: inherit; height: 28px; padding: 0 8px; border: 1px solid #d3d3ce; border-radius: 6px; width: 230px; }
#d_name:focus, #d_pick:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
#d_status { color: var(--muted); font-size: 12px; min-width: 150px; }
#d_status.warn { color: var(--danger); }
.grp { display: inline-flex; align-items: center; gap: 4px; }
.grp .lbl { color: var(--muted); font-size: 12px; margin-right: 2px; }

/* 小さな開閉メニュー */
.popwrap { position: relative; }
.pop { display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 260px; max-height: 60vh; overflow-y: auto;
       background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 8px; }
.pop.open { display: block; }
.pop .cap { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 2px 4px 8px; }
.pop .item { display: block; width: 100%; text-align: left; border: none; background: none; padding: 7px 8px; border-radius: 6px; cursor: pointer; font: inherit; color: var(--ink); text-decoration: none; box-sizing: border-box; }
.pop .item:hover { background: #f1f1ee; }
.pop .item small { color: var(--muted); }

/* 確認・説明の小窓 */
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; max-width: min(560px, 92vw); box-shadow: 0 12px 40px rgba(0,0,0,.18); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.25); }
dialog h3 { margin: 0 0 10px; font-size: 15px; }
dialog p { line-height: 1.7; margin: 0 0 12px; }
dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
dialog table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
dialog td, dialog th { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
dialog th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
dialog ul { padding-left: 1.2em; line-height: 1.8; margin: 8px 0; }

/* 下に出るお知らせ */
#toast { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); background: #1f1f1d; color: #fff; padding: 8px 14px; border-radius: 8px;
         font-size: 12.5px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: 90vw; }
#toast.show { opacity: .94; }
#busy { position: fixed; inset: 0; background: rgba(255,255,255,.5); display: none; align-items: center; justify-content: center; z-index: 40; font-size: 14px; }
#busy.show { display: flex; }
