/* kizai — スマホ優先。ボタンは手袋でも押せる大きさ（高さ 56px 以上） */
:root {
  --bg: #f6f7f9; --fg: #1d232b; --muted: #5d6773; --line: #d6dbe1;
  --accent: #1f6feb; --accent-fg: #fff; --warn-bg: #fff4e5; --warn-fg: #8a4b00;
  --danger: #c62828;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* display を指定したクラスより hidden を優先する */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.6 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
}
.bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 20px; color: var(--fg); text-decoration: none; margin-right: auto; }
.who { color: var(--muted); font-size: 15px; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 8px 0 16px; }
.muted { color: var(--muted); }
.alert { background: var(--warn-bg); color: var(--warn-fg); padding: 12px 14px; border-radius: 8px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
input, select, textarea {
  font: inherit; padding: 14px; min-height: 52px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--fg); font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(31,111,235,.35); border-color: var(--accent); }
.btn-big, button.btn-big {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 60px; padding: 0 24px; width: 100%;
  font: inherit; font-size: 19px; font-weight: 700;
  color: var(--accent-fg); background: var(--accent); border: 0; border-radius: 10px;
  text-decoration: none; cursor: pointer;
}
.btn-small {
  font: inherit; font-size: 14px; min-height: 40px; padding: 0 12px;
  background: #fff; color: var(--fg); border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
form.inline { margin: 0; }

/* ---- P2 ---- */
h2 { font-size: 18px; margin: 24px 0 10px; }
.small { font-size: 14px; }
.notice { background: #e8f5e9; color: #1b5e20; padding: 12px 14px; border-radius: 8px; }
.tabs { display: flex; gap: 4px; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 12px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.badge { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 99px; background: #eceff3; color: var(--muted); font-weight: 600; }
.stale-tag { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 99px; background: var(--warn-bg); color: var(--warn-fg); font-weight: 700; }
.filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.filter select { flex: 1 1 240px; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; min-height: 48px; }
label.check input { width: 24px; height: 24px; min-height: 0; padding: 0; }
.cards, .history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.card > a, .card > .row1 { display: block; }
.card > a { padding: 12px 14px; color: inherit; text-decoration: none; min-height: 56px; }
.card:not(:has(> a)) { padding: 12px 14px; }
.card.is-stale { border-left: 6px solid #f0a020; }
.card.is-off { opacity: .6; }
.row1 { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.row1 .name { font-weight: 600; }
.row2 { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 15px; margin-top: 2px; }
.row2 .site { color: var(--fg); font-weight: 600; }
.history li { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.pre { white-space: pre-wrap; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.panel > summary { font-weight: 700; cursor: pointer; min-height: 40px; display: flex; align-items: center; }
.panel[open] > summary { margin-bottom: 12px; }
.panel h2 { margin-top: 0; }
.req { margin-left: 6px; font-size: 12px; color: var(--danger); font-weight: 700; }
.err { color: var(--danger); font-size: 14px; font-weight: 600; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-size: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: flex-start; }
.actions form.inline { display: flex; flex-wrap: wrap; gap: 8px; }
details.pw > summary { list-style: none; display: inline-flex; align-items: center; }
details.pw > summary::-webkit-details-marker { display: none; }
.row-form { display: flex; gap: 8px; margin-top: 8px; }
.row-form input { flex: 1; min-width: 0; }
.scan-result { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.scan-ok { color: #1b5e20; font-weight: 800; font-size: 20px; margin: 0 0 4px; }
.scan-time { font-size: 18px; margin: 0; }
.btn-sub, a.btn-sub { background: #fff; color: var(--fg); border: 1px solid var(--line); }

/* ---- P3 スキャン画面 ---- */
.site-box { margin-top: 12px; }
.site-now { font-size: 24px; font-weight: 800; margin: 4px 0; min-height: 1em; }
.site-now.ok { color: #1b5e20; }
.site-now.unknown { color: var(--warn-fg); }
.cands-title { font-weight: 700; margin: 12px 0 8px; }
.cand-list { display: flex; flex-direction: column; gap: 8px; }
button.cand {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  width: 100%; min-height: 64px; padding: 10px 16px; font: inherit; font-size: 18px; font-weight: 700;
  text-align: left; color: var(--fg); background: #fff; border: 2px solid var(--accent); border-radius: 10px; cursor: pointer;
}
button.cand .sub { font-size: 14px; font-weight: 400; color: var(--muted); }
button.cand.base { border-color: #7b8794; }
button.cand.on { background: #e8f0fe; }
.actions-big { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
button.act {
  min-height: 64px; font: inherit; font-size: 17px; font-weight: 700; border-radius: 10px; cursor: pointer;
  background: #fff; color: var(--fg); border: 2px solid var(--line);
}
button.act[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
body.busy button.cand, body.busy button.act { opacity: .6; pointer-events: none; }

/* ---- P4 座標取得 ---- */
.geo-row { display: flex; gap: 8px; align-items: flex-end; }
.geo-row > label { flex: 1; min-width: 0; }
.geo-row > button { min-height: 52px; }
.geo-results { display: flex; flex-direction: column; gap: 8px; }

/* ---- v0.2 職人預かり ---- */
.custody-tag { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 99px; background: #ede7f6; color: #4527a0; font-weight: 700; }
.warn-tag { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 99px; background: #fdecea; color: var(--danger); font-weight: 700; }
.card.is-warn, .panel.is-warn { border-left: 6px solid var(--danger); }
.custody-link { display: inline-block; padding: 10px 14px; border-radius: 10px; background: #ede7f6; color: #4527a0; font-weight: 700; text-decoration: none; }
.custody-link.warn { background: #fdecea; color: var(--danger); }
.custody-box { margin-bottom: 16px; }
.custody-box .row2 { margin-bottom: 10px; }
