/* 間取り作成 — UI スタイル */
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  font-family: "Yu Gothic UI", "Meiryo", "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 13px; color: #24292f; background: #eef0f3;
  -webkit-user-select: none; user-select: none;
}
body { display: flex; flex-direction: column; }

/* ---------- 上部バー ---------- */
#topbar {
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
  padding: 4px 12px; min-height: 46px; flex: 0 0 auto;
  background: #2f3a4a; color: #fff;
  border-bottom: 1px solid #1f2733;
}
#topbar .brand { font-weight: 700; font-size: 15px; letter-spacing: .04em; margin-right: 6px; white-space: nowrap; }
#topbar .brand .ver { font-weight: 400; font-size: 10px; color: #b9c3d3; margin-left: 4px; }
.tb-group { display: flex; align-items: center; gap: 6px; }
.tb-group.right { margin-left: auto; }
button.tb {
  background: #43526a; color: #fff; border: 1px solid #55657f;
  border-radius: 4px; padding: 5px 11px; font-size: 12px; cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
button.tb:hover { background: #55657f; }
button.tb:active { background: #3a4759; }
button.tb.primary { background: #1f6feb; border-color: #1f6feb; }
button.tb.primary:hover { background: #3b84f5; }
button.tb:disabled { opacity: .4; cursor: default; }
button.tb.on { background: #fff; color: #2f3a4a; border-color: #fff; font-weight: 700; }
.chk { display: flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid #55657f; border-radius: 4px; overflow: hidden; }
.seg button {
  background: #43526a; color: #c6cedb; border: none; padding: 5px 9px; font-size: 12px;
  cursor: pointer; font-family: inherit;
}
.seg button + button { border-left: 1px solid #55657f; }
.seg button.on { background: #1f6feb; color: #fff; font-weight: 700; }

/* 文字のその場入力 */
#text-edit {
  position: absolute; z-index: 5; min-width: 140px; padding: 4px 8px; font-size: 14px;
  border: 2px solid #1f6feb; border-radius: 3px; background: #fff; font-family: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,.25); transform: translate(-50%, -50%);
}

/* 建具パレットの幅選択 */
.wgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 4px 7px 6px; }
.wgrid button {
  padding: 4px 0; font-size: 11px; cursor: pointer; font-family: inherit;
  background: #fff; border: 1px solid #c9ced8; border-radius: 3px; color: #24292f;
}
.wgrid button.on { background: #1f6feb; border-color: #1f6feb; color: #fff; font-weight: 700; }
.wgrid input {
  grid-column: span 3; padding: 4px 6px; font-size: 11px; border: 1px solid #c9ced8;
  border-radius: 3px; font-family: inherit;
}
.chk input { margin: 0; }

/* ---------- 作業領域 ---------- */
#workspace { flex: 1 1 auto; display: flex; min-height: 0; }

/* 左ツールバー */
#toolbar {
  flex: 0 0 176px; background: #f7f8fa; border-right: 1px solid #d5d9e0;
  display: flex; flex-direction: column; min-height: 0;
}
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 8px; }
button.mode {
  padding: 8px 2px; font-size: 12px; cursor: pointer; font-family: inherit;
  background: #fff; border: 1px solid #c9ced8; border-radius: 4px; color: #333;
}
button.mode:hover { background: #eef3fb; }
button.mode.on { background: #1f6feb; border-color: #1f6feb; color: #fff; font-weight: 700; }
button.mode[data-mode=product] { grid-column: span 2; background: #fff7e6; border-color: #e6c27a; }
button.mode[data-mode=product].on { background: #d97706; border-color: #d97706; }
button.mode[data-mode=elec] { background: #eef4ff; border-color: #9db7ea; }
button.mode[data-mode=elec].on { background: #1d4ed8; border-color: #1d4ed8; }
button.mode[data-mode=select] { grid-column: span 2; }
.pal-item canvas.eicon { width: 22px; height: 22px; flex: 0 0 auto; background: #fff; border: 1px solid #dfe3ea; border-radius: 3px; }

.palette-wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.palette-title {
  font-size: 11px; color: #5b6472; padding: 6px 10px 4px;
  border-top: 1px solid #e2e5ea; background: #eff1f5;
}
.palette { flex: 1 1 auto; overflow-y: auto; padding: 6px; }
.pal-item {
  display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 5px 7px; margin-bottom: 3px; border-radius: 4px; cursor: pointer;
  border: 1px solid transparent; background: transparent; font-size: 12px;
  font-family: inherit; text-align: left; color: #24292f;
}
.pal-item:hover { background: #e9edf4; }
.pal-item.on { background: #dbe8fd; border-color: #1f6feb; font-weight: 700; }
.swatch { width: 15px; height: 15px; border: 1px solid #98a0ad; border-radius: 2px; flex: 0 0 auto; }
.pal-sub { color: #7a8494; font-size: 11px; margin-left: auto; }
.pal-head { font-size: 11px; color: #7a8494; padding: 7px 7px 3px; border-top: 1px solid #e2e5ea; margin-top: 4px; }

/* 中央キャンバス */
#stage { flex: 1 1 auto; position: relative; min-width: 0; background: #e9ebef; }
#canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
#floortabs {
  position: absolute; left: 10px; top: 10px; display: flex; gap: 4px; align-items: center;
  background: rgba(255,255,255,.92); padding: 4px; border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.ftab {
  padding: 4px 12px; font-size: 12px; border: 1px solid #c9ced8; background: #fff;
  border-radius: 4px; cursor: pointer; font-family: inherit;
}
.ftab.on { background: #2f3a4a; color: #fff; border-color: #2f3a4a; font-weight: 700; }
.ftab.mini { padding: 4px 7px; color: #5b6472; }
#hint {
  position: absolute; left: 10px; bottom: 10px; font-size: 11px; color: #4a5361;
  background: rgba(255,255,255,.92); padding: 5px 9px; border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15); max-width: 70%; line-height: 1.45; z-index: 8;
}
#hint.flash { background: #1f6feb; color: #fff; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
#hint.flash.warn { background: #b42318; }
#hint:empty { display: none; }

/* 説明カード（UI.explain）：画面上部中央。「わかった」「もう表示しない」 */
#gexplain {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 560px; max-width: 92%;
  background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 10px 14px; font-size: 12.5px; line-height: 1.55; color: #3b2f0b;
  box-shadow: 0 2px 10px rgba(0,0,0,.15); z-index: 9;
}
#gexplain b { display: block; font-size: 13px; margin-bottom: 3px; }
#gexplain .ex-btns { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }
#gexplain button { font-family: inherit; font-size: 12px; padding: 5px 12px; border-radius: 6px; border: 1px solid #d6b65a; background: #fff; color: #3b2f0b; cursor: pointer; }
#gexplain button.primary { background: #d97706; border-color: #d97706; color: #fff; font-weight: 700; }
body.genchou #gexplain { top: 70px; width: 640px; font-size: 14px; padding: 12px 16px; }
body.genchou #gexplain b { font-size: 15px; }
body.genchou #gexplain button { font-size: 14px; min-height: 40px; padding: 0 16px; }

/* 右インスペクタ */
#inspector {
  flex: 0 0 236px; background: #f7f8fa; border-left: 1px solid #d5d9e0;
  overflow-y: auto; padding-bottom: 20px;
}
#inspector section { padding: 9px 11px; border-bottom: 1px solid #e2e5ea; }
#inspector h3 { margin: 0 0 7px; font-size: 12px; color: #2f3a4a; letter-spacing: .05em; }
#inspector label { display: block; font-size: 11px; color: #5b6472; margin-bottom: 6px; }
#inspector input[type=text], #inspector select, #inspector input[type=number] {
  display: block; width: 100%; margin-top: 2px; padding: 4px 6px; font-size: 12px;
  border: 1px solid #c9ced8; border-radius: 3px; font-family: inherit; background: #fff;
  color: #24292f;
}
.muted { color: #8a93a2; font-size: 11px; }
.row { display: flex; gap: 6px; margin-top: 6px; }
.row button {
  flex: 1; padding: 5px; font-size: 11px; cursor: pointer; font-family: inherit;
  border: 1px solid #c9ced8; border-radius: 3px; background: #fff; color: #24292f;
}
.row button:hover { background: #eef3fb; }
.row button.danger { color: #b42318; border-color: #e3b3ae; }
.row button.danger:hover { background: #fdeceb; }

table.area { width: 100%; border-collapse: collapse; font-size: 11px; }
table.area th, table.area td { padding: 2px 3px; border-bottom: 1px solid #e7e9ee; }
table.area th { text-align: left; color: #5b6472; font-weight: 400; }
table.area td.n { text-align: right; font-variant-numeric: tabular-nums; }
table.area tr.total td, table.area tr.total th { font-weight: 700; border-top: 1px solid #b9bfc9; border-bottom: none; }
table.area tr.fl th { padding-top: 7px; color: #2f3a4a; font-weight: 700; }

/* ---------- 3D ビュー ---------- */
#v3d { position: absolute; inset: 0; background: #fff; z-index: 8; display: flex; flex-direction: column; }
.v3d-bar {
  height: 44px; flex: 0 0 44px; display: flex; align-items: center; gap: 14px; padding: 0 12px;
  background: #f7f8fa; border-bottom: 1px solid #d5d9e0; font-size: 12px; color: #2f3a4a;
}
.v3d-bar .v3d-title { font-weight: 700; }
.v3d-bar label { display: flex; align-items: center; gap: 5px; }
.v3d-bar input[type=range] { width: 110px; }
.v3d-bar select { font-family: inherit; font-size: 12px; }
.v3d-bar button {
  padding: 5px 11px; font-size: 12px; cursor: pointer; font-family: inherit;
  border: 1px solid #c9ced8; border-radius: 4px; background: #fff;
}
.v3d-bar button:hover { background: #eef3fb; }
#v3d canvas { display: block; width: 100%; cursor: grab; }
.v3d-hint {
  position: absolute; left: 10px; bottom: 10px; font-size: 11px; color: #4a5361;
  background: rgba(255,255,255,.92); padding: 5px 9px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
/* ---------- 室内パース ---------- */
#v3dp { position: absolute; inset: 0; background: #fff; z-index: 9; display: flex; flex-direction: column; }
.v3dp-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
.v3dp-view { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; }
#v3dp-gl { display: block; cursor: grab; }
#v3dp-gl.pick { cursor: copy; }
.v3dp-pal { flex: 0 0 216px; border-left: 1px solid #d5d9e0; background: #f7f8fa; overflow-y: auto; display: flex; flex-direction: column; }
.v3dp-pal[hidden] { display: none; }
.v3dp-tip {
  position: absolute; pointer-events: none; z-index: 3; font-size: 11px; color: #fff;
  background: rgba(31,111,235,.92); padding: 3px 8px; border-radius: 3px; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.v3dp-toast {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 4; font-size: 12px; color: #fff;
  background: rgba(36,41,47,.9); padding: 6px 14px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.3); pointer-events: none;
}
.v3dp-toast.ng { background: rgba(180,35,24,.92); }
.v3dp-mini {
  position: absolute; right: 10px; bottom: 10px; background: rgba(255,255,255,.95);
  border: 1px solid #c9ced8; border-radius: 6px; padding: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.v3dp-mini canvas { display: block; cursor: crosshair; }
.v3dp-mini-hint { font-size: 10px; color: #5b6472; text-align: center; margin-top: 3px; }

/* ---------- 商品マスタ ---------- */
.modal.wide { width: 640px; max-height: 84vh; }
.modal.xwide { width: 1040px; max-width: 96vw; }
.pm-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.pm-tabs button { padding: 4px 9px; font-size: 11px; cursor: pointer; font-family: inherit; border: 1px solid #c9ced8; border-radius: 12px; background: #fff; }
.pm-tabs button.on { background: #1f6feb; border-color: #1f6feb; color: #fff; font-weight: 700; }
.pm-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid #eef0f3; }
.pm-row .sw { width: 38px; height: 38px; border-radius: 4px; border: 1px solid #b9bfc9; background-size: cover; background-position: center; flex: 0 0 auto; }
.pm-row .nm { flex: 1; font-size: 12px; }
.pm-row .nm small { display: block; color: #7a8494; font-size: 10px; }
.pm-row button { font-size: 11px; padding: 3px 9px; cursor: pointer; border: 1px solid #c9ced8; background: #fff; border-radius: 3px; font-family: inherit; }
.pm-row button.danger { color: #b42318; border-color: #e3b3ae; }
.pm-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 10px; background: #f4f6f9; border-radius: 5px; margin-top: 8px; }
.pm-form label { font-size: 11px; color: #5b6472; display: block; }
.pm-form input[type=text], .pm-form input[type=number], .pm-form select { display: block; width: 100%; margin-top: 2px; padding: 4px 6px; font-size: 12px; border: 1px solid #c9ced8; border-radius: 3px; font-family: inherit; background: #fff; }
.pm-form input[type=color] { display: block; width: 100%; height: 28px; margin-top: 2px; padding: 0; border: 1px solid #c9ced8; border-radius: 3px; background: #fff; }
.pm-form .full { grid-column: span 2; }
.pm-form .thumb { width: 100%; height: 90px; border: 1px dashed #b9bfc9; border-radius: 4px; background: #fff center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #7a8494; }
.pm-form .acts { grid-column: span 2; display: flex; gap: 6px; justify-content: flex-end; }
.pm-form .acts button { padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit; border: 1px solid #c9ced8; border-radius: 3px; background: #fff; }
.pm-form .acts button.primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.pm-tools { display: flex; gap: 6px; margin-top: 10px; }
.pm-tools button { font-size: 11px; padding: 4px 10px; cursor: pointer; border: 1px solid #c9ced8; background: #fff; border-radius: 3px; font-family: inherit; }
.pm-tools button.on { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.pm-form.pm-bulk { background: #eef4fb; border: 1px solid #c9dcf3; }
.pm-form input[type=number]:disabled { background: #eef0f3; color: #7a8494; }
.insp-sw { display: inline-block; width: 12px; height: 12px; border: 1px solid #98a0ad; border-radius: 2px; vertical-align: -2px; margin-right: 4px; }
/* 右パネルの商品欄: 見本 + プルダウン */
.prod-field { display: flex; align-items: center; gap: 6px; }
.prod-field .pp-sw { width: 26px; height: 26px; flex: 0 0 auto; }
.prod-field select { flex: 1 1 auto; min-width: 0; }
.prod-field .prod-pick {
  flex: 1 1 auto; min-width: 0; text-align: left; padding: 4px 6px; font-size: 12px; cursor: pointer;
  border: 1px solid #c9ced8; border-radius: 3px; background: #fff; font-family: inherit; color: #24292f;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prod-field .prod-pick:hover { background: #eef3fb; }
.pp-picker .pp-list { max-height: 56vh; overflow-y: auto; }

/* 商品の検索・絞り込み（パレット / 選択ダイアログ / 商品マスタ） */
.pp-search { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 4px 6px 2px; }
.pp-search input { flex: 1 1 90px; min-width: 0; padding: 3px 6px; font-size: 11px; border: 1px solid #c9ced8; border-radius: 3px; font-family: inherit; }
.pp-search select { max-width: 100%; font-size: 11px; padding: 2px 4px; border: 1px solid #c9ced8; border-radius: 3px; font-family: inherit; background: #fff; }
.pp-count { font-size: 10px; color: #7a8494; margin-left: auto; white-space: nowrap; }
.pp-more { width: 100%; padding: 5px; font-size: 11px; cursor: pointer; border: 1px dashed #b9bfc9; border-radius: 3px; background: #fff; font-family: inherit; color: #2f3a4a; margin-top: 3px; }
.pp-more:hover { background: #eef3fb; }
.pm-search { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.pm-search input { flex: 1 1 160px; min-width: 0; padding: 4px 8px; font-size: 12px; border: 1px solid #c9ced8; border-radius: 3px; font-family: inherit; }
.pm-search select { font-size: 12px; padding: 3px 6px; border: 1px solid #c9ced8; border-radius: 3px; font-family: inherit; background: #fff; }
.pm-search .cnt { font-size: 11px; color: #5b6472; white-space: nowrap; }
.pm-packs { margin-top: 12px; padding: 10px; background: #f4f6f9; border-radius: 5px; }
.pm-packs .hd { font-size: 11px; color: #5b6472; margin-bottom: 6px; }
.pk-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-top: 1px solid #e2e5ea; }
.pk-row .nm { flex: 1; font-size: 12px; }
.pk-row .nm small { display: block; color: #7a8494; font-size: 10px; }
.pk-row .nm .done { display: inline-block; margin-top: 2px; font-size: 10px; color: #1f6feb; background: #dbe8fd; border-radius: 8px; padding: 1px 7px; }
.pk-row button { font-size: 11px; padding: 4px 10px; cursor: pointer; border: 1px solid #c9ced8; background: #fff; border-radius: 3px; font-family: inherit; white-space: nowrap; }
.pk-row button.primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.pk-row button:disabled { opacity: .6; cursor: default; }
.pm-search button.danger { font-size: 11px; padding: 3px 9px; cursor: pointer; border: 1px solid #e3b3ae; color: #b42318; background: #fff; border-radius: 3px; font-family: inherit; }

/* ---------- 商品を貼るパレット（2D 左パレット・室内パース右側で共通） ---------- */
.pp-tabs { display: flex; flex-wrap: wrap; gap: 3px; padding: 6px 6px 2px; }
.pp-tabs button { padding: 3px 7px; font-size: 11px; cursor: pointer; font-family: inherit; border: 1px solid #c9ced8; border-radius: 10px; background: #fff; color: #2f3a4a; }
.pp-tabs button.on { background: #1f6feb; border-color: #1f6feb; color: #fff; font-weight: 700; }
.pp-where { font-size: 10.5px; color: #5b6472; padding: 4px 8px 2px; }
.pp-list { padding: 4px 6px; }
.pp-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 6px; margin-bottom: 3px;
  border: 1px solid transparent; border-radius: 4px; background: #fff; cursor: grab; text-align: left;
  font-family: inherit; font-size: 12px; color: #24292f;
}
.pp-item:hover { background: #e9edf4; }
.pp-item.on { background: #dbe8fd; border-color: #1f6feb; font-weight: 700; }
.pp-item:active { cursor: grabbing; }
.pp-sw { width: 30px; height: 30px; border: 1px solid #98a0ad; border-radius: 3px; flex: 0 0 auto; background: #eee; }
.pp-nm { min-width: 0; line-height: 1.25; overflow: hidden; }
.pp-nm small { display: block; color: #7a8494; font-size: 10px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-empty { font-size: 11px; color: #7a8494; padding: 8px; }
.pp-foot { padding: 6px; border-top: 1px solid #e2e5ea; }
.pp-foot button { width: 100%; padding: 5px; font-size: 11px; cursor: pointer; font-family: inherit; border: 1px solid #c9ced8; border-radius: 3px; background: #fff; }
.pp-hint { font-size: 11px; color: #5b6472; padding: 6px 8px; line-height: 1.5; }
.pp-range { font-size: 11px; color: #3b4351; padding: 4px 8px 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; background: #fff7ed; border-bottom: 1px solid #fed7aa; }
.pp-range label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.accent-list { display: flex; flex-direction: column; gap: 4px; }
.accent-row { display: flex; align-items: center; gap: 6px; }
.accent-row .nm { flex: 0 0 62px; font-size: 11px; color: #5b6472; }
.accent-row .prod-field { flex: 1 1 auto; min-width: 0; }
.schedule td .accent { font-size: 90%; margin-top: 2px; color: #3b4351; }
#canvas.drop-ok { cursor: copy; }

/* ---------- 仕上表 ---------- */
.sch h4 { margin: 10px 0 4px; font-size: 12px; color: #2f3a4a; }
.sch table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-bottom: 6px; }
.sch th, .sch td { border: 1px solid #d5d9e0; padding: 3px 6px; text-align: left; vertical-align: top; }
.sch th { background: #f0f2f5; font-weight: 700; color: #2f3a4a; white-space: nowrap; }
.sch td.std { color: #8a93a2; }
.sch .pp-sw { width: 14px; height: 14px; display: inline-block; vertical-align: -3px; margin-right: 5px; }
.sch-tools { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.sch-tools button { padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit; border: 1px solid #c9ced8; border-radius: 3px; background: #fff; }
.sch-tools label { font-size: 11.5px; color: #2f3a4a; display: flex; align-items: center; gap: 4px; }

/* ---------- 現調（T2）：右パネルの欄・写真・現調表 ---------- */
#inspector textarea, .svy-form textarea {
  display: block; width: 100%; margin-top: 2px; padding: 4px 6px; font-size: 12px; line-height: 1.4;
  border: 1px solid #c9ced8; border-radius: 3px; font-family: inherit; background: #fff; color: #24292f; resize: vertical;
  -webkit-user-select: text; user-select: text;
}
.svy-sec { margin: 8px 0 6px; padding: 6px 8px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 4px; }
.svy-sec summary { cursor: pointer; font-size: 11.5px; font-weight: 700; color: #7c4a12; margin: -2px 0 4px; list-style: none; }
.svy-sec summary::-webkit-details-marker { display: none; }
.svy-sec summary::before { content: '▸ '; }
.svy-sec[open] summary::before { content: '▾ '; }
.svy-sec label { margin-bottom: 6px; }
.svy-form label { display: block; font-size: 11px; color: #5b6472; margin-bottom: 8px; }
.svy-form input[type=text], .svy-form select {
  display: block; width: 100%; margin-top: 2px; padding: 4px 6px; font-size: 12px;
  border: 1px solid #c9ced8; border-radius: 3px; font-family: inherit; background: #fff; color: #24292f;
}
.ph-thumbs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.ph-thumb {
  width: 62px; height: 62px; border: 1px solid #c9ced8; border-radius: 3px; background: #fff center/cover no-repeat;
  cursor: pointer; padding: 0; font-size: 10px; color: #7a8494; font-family: inherit; overflow: hidden;
}
.ph-thumb:hover { border-color: #1f6feb; }
.ph-thumb.add { font-size: 22px; color: #1f6feb; border-style: dashed; background: #fff; }
.ph-thumb.add:disabled { color: #7a8494; cursor: default; }
.ph-large { display: block; max-width: 100%; max-height: 52vh; margin: 0 auto 8px; border: 1px solid #c9ced8; border-radius: 3px; background: #f0f2f5; }
.ph-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.ph-grid .ph { margin: 0; width: 140px; }
.ph-grid .ph img { display: block; width: 140px; height: 105px; object-fit: cover; border: 1px solid #c9ced8; border-radius: 3px; background: #f0f2f5; }
.ph-grid .ph .ph-none { width: 140px; height: 105px; display: flex; align-items: center; justify-content: center; border: 1px dashed #c9ced8; border-radius: 3px; color: #7a8494; font-size: 11px; }
.ph-grid .ph figcaption { font-size: 10.5px; color: #3b4351; margin-top: 2px; line-height: 1.3; word-break: break-all; }
.sch td.blank { background: #fafbfc; }
.sch td.pre { white-space: pre-wrap; }
.sch td.n { text-align: right; white-space: nowrap; }
.sch td .ex { font-size: 90%; color: #9a6b1f; margin-bottom: 1px; }
.sch.svy th small { font-weight: 400; color: #5b6472; }
.sch.svy table.svy-t th { text-align: center; }
.sch.svy table.svy-t th:first-child { text-align: left; }
.sch.svy table.svy-t td:nth-child(3), .sch.svy table.svy-t td:nth-child(4), .sch.svy table.svy-t td:nth-child(5), .sch.svy table.svy-t td:nth-child(6), .sch.svy table.svy-t td:nth-child(7) { white-space: nowrap; }
.sch.svy table.svy-t td.n small { font-size: 9px; color: #1f6feb; margin-left: 2px; }
.sch.svy table.svy-o td, .sch.svy table.svy-e td { white-space: nowrap; }
.sch.svy table.svy-o td:last-child, .sch.svy table.svy-e td:last-child { white-space: normal; }
.sch .legend { font-size: 10.5px; color: #5b6472; margin: -3px 0 8px; }

.sample-row { padding: 9px 4px; border-bottom: 1px solid #eef0f3; display: flex; gap: 10px; align-items: center; }
.sample-row .nm { font-size: 13px; font-weight: 700; }
.sample-row .ds { font-size: 11px; color: #5b6472; margin-top: 2px; }
.sample-row .grow { flex: 1; }

/* ---------- ステータスバー ---------- */
#statusbar {
  flex: 0 0 24px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; background: #2f3a4a; color: #c6cedb; font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ---------- モーダル ---------- */
[hidden] { display: none !important; }
.modal-back {
  position: fixed; inset: 0; background: rgba(20,24,31,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal { background: #fff; border-radius: 6px; width: 420px; max-height: 76vh; display: flex; flex-direction: column; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid #e2e5ea; font-weight: 700; }
.modal-head button { margin-left: auto; border: none; background: none; font-size: 18px; cursor: pointer; color: #5b6472; line-height: 1; }
.modal-body { padding: 12px 14px; overflow-y: auto; }
.plan-row { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid #eef0f3; }
.plan-row .nm { flex: 1; font-size: 13px; }
.plan-row .dt { font-size: 11px; color: #8a93a2; }
.plan-row button { font-size: 11px; padding: 3px 9px; cursor: pointer; border: 1px solid #c9ced8; background: #fff; border-radius: 3px; font-family: inherit; }
.plan-row button.danger { color: #b42318; border-color: #e3b3ae; }

/* ---------- 現調モード（genchou.js）。iPad・指操作が前提：大きいボタン、下の帯、右（狭ければ下）の現調シート ---------- */
button.tb.genchou { background: #d97706; border-color: #d97706; font-weight: 700; }
#g-title, #g-pen, #g-free { display: none; }                         /* 現調モードのときだけ上部に今の物件名とペン／指・マス目／フリーの切替 */
body.genchou #g-pen, body.genchou #g-free { display: inline-block; background: #43526a; font-size: 12px; }
body.genchou #g-pen.on, body.genchou #g-free.on { background: #fff; color: #2f3a4a; border-color: #fff; font-weight: 700; }
body.genchou #g-title { display: inline-block; background: #fff7ed; color: #7c4a12; border-color: #fed7aa; font-weight: 700; font-size: 14px; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.tb.genchou:hover { background: #ea8a1a; }
body.genchou button.tb.genchou { background: #fff; color: #7c4a12; border-color: #fff; }
body.genchou .ghide { display: none !important; }
body.genchou #toolbar, body.genchou #inspector, body.genchou #statusbar { display: none; }
body.genchou #topbar { gap: 10px; }
body.genchou button.tb { padding: 8px 12px; font-size: 13px; }
body.genchou #canvas { touch-action: none; cursor: default; }
body.genchou #floortabs { padding: 6px; gap: 6px; }
body.genchou .ftab { padding: 10px 18px; font-size: 16px; }
body.genchou .ftab.mini { padding: 10px 14px; font-size: 18px; }
body.genchou #hint { bottom: 78px; font-size: 13px; max-width: 50%; padding: 8px 12px; }
body.genchou #hint.flash { font-size: 15px; padding: 12px 16px; border-radius: 8px; }
body.genchou.sheet-open #hint:not(.flash) { display: none; }                 /* シートを開いている間は操作説明を隠す（通知だけ出す） */
body.genchou.sheet-open #hint.flash { max-width: 50%; }
#gbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 68px; display: flex; gap: 8px; align-items: stretch;
  padding: 8px 10px; background: rgba(47,58,74,.96); z-index: 6; box-shadow: 0 -2px 8px rgba(0,0,0,.2);
}
#gbar button {
  flex: 1 1 0; min-width: 0; font-size: 16px; font-weight: 700; color: #fff; background: #43526a; border: 1px solid #55657f;
  border-radius: 8px; font-family: inherit; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px;
}
#gbar button:active { background: #3a4759; }
#gbar button.primary { background: #1f6feb; border-color: #1f6feb; flex-grow: 1.4; }
#gbar button.quiet { flex: 0 0 auto; padding: 0 14px; font-weight: 400; background: transparent; color: #c6cedb; }
#gbar button:disabled { opacity: .4; cursor: default; }
#gbar button.on { background: #fff; color: #2f3a4a; border-color: #fff; }
#gbar .pair { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
#gbar .pair button { flex: 1 1 0; font-size: 13px; font-weight: 400; border-radius: 6px; }
#gsheet {
  position: absolute; top: 0; right: 0; bottom: 68px; width: 46%; background: #fff; border-left: 1px solid #d5d9e0;
  box-shadow: -4px 0 16px rgba(0,0,0,.15); z-index: 7; display: flex; flex-direction: column;
  -webkit-user-select: text; user-select: text;
}
@media (max-width: 899px) {
  #gsheet { top: auto; left: 0; width: auto; height: 65%; border-left: none; border-top: 1px solid #d5d9e0; box-shadow: 0 -4px 16px rgba(0,0,0,.15); }
  #gbar { gap: 6px; padding: 8px 6px; }
  #gbar button { font-size: 14px; padding: 0 4px; }
  #gbar button.quiet { padding: 0 8px; }
  body.genchou.sheet-open #hint.flash { bottom: calc(65% + 8px); max-width: 80%; }   /* 下からのシートの上に出す */
}
.gs-head { flex: 0 0 auto; display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #e2e5ea; background: #f7f8fa; font-size: 18px; font-weight: 700; }
.gs-head .sub { font-size: 12px; color: #5b6472; font-weight: 400; }
.gs-head .prog { flex-basis: 100%; order: 9; font-size: 12px; font-weight: 700; color: #b45309; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 4px; padding: 3px 8px; margin-top: 2px; }
.gs-head .prog.ok { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.gs-head { flex-wrap: wrap; }
.gs-sec h4 .miss { display: inline-block; font-size: 10px; color: #fff; background: #d97706; border-radius: 3px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }
.gs-danger { margin-top: 28px; padding-top: 12px; border-top: 1px dashed #e3b3ae; text-align: right; }
.gs-del { min-height: 40px; padding: 0 14px; font-size: 13px; color: #b42318; border: 1px solid #e3b3ae; border-radius: 6px; background: #fff; font-family: inherit; cursor: pointer; }
.gs-savebtns { display: flex; flex-direction: column; gap: 8px; }
.gs-savebtns button { min-height: 48px; font-size: 15px; font-weight: 700; border-radius: 8px; border: 1px solid #c9ced8; background: #fff; color: #24292f; font-family: inherit; cursor: pointer; }
.gs-savebtns button.primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
#modal .sch.svy table.svy-t td.blank { background: #fff3cd; }   /* 画面の現調表では空欄を黄色に（入力漏れが分かるように。印刷は白のまま） */
.gs-head button.x { margin-left: auto; align-self: center; min-width: 44px; min-height: 44px; font-size: 24px; border: none; background: none; color: #5b6472; cursor: pointer; font-family: inherit; }
.gs-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 14px 24px; }
.gs-foot { flex: 0 0 auto; display: flex; gap: 8px; padding: 8px 14px; border-top: 1px solid #e2e5ea; background: #f7f8fa; }
.gs-foot button { flex: 1 1 0; min-height: 48px; font-size: 15px; font-weight: 700; border-radius: 8px; border: 1px solid #c9ced8; background: #fff; color: #24292f; font-family: inherit; cursor: pointer; }
.gs-foot button.primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.gs-sec { margin: 0 0 16px; }
.gs-sec h4 { margin: 0 0 6px; font-size: 13px; color: #7c4a12; }
.gs-sec h4 small { color: #8a93a2; font-weight: 400; margin-left: 6px; }
.gs-sub { font-size: 12px; color: #5b6472; margin: 8px 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 20px; border: 1px solid #c9ced8; background: #fff; color: #24292f;
  font-family: inherit; cursor: pointer;
}
.chips button.on { background: #1f6feb; border-color: #1f6feb; color: #fff; font-weight: 700; }
.chips button.big { min-height: 46px; font-size: 15px; }
.chips .grp { flex-basis: 100%; font-size: 11px; color: #8a93a2; margin-top: 4px; }
.gs-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; flex-wrap: wrap; }
.gs-row label { flex: 1 1 90px; min-width: 0; }
#gsheet label { display: block; font-size: 12px; color: #5b6472; margin-bottom: 8px; }
#gsheet input[type=text], #gsheet input[type=number], #gsheet select, #gsheet textarea {
  display: block; width: 100%; margin-top: 3px; padding: 9px 10px; font-size: 16px;   /* 16px 以上にすると iOS Safari がフォーカス時に拡大しない */
  border: 1px solid #c9ced8; border-radius: 6px; font-family: inherit; background: #fff; color: #24292f;
}
#gsheet textarea { resize: vertical; line-height: 1.4; }
.gs-list { display: flex; flex-direction: column; gap: 8px; }
.gs-item { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; padding: 8px; background: #f7f8fa; border: 1px solid #e2e5ea; border-radius: 6px; }
.gs-item label { flex: 1 1 80px; min-width: 0; margin-bottom: 0; }
.gs-item label.sm { flex: 0 1 76px; }
.gs-item label.wide { flex-basis: 100%; }
.gs-item button.del { flex: 0 0 auto; min-height: 42px; padding: 0 12px; font-size: 13px; color: #b42318; border: 1px solid #e3b3ae; border-radius: 6px; background: #fff; font-family: inherit; cursor: pointer; }
.gs-add { width: 100%; min-height: 44px; margin-top: 6px; font-size: 14px; border: 1px dashed #1f6feb; color: #1f6feb; border-radius: 6px; background: #fff; font-family: inherit; cursor: pointer; }
#gsheet .ph-thumb { width: 84px; height: 84px; }
#gsheet .ph-thumb.add { font-size: 30px; }
.gs-note { font-size: 12px; color: #8a93a2; margin-top: 4px; line-height: 1.4; }
.gs-empty { font-size: 12px; color: #8a93a2; padding: 6px 0; }
table.area tr.blk th { background: #eef2f7; color: #2f3a4a; font-weight: 700; font-size: 11px; padding-top: 6px; }
table.area small.meas { font-size: 9px; color: #1f6feb; border: 1px solid #1f6feb; border-radius: 3px; padding: 0 3px; margin-left: 3px; vertical-align: 1px; }

/* ---------- 印刷 ---------- */
#printArea { display: none; }
@media print {
  @page { size: A3 landscape; margin: 8mm; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  .sheet { width: 100%; font-family: "Yu Gothic UI", "Meiryo", sans-serif; color: #000; }
  .sheet .dwg { width: 100%; display: block; }
  .sheet .tblock { display: flex; align-items: flex-end; gap: 18px; border-top: 1.5px solid #000; padding-top: 5px; margin-top: 4px; }
  .sheet .tblock .t { font-size: 15pt; font-weight: 700; }
  .sheet .tblock .m { font-size: 9pt; }
  .sheet .tblock .sp { margin-left: auto; text-align: right; font-size: 9pt; }
  .sheet.brk { page-break-before: always; }
  .sheet .sch h3 { font-size: 13pt; margin: 0 0 4mm; }
  .sheet .sch h4 { font-size: 10pt; margin: 4mm 0 1.5mm; }
  .sheet .sch table { width: 100%; border-collapse: collapse; font-size: 9pt; margin-bottom: 3mm; }
  .sheet .sch th, .sheet .sch td { border: 0.3pt solid #000; padding: 1mm 2mm; text-align: left; vertical-align: top; }
  .sheet .sch th { background: #eee; }
  .sheet .sch .pp-sw { width: 4mm; height: 4mm; display: inline-block; vertical-align: -1mm; margin-right: 1.5mm; border: 0.3pt solid #000; }
  .sheet .sch td.std { color: #555; }
  .sheet .sch td .ex { color: #444; font-size: 8pt; }
  .sheet .sch td.blank { background: #fff; min-width: 18mm; }
  .sheet .sch td.pre { white-space: pre-wrap; }
  .sheet .sch.svy table.svy-t td { height: 7mm; }
  .sheet .sch .legend { font-size: 8pt; color: #000; margin: -2mm 0 3mm; }
  .sheet .ph-grid { display: flex; flex-wrap: wrap; gap: 3mm; margin: 1mm 0 3mm; }
  .sheet .ph-grid .ph { width: 62mm; margin: 0; page-break-inside: avoid; }
  .sheet .ph-grid .ph img { width: 62mm; height: 46mm; object-fit: cover; border: 0.3pt solid #000; border-radius: 0; }
  .sheet .ph-grid .ph .ph-none { width: 62mm; height: 46mm; border: 0.3pt dashed #000; }
  .sheet .ph-grid .ph figcaption { font-size: 8pt; color: #000; }
}
