/* SAPラボ テーブル照会 — デザイン案 A(Quartz ライト)+ B の左右パネル(折りたたみ) */
:root {
  --font: "Segoe UI", "Yu Gothic UI", "Hiragino Sans", "Meiryo", system-ui, sans-serif;
  --mono: Consolas, "BIZ UDGothic", "Osaka-Mono", "Menlo", monospace;
  --bg: #f7f7f7;
  --text: #32363a;
  --muted: #6a6d70;
  --shell: #354a5f;
  --shell-text: #fff;
  --toolbar: #fff;
  --line: #d9d9d9;
  --line-soft: #ececec;
  --btn-bg: #fff;
  --btn-line: #0a6ed1;
  --btn-text: #0a6ed1;
  --accent: #0a6ed1;
  --accent-dark: #085caf;
  --accent-soft: #e5f0fa;
  --radius: 4px;
  --radius-sm: 3px;
  --inp-bg: #fff;
  --inp-line: #89919a;
  --ro: #f2f2f2;
  --grid-bg: #fff;
  --th: #f2f2f2;
  --th-text: #32363a;
  --zebra: #fafafa;
  --key-bg: #e5f0fa;
  --key-text: #0a3e78;
  --sel-bg: #fff3c4;
  /* このページだけの機能(パネル・注記など)は落ち着いた灰青で */
  --learn: #3b5168;
  --learn-bg: #f5f7fa;
  --learn-line: #d3dbe4;
  /* 「ポイント」の枠 */
  --point-bg: #fffaeb;
  --point-line: #edd28f;
  --point-text: #6b4e00;
  --ok: #188918;
  --warn: #a35200;
  --err: #bb0000;
  --err-bg: #ffebeb;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); font-size: 13px; color: var(--text); background: var(--bg); line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
.mono { font-family: var(--mono); }
.strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 8px; }
.spacer { flex: 1 1 auto; }
.num { text-align: right; }
code, kbd { font-family: var(--mono); font-size: 12px; }
code { background: #f0f2f4; border-radius: 3px; padding: 0 4px; }
kbd { display: inline-block; min-width: 22px; text-align: center; border: 1px solid #b9c0c7; border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: #fff; line-height: 18px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[hidden] { display: none !important; }

#app { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* ---------- シェル ---------- */
.shell { flex: none; display: flex; align-items: center; gap: 14px; min-height: 44px; padding: 6px 20px; background: #f0f3f6; color: var(--text); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.shell .brand { font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.shell-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.learn-badge { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: rgba(143, 208, 227, .25); border: 1px solid rgba(143, 208, 227, .7); white-space: nowrap; }
.shell-right { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 12px; }
.tcode-l { opacity: .95; white-space: nowrap; }
.tcode { width: 110px; height: 28px; border-radius: 4px; border: 1px solid var(--inp-line); background: #fff; color: var(--text); padding: 0 8px; font-family: var(--mono); text-transform: uppercase; }
.tcode:focus { border-color: var(--accent); outline: 2px solid rgba(10,110,209,.25); outline-offset: 0; }
.shell-link { background: #fff; border: 1px solid var(--btn-line); color: var(--btn-text); height: 28px; border-radius: 4px; padding: 0 10px; white-space: nowrap; }
.shell-link:hover { background: var(--accent-soft); }
.foot-note { flex: none; padding: 2px 20px 4px; font-size: 11px; color: var(--muted); background: var(--toolbar); }

/* ---------- ツールバー ---------- */
.toolbar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 20px; background: var(--toolbar); border-bottom: 1px solid var(--line); }
.tb-screen, .tb-settings { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tb-settings { margin-left: auto; }
.sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; display: inline-block; }
.btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: var(--radius); border: 1px solid var(--btn-line); background: var(--btn-bg); color: var(--btn-text); white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--accent-soft); }
.btn:active:not(:disabled) { background: #d1e5f8; }
.btn:disabled { opacity: .45; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn.on { background: var(--accent); color: #fff; }
.btn.small { height: 24px; padding: 0 8px; font-size: 12px; }
.btn .k { font-size: 11px; opacity: .75; margin-left: 2px; }
.btn .bi { font-size: 12px; line-height: 1; }

.learn-chip { display: inline-block; font-size: 10px; line-height: 15px; padding: 0 5px; border-radius: 8px; background: var(--learn); color: #fff; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.btn .learn-chip { margin-left: 2px; }
.seg-wrap { display: inline-flex; align-items: center; gap: 6px; }
.seglabel { color: var(--muted); font-size: 12px; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--accent); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; padding: 0 10px; height: 26px; color: var(--accent); background: var(--btn-bg); white-space: nowrap; }
.seg button + button { border-left: 1px solid #b8d3ee; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button:hover:not(.on) { background: var(--accent-soft); }

/* ---------- 3 列の配置 ---------- */
.layout { flex: 1 1 auto; min-height: 0; display: flex; position: relative; }
.main { flex: 1 1 auto; min-width: 0; overflow: auto; padding: 16px 20px 24px; overscroll-behavior: contain; }
.main.fill { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 12px; }
.main.fill > .screen { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

.panel { flex: none; background: #fff; display: flex; flex-direction: column; min-height: 0; position: relative; }
.panel.left { border-right: 1px solid var(--line); }
.panel.right { border-left: 1px solid var(--line); }
.panel.open { width: 262px; }
.panel.right.open { width: 280px; }
.panel.collapsed { width: 30px; }
.panel.collapsed .panel-head, .panel.collapsed .panel-body { display: none; }
.panel.open .panel-rail { display: none; }
.panel-rail { flex: 1; width: 100%; border: 0; background: var(--learn-bg); color: var(--learn); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; }
.panel-rail:hover { background: #d5f0f8; }
.rail-t { writing-mode: vertical-rl; font-weight: 600; letter-spacing: .1em; }
.learn-chip.v { writing-mode: vertical-rl; padding: 5px 0; line-height: 1; width: 15px; }
.panel-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--learn-bg); border-bottom: 1px solid var(--learn-line); }
.hakase { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 1px solid var(--line); object-fit: cover; }
.hakase.sm { width: 32px; height: 32px; }
.panel-title { margin: 0; font-size: 13px; color: var(--learn); flex: 1; white-space: nowrap; }
.panel-toggle { border: 1px solid var(--learn-line); background: #fff; color: var(--learn); width: 26px; height: 24px; border-radius: 4px; padding: 0; }
.panel-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 10px 12px 16px; overscroll-behavior: contain; }
.panel-body.help { line-height: 1.7; }
.panel-body.help p { margin: 0 0 10px; }
.panel-body.help ul { margin: 0 0 10px; padding-left: 18px; }
.panel-body.help li { margin-bottom: 4px; }
.tipbox { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--point-line); background: var(--point-bg); padding: 8px 10px; border-radius: 6px; margin: 10px 0; }
.tipbox-t { font-weight: 700; color: var(--point-text); margin-bottom: 4px; }
.tipbox p { margin: 0 0 6px !important; }
.realbox { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin: 10px 0; background: #fbfbfb; }
.real-chip { display: block; font-size: 11px; font-weight: 700; color: var(--shell); margin-bottom: 2px; }

/* 左のテーブル一覧 */
.inp { height: 28px; border: 1px solid var(--inp-line); border-radius: var(--radius-sm); background: var(--inp-bg); padding: 0 8px; min-width: 0; }
.inp:focus { border-color: var(--accent); outline: 2px solid rgba(10,110,209,.25); outline-offset: 0; }
.inp.wide { width: 100%; }
.inp.ro, .inp[readonly] { background: var(--ro); color: var(--muted); }
.inp.bad { border-color: var(--err); background: var(--err-bg); }
select.inp { padding: 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 1px 9px; font-size: 12px; color: var(--text); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip:hover:not(.on) { background: var(--accent-soft); }
.tlist { margin-top: 4px; }
.tmod { margin-bottom: 8px; }
/* 見出し(押せない)と、押せるテーブルの行・絞り込みのチップをはっきり分ける */
.tmod-h { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; color: #1d2d44; font-size: 13px; margin: 16px 0 4px; padding: 0 2px 4px; border-bottom: 2px solid #b9c5d3; cursor: default; }
/* 一覧をたどっている間も、どのモジュールかが分かるように見出しを検索欄の下に残す(--tfind-h は panels.js が入れる) */
.tmod-h { position: sticky; top: calc(var(--tfind-h, 0px) - 10px); z-index: 1; background: #fff; padding-top: 4px; }
.tmod-h .tmod-n { font-weight: 400; font-size: 11px; color: var(--muted); }
.tmod:first-child .tmod-h { margin-top: 6px; }
.tkind { font-size: 11px; font-weight: 700; color: #5b6b7d; margin: 8px 0 2px; padding: 2px 6px; background: #eef1f4; border-radius: 3px; cursor: default; }
.titem { padding-left: 10px !important; }
.chips-l { font-size: 11px; color: var(--muted); margin-right: 2px; align-self: center; }
.titem { display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left; border: 0; background: none; padding: 3px 6px; border-radius: 5px; }
.titem:hover { background: #f0f5fb; }
.titem.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.titem .tn { flex: none; min-width: 92px; font-size: 12px; white-space: nowrap; }
/* 本体のすぐ下に並べたテキストテーブル */
.titem.sub { padding-left: 22px !important; }
.titem.sub .tn { min-width: 80px; color: #4a5a6c; }
.tt-chip { display: inline-block; font-size: 9px; line-height: 13px; padding: 0 3px; border-radius: 3px; border: 1px solid #b9c5d3; color: #5b6b7d; margin-right: 4px; vertical-align: middle; }
/* 検索欄と種類のチップは一覧をたどっても上に残す */
.tfind { position: sticky; top: -10px; z-index: 2; background: #fff; margin: -10px -12px 0; padding: 10px 12px 4px; border-bottom: 1px solid var(--line-soft, #e5e9ee); }
.titem .tj { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titem .tc { flex: none; font-size: 11px; color: var(--muted); }

/* ---------- カード・フォーム ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.form { display: grid; grid-template-columns: 110px minmax(160px, 300px) minmax(0, 1fr); gap: 8px 10px; align-items: center; }
.form .fl { text-align: right; color: var(--muted); white-space: nowrap; }
.inpgroup { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.inpgroup .inp { flex: 1; min-width: 0; }
.form > .inp { width: 100%; }
.form .num-in { width: 120px; }
.desc { min-width: 0; }
.desc-t { font-weight: 600; }
.hint { color: var(--muted); font-size: 12px; }
.chk-l { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.chk-l.disabled { color: #aab; }
.h2 { font-size: 14px; font-weight: 700; margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.start p { margin: 0 0 10px; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip.ex { padding: 3px 10px; }
.f4btn { border: 1px solid #b8c4d0; background: #fff; color: var(--accent); border-radius: 3px; height: 22px; min-width: 22px; padding: 0 4px; font-size: 12px; }
.f4btn.big { height: 28px; padding: 0 8px; white-space: nowrap; }
.f4btn:hover { background: var(--accent-soft); }
.en-chip { display: inline-block; font-size: 9px; line-height: 13px; padding: 0 3px; border-radius: 3px; border: 1px solid #c7a76b; color: #8a5a00; margin-left: 4px; vertical-align: middle; font-weight: 600; }
.fname.none { color: #9aa0a6; font-family: var(--mono); }
.keymark { display: inline-block; font-size: 10px; line-height: 15px; padding: 0 4px; border-radius: 3px; background: var(--accent); color: #fff; margin-left: 6px; vertical-align: middle; white-space: nowrap; }

/* ---------- 表(共通) ---------- */
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--grid-bg); }
table.grid th { background: var(--th); color: var(--th-text); font-weight: 600; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line-soft); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
table.grid td { padding: 3px 8px; border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); white-space: nowrap; height: 30px; vertical-align: middle; }
table.grid tbody tr:nth-child(even) td { background: var(--zebra); }
table.grid tr.is-key td.c-name, table.grid tr.is-key td.c-tech1 { color: var(--key-text); }
table.grid th.num, table.grid td.num { text-align: right; }

/* 選択基準 */
.crit-wrap { border: 1px solid var(--line); border-radius: var(--radius-sm); max-width: 100%; }
/* 見出しはページのスクロールで上に残す(横にはみ出す狭い画面だけ表の中でスクロール) */
table.crit thead th { top: -16px; z-index: 2; } /* main の上の余白(16px)の分だけ上で止める */
table.crit th { top: 0; }
table.crit .c-name { min-width: 150px; }
table.crit .c-opt, table.crit .c-add, table.crit .c-out { text-align: center; width: 1%; }
table.crit .c-low, table.crit .c-high { width: 32%; min-width: 120px; }
table.crit .c-tech1, table.crit .c-tech2 { width: 1%; }
table.crit.names-ja .c-tech1, table.crit.names-ja .c-tech2 { display: none; }
table.crit.names-tech .c-name, table.crit.names-tech .c-tech2 { display: none; }
table.crit.names-both .c-tech1 { display: none; }
table.crit tr.has-cond td { background: #f6fafe !important; }
table.crit tr.flash td { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: #fff1a8; } to { background: inherit; } }
.inpwrap { display: flex; align-items: center; gap: 2px; width: 100%; }
.inp.cell { height: 24px; flex: 1 1 auto; width: 100%; padding: 0 6px; }
.inpwrap .f4btn { visibility: hidden; flex: none; }
tr:hover .inpwrap .f4btn, .inpwrap:focus-within .f4btn { visibility: visible; }
.optbtn { width: 34px; height: 24px; border: 1px solid var(--btn-line); border-radius: var(--radius-sm); color: var(--accent); background: var(--btn-bg); font-size: 12px; padding: 0; white-space: nowrap; }
.optbtn.auto { color: #8aa9c8; border-color: #b8cde2; }
.optbtn.excl { color: var(--err); border-color: var(--err); background: #fff5f5; }
.optbtn:hover { background: var(--accent-soft); }
.addbtn { min-width: 30px; height: 24px; padding: 0 6px; border: 1px solid var(--btn-line); border-radius: var(--radius-sm); color: var(--accent); background: var(--btn-bg); font-size: 12px; white-space: nowrap; }
.addbtn.on { background: var(--accent-soft); font-weight: 700; }
.addbtn:hover { background: #d1e5f8; }

/* ---------- 一覧 ---------- */
.info { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; margin-bottom: 10px; color: var(--muted); flex: none; }
.info b { color: var(--text); }
.warnchip { background: #fff4e0; color: var(--warn); border: 1px solid #f0c27a; border-radius: 10px; padding: 0 8px; font-size: 12px; }
.viewinfo { color: var(--accent); font-weight: 600; }
.learnbar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 10px; border: 1px solid var(--learn-line); background: var(--learn-bg); border-radius: 6px; color: var(--learn); }
.alvbar { flex: none; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 8px; background: var(--toolbar); border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; }
.card.flush > .alvbar { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.filterchips { flex: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 5px 8px; background: #fffbea; border: 1px solid var(--line); border-bottom: 0; }
.fchip { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid #e3c86b; border-radius: 12px; padding: 0 2px 0 8px; font-size: 12px; }
.fchip-x { border: 0; background: none; color: var(--muted); width: 20px; height: 20px; border-radius: 10px; padding: 0; }
.fchip-x:hover { background: #f3e3a8; }
.grid-host { flex: 1 1 auto; min-height: 260px; border: 1px solid var(--line); border-radius: 0 0 6px 6px; background: #fff; position: relative; overflow: hidden; display: flex; }

/* 仮想化した表 */
.vg { flex: 1 1 auto; overflow: auto; position: relative; outline: none; background: #fff; overscroll-behavior: contain; }
.vg:focus-visible { box-shadow: inset 0 0 0 2px rgba(10,110,209,.35); }
.vg-in { position: relative; min-width: 100%; }
.vg-head { position: sticky; top: 0; z-index: 3; display: flex; height: 34px; background: var(--th); border-bottom: 1px solid var(--line); }
.vg-body { position: relative; }
.vg-rows { position: absolute; left: 0; top: 0; }
.vg-foot { position: sticky; bottom: 0; z-index: 3; background: #f4f8fc; border-top: 2px solid #9fb9d6; }
.vr { display: flex; height: 28px; }
.vgap { flex: none; height: 1px; }
.vc { flex: none; height: 100%; padding: 0 8px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; overflow: hidden; white-space: nowrap; background: #fff; font-family: var(--mono); font-size: 12px; position: relative; }
.vr.odd .vc { background: var(--zebra); }
.vc.num { justify-content: flex-end; }
.vc .vt { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.vc.fix { position: sticky; z-index: 2; }
.vc.key { background: var(--key-bg) !important; color: var(--key-text); font-weight: 600; }
.vc.fix.key { box-shadow: inset -1px 0 0 #c6dcf2; }
.vc.textcol { color: #4a3b00; }
.vr.sel .vc { background: var(--sel-bg) !important; }
.vr.sel .vc.key { background: #f7e9a9 !important; }
.vc.cur { box-shadow: inset 0 0 0 2px var(--accent) !important; }
.vc.vh { height: 34px; font-family: var(--font); font-size: 13px; font-weight: 600; background: var(--th); color: var(--th-text); cursor: pointer; border-bottom: 0; user-select: none; gap: 3px; }
.vc.vh:hover { background: #e6ebf0; }
.vc.vh.key { background: #d6e7f8 !important; color: var(--key-text); }
.vc.vh.cur { box-shadow: inset 0 -3px 0 var(--accent) !important; }
.vh-l { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.vh-l .none { color: #9aa0a6; }
.vh-ind { flex: none; font-size: 10px; color: var(--accent); }
.rz { position: absolute; right: 0; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 4; }
.rz:hover { background: rgba(10,110,209,.25); }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none !important; }
.vr.total .vc { background: #f4f8fc !important; font-weight: 700; color: #0a3e78; border-bottom-color: #dfe8f1; }
.vg-empty { position: absolute; left: 0; right: 0; top: 60px; text-align: center; color: var(--muted); pointer-events: none; }
.jmp { flex: none; margin-left: auto; border: 1px solid var(--learn-line); background: var(--learn-bg); color: var(--learn); font-family: "Segoe UI Symbol", var(--font); font-weight: 700; font-size: 12px; line-height: 16px; height: 18px; min-width: 20px; padding: 0 3px; border-radius: 9px; opacity: .7; }
.vc.has-jmp .vt { padding-right: 4px; }
.vr:hover .jmp, .vr.sel .jmp, .jmp:focus { opacity: 1; }
.jmp:hover { background: var(--learn); color: #fff; }
.jmp.inline { opacity: 1; margin-left: 10px; padding: 0 8px; font-weight: 600; }
.nowrap { white-space: nowrap; }

/* 詳細 */
table.detail .c-val { min-width: 160px; }
table.detail .c-desc { white-space: normal; min-width: 160px; }
table.detail.names-ja .c-tech1, table.detail.names-ja .c-tech2 { display: none; }
table.detail.names-tech .c-name, table.detail.names-tech .c-tech2 { display: none; }
table.detail.names-both .c-tech1 { display: none; }
table.detail tr.is-key td { background: var(--key-bg) !important; }
table.detail tr.is-text td { background: #fffbea !important; }
table.detail td.c-val { font-family: var(--mono); }
.se16n-detail > .alvbar { border-radius: 6px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }

/* ---------- SE11 ---------- */
.se11-radios { display: grid; grid-template-columns: 150px minmax(180px, 320px); gap: 10px 14px; align-items: center; margin: 6px 0 18px; }
.rad { display: inline-flex; align-items: center; gap: 6px; }
.rad.disabled { color: #9aa0a6; }
.se11-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.se11-btns .btn { min-width: 110px; justify-content: center; }
.se11-head { margin-bottom: 0; border-radius: 6px 6px 0 0; }
.desc-box { display: flex; align-items: center; color: var(--text) !important; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border: 1px solid var(--line); border-top: 0; background: #fff; padding: 0 12px; margin-bottom: 14px; border-radius: 0 0 6px 6px; }
.tab { border: 0; background: none; padding: 9px 12px 7px; border-bottom: 3px solid transparent; color: var(--text); white-space: nowrap; }
.tab:hover { color: var(--accent); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.kvs { grid-template-columns: 230px minmax(0, 1fr); }
.kv-v { min-height: 28px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.codebox { display: inline-block; min-width: 24px; text-align: center; border: 1px solid var(--line); background: var(--ro); border-radius: 3px; padding: 0 6px; }
.pagenote { display: inline-flex; align-items: center; gap: 6px; color: var(--learn); }
.tablewrap { overflow: auto; max-height: calc(100vh - 290px); min-height: 200px; }
.cb { display: inline-block; width: 15px; height: 15px; border: 1px solid #b9c0c7; border-radius: 3px; background: #fff; color: var(--accent); font-size: 11px; line-height: 13px; text-align: center; font-weight: 700; vertical-align: middle; }
.cb.on { border-color: var(--accent); }
.cbbtn { width: 18px; height: 18px; border: 1px solid var(--accent); border-radius: 3px; background: #fff; color: var(--accent); font-size: 11px; line-height: 14px; padding: 0; font-weight: 700; }
.cbbtn:hover { background: var(--accent-soft); }
td.c-chk { text-align: center; width: 1%; }
.linkbtn { border: 0; background: none; color: var(--accent); text-decoration: underline; padding: 0; }
.linkbtn:hover { color: var(--accent-dark); }
table.grid tr.inc-row td { background: #f3f6f9 !important; color: #3c5a78; cursor: pointer; }
table.grid tr.inc-row:hover td { background: #e8eff6 !important; }
.inc-tog { border: 0; background: none; color: var(--accent); width: 16px; padding: 0; }
.incname { font-weight: 600; }
table.grid tr.is-ref td { background: #fbfdf3 !important; }
table.se11-fields td:last-child { white-space: normal; min-width: 160px; }
table.se11-help td.c-src { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
table.se11-curr td:last-child { white-space: normal; min-width: 160px; }
table.se11-fields td, table.se11-help td, table.se11-curr td { padding: 3px 6px; font-size: 12px; }
table.se11-fields td.mono, table.se11-help td.mono, table.se11-curr td.mono { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
table.se11-fields th, table.se11-help th, table.se11-curr th { padding: 6px 6px; }

/* このページについて */
.about-sec p, .about-sec ul { margin: 0 0 8px; }
.about-sec li { margin-bottom: 4px; }
table.grid.compact td { height: auto; padding: 4px 8px; white-space: normal; }
table.grid.compact td:first-child { white-space: nowrap; width: 1%; }
.errcard { border-color: #e6a0a0; background: #fff8f8; }

/* ---------- ダイアログ ---------- */
.overlay { position: fixed; inset: 0; background: rgba(30, 40, 50, .38); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: #fff; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.25); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.dialog.wide { width: min(860px, 100%); }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-x { border: 0; background: none; color: var(--accent); font-size: 16px; width: 30px; height: 30px; border-radius: 4px; }
.dlg-x:hover { background: var(--accent-soft); }
.dlg-body { padding: 12px 16px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.dlg-body p { margin: 0 0 8px; }
.dlg-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--line); }
.dlg-msg { font-size: 12px; min-width: 0; }
.dlg-msg.err { color: var(--err); font-weight: 600; }
.dlg-msg.ok { color: var(--ok); }
.dlg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.dlg-sub { font-weight: 700; margin: 10px 0 6px; }
.lbl { color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.pick-wrap { max-height: min(52vh, 420px); overflow: auto; border: 1px solid var(--line); border-radius: 4px; }
table.pick td { cursor: pointer; height: 28px; }
table.pick tr:hover td { background: #f0f5fb; }
table.pick tr.cur td { background: var(--accent-soft) !important; }
.pick-empty { padding: 16px; color: var(--muted); text-align: center; }
.opt-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.opt-item { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); border-radius: 5px; background: #fff; padding: 6px 10px; min-height: 36px; }
.opt-item:hover, .opt-item:focus { border-color: var(--accent); background: var(--accent-soft); }
.opt-item.on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.opt-sym { flex: none; width: 36px; font-family: var(--mono); font-weight: 700; color: var(--accent); text-align: center; }
.opt-ja { min-width: 0; }
.multi-wrap { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 4px; }
table.multi td { height: 32px; padding: 2px 6px; }
table.multi .c-opt, table.multi .c-del { width: 1%; text-align: center; }
.iconbtn { border: 1px solid transparent; background: none; color: var(--muted); width: 24px; height: 24px; border-radius: 4px; padding: 0; }
.iconbtn:hover:not(:disabled) { border-color: var(--line); background: #f3f3f3; color: var(--text); }
.iconbtn:disabled { opacity: .3; }
.learn-note { display: inline-flex; gap: 6px; align-items: center; color: var(--learn); font-size: 12px; flex: 1 1 320px; }
.chk-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow: auto; }
.chk-row { display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.lay-list { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 4px; }
.lay-row { display: flex; align-items: center; gap: 4px; padding: 3px 8px; border-bottom: 1px solid var(--line-soft); }
.lay-row.is-key { background: var(--key-bg); }
.flt-cur { display: flex; flex-direction: column; gap: 4px; }
.flt-item { display: flex; align-items: center; gap: 6px; background: #fffbea; border: 1px solid #efe0a0; border-radius: 4px; padding: 2px 6px; }
.filter-in .inpwrap { width: auto; flex: 1 1 180px; }
.filter-in .inpwrap .f4btn { visibility: visible; }

/* ツールチップ */
.tooltip { position: fixed; z-index: 100; max-width: min(400px, calc(100vw - 8px)); box-sizing: border-box; display: flex; gap: 6px; align-items: flex-start; pointer-events: none; font-size: 12px; line-height: 1.5; }
.tooltip .hakase { width: 36px; height: 36px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.tip-bubble { position: relative; background: #263545; color: #fff; padding: 6px 10px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.2); min-width: 0; }
.tip-bubble::before { content: ""; position: absolute; left: -6px; top: 12px; border: 6px solid transparent; border-left: 0; border-right-color: #263545; }
.tip-l1 { font-weight: 700; }
.tip-l2 { opacity: .9; }
.tip-hk { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.25); max-width: 340px; overflow-wrap: anywhere; line-height: 1.55; }

/* ---------- ステータスバー ---------- */
.status { flex: none; display: flex; align-items: center; gap: 12px; min-height: 30px; padding: 4px 20px; background: var(--toolbar); border-top: 1px solid var(--line); font-size: 12px; }
.status-msg { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--text); }
.status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 8px; font-size: 10px; font-weight: 700; color: #fff; background: var(--muted); }
.status-msg.ok .status-ico { background: var(--ok); }
.status-msg.warn .status-ico { background: #d08a00; }
.status-msg.err .status-ico { background: var(--err); }
.status-msg.err .status-text { color: var(--err); font-weight: 600; }
.status-msg.warn .status-text { color: var(--warn); }
.status-keys { flex: none; color: var(--muted); white-space: nowrap; }
.status-msg .btn.undo { height: 22px; margin-left: 6px; flex: none; }

/* ---------- 狭い画面 ---------- */
@media (max-width: 1100px) {
  .status-keys { display: none; }
}
@media (max-width: 900px) {
  .shell { padding: 6px 12px; gap: 8px; }
  .shell-title { font-size: 14px; flex: 1 1 140px; }
  .shell-right { margin-left: 0; width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .toolbar { padding: 6px 12px; }
  .tb-settings { margin-left: 0; }
  .main { padding: 12px; }
  .panel.open { position: absolute; top: 0; bottom: 0; z-index: 20; width: min(300px, 86vw) !important; box-shadow: 0 0 24px rgba(0,0,0,.25); }
  .panel.left.open { left: 0; }
  .panel.right.open { right: 0; }
  .panel.collapsed { width: 26px; }
  .crit-wrap { overflow-x: auto; }
  table.crit thead th { top: 0; }
  .form { grid-template-columns: 96px minmax(0, 1fr); }
  .form:not(.kvs) > :nth-child(3n) { grid-column: 2; }
  .toolbar .sep { display: none; }
  .kvs { grid-template-columns: 1fr; }
  .se11-radios { grid-template-columns: 1fr; }
  .opt-list { grid-template-columns: 1fr; }
  .status { padding: 4px 12px; }
  .status-text { white-space: normal; }
}
table.crit tr.is-client td { color: var(--muted); background: #f6f6f6 !important; }
@media (max-width: 600px) {
  .form { grid-template-columns: 1fr; gap: 4px; }
  .form:not(.kvs) > :nth-child(3n) { grid-column: auto; }
  .form .fl { text-align: left; margin-top: 6px; }
}
/* 学習用の注記(catalog の note) */
.notebox { display: flex; gap: 8px; align-items: center; padding: 6px 10px; margin: 0 0 14px; border: 1px solid var(--point-line); background: var(--point-bg); border-radius: 6px; color: var(--point-text); line-height: 1.6; }
.note-l { flex: none; font-weight: 700; }
.notebox .linkbtn { color: var(--accent); }
.tech-small { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-left: 4px; }
/* 操作の案内(博士が黒板を指す) */
.guide { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.guide-b { min-width: 0; }
.guide-b > :last-child, .tipbox p:last-child { margin-bottom: 0 !important; }
.panel-rail .hakase { width: 24px; height: 24px; }
.codeblock { font-family: var(--mono); font-size: 12px; background: #f4f6f8; border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; overflow-x: auto; white-space: pre; margin: 0 0 8px; }
.seg-group { display: inline-flex; align-items: center; gap: 6px; }
