/* スキャン取込 PoC。検証用の画面なので、装飾より「数字が読めること」を優先する。
   共通の色・ボタンは ../../shared/ui.css から。ここは表と3Dステージだけ。 */

.wrap { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; display: flex; flex-direction: column; gap: 16px; }
.wrap h1 { font-size: 20px; }
.wrap h2 { font-size: 15px; margin-bottom: 8px; }
.lead { color: var(--muted); margin: 0; font-size: 13px; }
.sub { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.loading, .empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.card.pad { padding: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- 表 ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.review { background: #fff8ec; }
.tbl tr.review:hover { background: #fff3de; }
.in { width: 100%; min-width: 64px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.in.num { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.chk { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; }

.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); margin-right: 4px; }
.chip.fixture { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.chip.local { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.chip.server { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.chip.edited { background: #fff4df; border-color: #f7d28f; color: #b45309; }
.chip.conf-high { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.chip.conf-medium { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.chip.conf-low { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* ---- 詳細ヘッダ ---- */
.dhead { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.dhead h1 { font-size: 19px; margin: 2px 0; }
.dhead .back { font-size: 12px; color: var(--muted); }
.dhead .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- 数字の帯 ---- */
.strip { display: flex; gap: 8px; flex-wrap: wrap; }
.strip .cell { flex: 1 1 96px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.strip .cell b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.strip .cell span { font-size: 11px; color: var(--muted); }

/* ---- タブ ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: none; background: transparent; padding: 9px 13px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.on { color: var(--accent-2); border-bottom-color: var(--accent); }
.tabbody { display: flex; flex-direction: column; gap: 14px; }

/* ---- 3D ステージ ---- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .room-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.stage { position: relative; height: min(62vh, 560px); min-height: 320px; background: #dfe3ea; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stage .scene { width: 100%; height: 100%; display: block; touch-action: none; }
.minimap-wrap { position: absolute; left: 10px; top: 10px; background: rgba(255, 255, 255, .92); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: var(--shadow); }
.minimap-wrap canvas { display: block; width: 130px; height: 153px; }
.wallinfo { display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; min-height: 42px; }
.wallinfo .big { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wallinfo .ok { color: #047857; font-weight: 700; }
.wallinfo .warn { color: #b45309; font-weight: 700; }

/* ---- 問題・判定 ---- */
.issues { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.issues li { margin: 3px 0; }
.issues li.error { color: #b91c1c; }
.issues li.warn { color: #b45309; }
.issues li b { font-family: ui-monospace, Menlo, monospace; font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-right: 4px; color: var(--muted); }
p.ok { color: #047857; font-weight: 700; margin: 0; }
p.warnline { color: #b45309; font-weight: 700; margin: 0; }
.issues li.warn.blocking { color: #b91c1c; font-weight: 600; }
p.bad { color: #b91c1c; font-weight: 700; margin: 0; }
p.notready { color: var(--muted); margin: 0; }
.verdicts { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.verdicts li { padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); font-size: 13px; }
.verdicts li.pass { background: #ecfdf5; border-color: #a7f3d0; }
.verdicts li.fail { background: #fef2f2; border-color: #fecaca; }
.verdicts li.unknown { background: var(--panel-2); }
.verdicts li b { margin-right: 4px; }
td.ok { color: #047857; }
td.warn { color: #b45309; }
td.bad { color: #b91c1c; font-weight: 700; }

.upload h2 { margin-bottom: 8px; }

/* ---- 実機検証（lab.js の「実機検証」タブ・目視オーバーレイ）---- */
.toolbar.dbg { gap: 6px; padding: 6px 0; }
.toolbar.dbg .btn.sm.on { background: var(--accent-soft); border-color: #bcd0fb; color: var(--accent-2); font-weight: 700; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.checks { list-style: none; margin: 4px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.checks li { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.checks li > span:first-child { flex: 1 1 auto; }
.seg.sm { padding: 2px; }
.seg.sm button { padding: 3px 9px; font-size: 12px; }
.verdicts li.caution { background: #fffbeb; border-color: #fde68a; }
textarea.in { width: 100%; resize: vertical; line-height: 1.5; }

/* ---- スマホ（375px 相当）---- */
@media (max-width: 720px) {
  .wrap { padding: 12px 12px 48px; gap: 12px; }
  .dhead .acts { margin-left: 0; width: 100%; }
  .dhead .acts .btn { flex: 1 1 auto; justify-content: center; }
  .stage { height: 52vh; min-height: 260px; }
  .minimap-wrap canvas { width: 96px; height: 113px; }
  .toolbar .room-tabs { margin-left: 0; width: 100%; }
  /* 表は横スクロールさせる（列を落とすと数字の突き合わせができなくなる） */
  .card.pad { padding: 12px 10px; overflow-x: auto; }
  .tbl { min-width: 560px; }
  .strip .cell { flex: 1 1 calc(50% - 8px); }
}

/* ================================================================
   管理画面（index.html / app.js。body.sp）。不動産会社の担当者がスマホでも使えること。
   375px 幅で横スクロール・ボタンの重なりが出ないように、横並びは必ず折り返す。
   ================================================================ */
body.sp { overflow-x: hidden; }
body.sp .topbar { gap: 8px; }
body.sp .topbar nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
body.sp .topbar .who { font-size: 12px; color: var(--muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.sp .card.pad { overflow-x: visible; }
body.sp .tbl { min-width: 0; }
body.sp .tblwrap .tbl { min-width: 460px; }
body.sp .tblwrap { width: 100%; overflow-x: auto; }
.wrap.narrow { max-width: 560px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.btn.big { padding: 12px 18px; font-size: 15px; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.bad { color: #b91c1c; }
.ok { color: #047857; }
.warnline { color: #b45309; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.errbox { border: 1px solid #fecaca; background: #fef2f2; border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.errbox p { margin: 4px 0 0; }
.title-in { font-size: 20px; font-weight: 800; border: 1px solid transparent; border-radius: 8px; padding: 4px 6px; background: transparent; width: 100%; min-width: 0; }
.title-in:hover:not(:disabled), .title-in:focus { border-color: var(--line); background: var(--panel); outline: none; }
.st { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #eef2f7; color: #475569; white-space: nowrap; }
.st.pub { background: #dcfce7; color: #047857; }
.st.off { background: #fee2e2; color: #b91c1c; }
.st.real { background: #1f2430; color: #fde68a; letter-spacing: .03em; }

/* 物件一覧 */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pcard .ptop { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.pcard .pname { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.pcard .psub { font-size: 12px; color: var(--muted); }

/* 手順 */
.steps { display: flex; gap: 4px; flex-wrap: wrap; }
.steps .step { flex: 1 1 auto; text-align: center; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; }
.steps .step.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps .step.done:not(.on)::after { content: " ✓"; color: var(--ok); }
.steps .step.off { opacity: .45; pointer-events: none; }
.stepbody { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.drop { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; text-align: center; border: 2px dashed #bcd0fb; border-radius: 14px; padding: 26px 14px; background: var(--accent-soft); cursor: pointer; }
.drop b { font-size: 16px; color: var(--accent-2); }
.drop span { font-size: 12px; color: var(--muted); }
.drop.over { background: #dbe7ff; }
details.more { border-top: 1px solid var(--line); padding-top: 8px; }
details summary { cursor: pointer; }
.mrow .input { flex: 1 1 110px; min-width: 0; }
.mrow .input.num { flex: 0 1 100px; }
ol.seq { margin: 4px 0 0; padding-left: 22px; }
.savebar { position: sticky; bottom: 8px; z-index: 30; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #1f2430; color: #fff; padding: 10px 12px; border-radius: 12px; box-shadow: var(--shadow-lg); }
.savebar span { flex: 1 1 180px; font-size: 13px; }

/* 3D ステージ（管理画面） */
body.sp .stage { height: min(60vh, 540px); min-height: 300px; border-radius: var(--radius); border: 1px solid var(--line); }
body.sp .minimap-wrap canvas { width: 110px; height: 125px; }
.diminfo { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 6; background: rgba(31,36,48,.86); color: #fff; font-size: 13px; padding: 8px 12px; border-radius: 10px; font-variant-numeric: tabular-nums; pointer-events: none; }
.room-btns { display: flex; gap: 6px; flex-wrap: wrap; }
body.sp .grid2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
/* スマホでは共通CSS（shared/ui.css）がモードのボタンを下へ移すので、寸法の帯はその上に出す */
@media (max-width: 900px) { .diminfo { bottom: 54px; font-size: 12px; padding: 6px 10px; } }
@media (max-width: 860px) { body.sp .grid2 { grid-template-columns: minmax(0, 1fr); } }

/* 間取り図（SVG） */
.plan-host { width: 100%; background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.plan-host.big .plan-svg { max-height: 70vh; }
.plan-svg { width: 100%; height: auto; display: block; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.plan-svg .room { fill: #eef3fb; stroke: none; cursor: pointer; }
.plan-svg .room.sel { fill: #dbe7ff; }
.plan-svg .wall-line { stroke: #334155; stroke-width: 5; vector-effect: non-scaling-stroke; stroke-linecap: square; }
.plan-svg .wall.edited .wall-line { stroke: #b45309; }
.plan-svg .wall.sel .wall-line { stroke: #ef4444; stroke-width: 7; }
.plan-svg .hit { stroke: transparent; stroke-width: 22; vector-effect: non-scaling-stroke; cursor: pointer; }
.plan-svg .dim { fill: #1f2937; font-weight: 700; paint-order: stroke; stroke: #fbfcfe; stroke-width: 4; vector-effect: non-scaling-stroke; pointer-events: none; font-family: ui-monospace, Menlo, monospace; }
.plan-svg .room-name { fill: #1d4ed8; font-weight: 800; pointer-events: none; }
.plan-svg .room-area { fill: #64748b; pointer-events: none; }
.plan-svg .op-gap { stroke: #fbfcfe; }
.plan-svg .op-line { stroke-width: 7; vector-effect: non-scaling-stroke; stroke-linecap: butt; }
.plan-svg .op.review .op-line { stroke-dasharray: 3 2; }
.plan-svg .op.sel .op-line { stroke: #ef4444 !important; stroke-width: 10; }
.plan-svg .op.linked .op-line { stroke-width: 10; }
.plan-svg .op { touch-action: none; }
.plan-svg .op.dragging { cursor: grabbing; }
.plan-svg .op-dim { fill: #92400e; font-weight: 700; pointer-events: none; paint-order: stroke; stroke: #fbfcfe; stroke-width: 3; vector-effect: non-scaling-stroke; }
p.big { font-size: 20px; font-weight: 800; margin: 2px 0 6px; }
.rooms { display: flex; flex-direction: column; gap: 6px; }
.rrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 140px) auto; gap: 8px; align-items: center; }
@media (max-width: 480px) { .rrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .rrow span { grid-column: 1 / -1; } }
body.sp .input.num { width: 110px; max-width: 100%; }

/* 写真 */
.phgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.phcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.phimg { position: relative; border-radius: 8px; overflow: hidden; background: #e5e7eb; aspect-ratio: 4 / 3; }
.phimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pin { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: #ef4444; border: 3px solid #fff; box-shadow: 0 0 0 2px #ef4444; pointer-events: none; }
.phcard .link { color: #1d4ed8; overflow-wrap: anywhere; margin: 0; }
.select.sm { padding: 5px 8px; font-size: 12px; }
.linkgrid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 700px) { .linkgrid { grid-template-columns: minmax(0, 1fr); } }
.phbig { position: relative; cursor: crosshair; }
.phbig img { width: 100%; display: block; border-radius: 8px; }

@media (max-width: 480px) {
  body.sp .wrap { padding: 12px 12px 60px; }
  .steps .step { font-size: 12px; padding: 7px 6px; flex: 1 1 30%; }
  .title-in { font-size: 17px; }
  body.sp .stage { height: 62vh; min-height: 280px; }
  body.sp .topbar .logo { font-size: 14px; }
  /* ヘッダーは1行に収める（折り返すと固定の高さからはみ出して上が切れる）。名前は隠し、ログアウトは残す */
  body.sp .topbar { padding: 0 10px; }
  body.sp .topbar nav { flex-wrap: nowrap; gap: 2px; }
  body.sp .topbar nav a { padding: 6px 8px; }
  body.sp .topbar .who { display: none; }
}
