@charset "utf-8";
/* 棚卸WEBアプリ v2 — 4ページ共通スタイル（契約v2 §2-1）
 * index.html / inventory.html / followup.html / admin/index.html が読み込む唯一のスタイル。正本は1箇所。
 *
 * 決めごと
 *  - 入力欄（input / select / textarea）は 16px 以上。iOS の自動ズームを起こさない
 *  - 選択状態は JS が付ける .on クラスで表す。:has() には依存しない（非対応端末で選択が見えなくなる）
 *  - タップ目標は 44px 以上
 *  - 外部フォント・外部CDNは読み込まない
 */

:root {
  --bg: #f4f7f4;
  --surface: #ffffff;
  --surface2: #ecf2ec;
  --ink: #1d2b24;
  --muted: #5c6e63;
  --line: #d8e2d9;
  --accent: #17714f;
  --accent-ink: #ffffff;
  --accent-soft: #e1f0e7;
  --warn: #a8610f;
  --warn-soft: #f8eddc;
  --danger: #b3261e;
  --danger-soft: #fdecec;
  --tap: 44px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', Meiryo, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }

/* 現地では文字を読む量より、いま選ぶものを優先する。 */
.inventory { background: linear-gradient(155deg, #edf5ef 0, #f8faf7 60%, #eef3ef 100%); min-height: 100vh; }
.inventory h2 { font-size: 22px; line-height: 1.55; }
.inventory #editor > .card { padding: 22px 20px; box-shadow: 0 8px 28px #173d2410; }
.inventory .actions button { min-height: 54px; }
.inventory #placeButtons, .inventory #referencePanel .actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.inventory .stepnav { position: sticky; bottom: 0; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: #f5f8f3f5; z-index: 3; }
.inventory .stepnav .primary { flex: 1; }
.inventory #chosenPlace { font-size: 20px; margin: 12px 0; }
.inventory .eyebrow { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .1em; }
.reference-photo { display: block; width: 100%; max-height: 340px; object-fit: contain; background: #edf1ec; border-radius: 12px; }
.reference-quantity { font-size: 18px; font-weight: 700; }
.photo-completed { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; padding: 8px 12px; }
.photo-completed summary { font-size: 14px; }
.inventory #referencePanel:not(:empty) { margin-bottom: 18px; }
.inventory #referencePanel button[aria-pressed="false"] { background: white; color: var(--accent); border: 2px solid #bad2c4; }
.inventory #referencePanel button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 420px) {
  .inventory #editor > .card { padding: 18px 15px; }
  .inventory h2 { font-size: 21px; }
}
@media (prefers-reduced-motion: no-preference) {
  .inventory #editor > .card { animation: question-in .18s ease-out; }
  @keyframes question-in { from { opacity: .5; transform: translateY(5px); } to { opacity: 1; transform: none; } }
}

/* ---- 見出し・本文 ---- */
h1 { margin: 2px 0 0; font-size: 18px; font-weight: 700; }
h2 { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
p { margin: 8px 0; }
.mut { color: var(--muted); font-size: 14px; }
.warn { color: var(--warn); }
.err { color: var(--danger); font-weight: 700; }
.ok { color: var(--accent); font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 10px; }
.center { text-align: center; }

/* ---- 骨組み ---- */
.appbar { background: var(--accent); color: var(--accent-ink); padding: 12px 16px 11px; }
.appbar .inner { max-width: 640px; margin: 0 auto; }
.appbar .brand { font-size: 12px; opacity: .9; letter-spacing: .08em; }
.appbar .sub { font-size: 13px; opacity: .95; margin-top: 2px; }
main { max-width: 640px; margin: 0 auto; padding: 14px 12px 72px; display: flex; flex-direction: column; gap: 12px; }
section { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
}
.card.soft { background: var(--surface2); }
.card.attn { border-color: var(--warn); background: var(--warn-soft); }
.card.bad { border-color: var(--danger); background: var(--danger-soft); }
.card.good { border-color: var(--accent); background: var(--accent-soft); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.quick-check { margin: 10px 0 14px; padding: 11px 12px; border: 1px solid var(--accent); border-radius: 11px; background: var(--accent-soft); }
.quick-check h3 { color: var(--accent); }
.quick-check .hint { margin: 7px 0 0; color: var(--accent); font-size: 13px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.spacer { flex: 1 1 auto; }

/* ---- 通知（say / #message） ---- */
.msg {
  border-radius: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  white-space: pre-wrap;
  font-size: 15px;
}
.msg.info { border-color: var(--line); }
.msg.ok { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); font-weight: 400; }
.msg.warn { border-color: var(--warn); background: var(--warn-soft); }
.msg.error { border-color: var(--danger); background: var(--danger-soft); }

/* ---- 入力 ---- */
label { display: block; font-size: 14px; font-weight: 700; margin: 12px 0 4px; }
label .opt { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="number"], input[type="password"], input[type="search"],
input[type="date"], textarea, select {
  font: inherit;
  font-size: 16px;             /* iOS の自動ズーム防止。ここを下げない */
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--surface);
  color: var(--ink);
}
textarea { resize: vertical; min-height: 72px; line-height: 1.6; }
select { appearance: none; background-image: none; }
input[readonly] { background: var(--surface2); color: var(--muted); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface2); color: var(--muted); }
.field { margin-bottom: 4px; }
.field .hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.field .fielderr { font-size: 13px; color: var(--danger); font-weight: 700; margin: 4px 0 0; }
input:focus-visible, textarea:focus-visible, select:focus-visible,
button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

/* ---- 選択（:has() に依存しない。JS が .on を付ける） ---- */
.choices { display: flex; flex-direction: column; gap: 8px; }
.choices.inline { flex-direction: row; flex-wrap: wrap; }
.choice {
  display: flex; align-items: center; gap: 9px;
  min-height: var(--tap);
  border: 1px solid var(--line); border-radius: 11px;
  padding: 8px 12px; margin: 0;
  background: var(--surface);
  font-size: 15px; font-weight: 400; cursor: pointer;
}
.choice input { accent-color: var(--accent); width: 20px; height: 20px; margin: 0; flex: 0 0 auto; }
.choice .body { flex: 1 1 auto; }
.choice .lead { display: block; font-weight: 700; }
.choice .sub { display: block; font-size: 13px; color: var(--muted); }
.choice.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.choice.on.attn { border-color: var(--warn); background: var(--warn-soft); }
/* :has() 対応ブラウザでは JS 前でも見える。非対応でも .on があるので必ず見える */
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.yn { display: flex; gap: 6px; flex: 0 0 auto; }
.yn .choice { padding: 6px 14px; border-radius: 999px; font-size: 14px; min-height: 40px; }
.cond { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.cond:last-child { border-bottom: 0; }
.cond .cl { flex: 1 1 auto; font-size: 14px; }

.check { display: flex; align-items: flex-start; gap: 10px; min-height: var(--tap); font-weight: 400; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex: 0 0 auto; }

/* ---- ボタン ---- */
button, .btn {
  font: inherit; font-size: 16px; font-weight: 700;
  min-height: var(--tap);
  padding: 9px 16px;
  border: 1px solid var(--accent); border-radius: 11px;
  background: var(--surface); color: var(--accent);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button.primary { background: var(--accent); color: var(--accent-ink); }
button.is-selected {
  background: var(--accent);
  color: var(--accent-ink);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 3px #c6e7d9;
  font-weight: 700;
}
#placeButtons button[aria-pressed="false"],
#allNo[aria-pressed="false"], #showProblems[aria-pressed="false"],
#useBaseline[aria-pressed="false"], #useTyped[aria-pressed="false"] {
  background: #fff;
  color: var(--accent);
}
button.ghost { border-color: var(--line); color: var(--ink); }
button.danger { border-color: var(--danger); color: var(--danger); }
button.small { font-size: 14px; padding: 6px 12px; min-height: 38px; }
button.full { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.link {
  border: 0; background: none; color: var(--accent); text-decoration: underline;
  font-size: 14px; font-weight: 400; padding: 6px 2px; min-height: 38px;
}
.actions { display: flex; flex-direction: column; gap: 8px; }
.actions.inline { flex-direction: row; flex-wrap: wrap; }

/* ---- タグ・バッジ ---- */
.tag {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px;
  background: var(--surface2); color: var(--muted);
}
.tag.on { background: var(--accent-soft); color: var(--accent); }
.tag.attn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--danger-soft); color: var(--danger); }

/* ---- 表 ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; font-size: 13px; }
td.qty, th.qty { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plus { color: var(--accent); font-weight: 700; }
.minus { color: var(--danger); font-weight: 700; }
.scroll { overflow-x: auto; }

/* ---- 折りたたみ ---- */
details { border: 1px dashed var(--line); border-radius: 11px; padding: 8px 12px; margin: 10px 0; background: var(--surface); }
details[open] { background: var(--surface2); }
summary { cursor: pointer; font-size: 14px; font-weight: 700; color: var(--accent); min-height: 32px; }
details .inner { padding-top: 6px; }

/* ---- 明細 ---- */
.record { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 12px 0; background: var(--surface); }
.record > .head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.record > .head h3 { margin: 0; }

/* ---- 写真 ---- */
.photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo { width: 108px; display: flex; flex-direction: column; gap: 4px; }
.photo img { width: 108px; height: 92px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface2); }
.photo .cap { font-size: 12px; line-height: 1.4; word-break: break-all; }
.photo button { font-size: 13px; padding: 4px 8px; min-height: 36px; }
/* 写真は「必要な項目ごとに1行」。行の左のマークで、撮れたかどうかが一目で分かる */
.photo-row {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.photo-row:first-child { border-top: 0; }
.photo-head { display: flex; gap: 10px; align-items: flex-start; }
.photo-head .mark {
  width: 26px;
  min-width: 26px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.5;
}
.photo-row.done .mark { color: var(--accent); }
.photo-row.todo .mark { color: var(--danger); }
.photo-row.skip .mark { color: var(--warn); }
.photo-row.opt .mark { color: var(--muted); }
.photo-row.todo { background: var(--warn-soft); border-radius: 10px; padding: 10px 8px; }
.photo-row .actions { margin: 0; }
.photo select.small { font-size: 12px; min-height: 36px; padding: 2px 6px; }

.needlist { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.need { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.need .mark { width: 22px; text-align: center; font-weight: 700; }
.need.done .mark { color: var(--accent); }
.need.todo .mark { color: var(--danger); }
.need.skip .mark { color: var(--warn); }

/* ---- 送信中オーバーレイ ---- */
.busy {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.busy .box {
  background: var(--surface); border-radius: 14px; padding: 20px 22px;
  max-width: 320px; width: 100%; text-align: center;
}
.busy .box p { margin: 0 0 14px; font-weight: 700; }

/* ============================================================
   ここから下は index / followup / admin が使う部品。
   4ページで1枚のスタイルを共有するため、正本としてここに置く。
   ============================================================ */

/* ---- 設問のまとまり ---- */
fieldset {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 16px 14px; margin: 0; background: var(--surface);
}
legend { font-weight: 700; font-size: 15px; padding: 0 6px; }
.qno {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-right: 4px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 13px;
}
.hint { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.bigq { font-size: 16px; font-weight: 700; margin: 0 0 10px; }
.req { color: var(--danger); font-size: 12px; margin-left: 4px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.navrow { display: flex; gap: 10px; }
.navrow .btn.primary, .navrow button.primary { flex: 1 1 auto; }
.checkline { margin: 8px 0; }
.keyrow { justify-content: space-between; margin-bottom: 10px; }
.cardhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.urlbox { word-break: break-all; font-size: 13px; }
.urlbox code, code {
  background: var(--surface2); border-radius: 5px; padding: 1px 5px; font-size: 13px; word-break: break-all;
}
.json { white-space: pre-wrap; word-break: break-all; font-size: 13px; background: var(--surface2); border-radius: 8px; padding: 8px 10px; }

/* 画面には出さず、読み上げにだけ残すラベル */
.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---- 択一（.on は JS が付ける。:has() に依存しない） ---- */
.seg { display: flex; flex-direction: column; gap: 8px; }
.seg label {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap);
  border: 1px solid var(--line); border-radius: 11px; padding: 8px 12px; margin: 0;
  background: var(--surface); font-size: 15px; font-weight: 400; cursor: pointer;
}
.seg label.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.seg input[type="radio"], .seg input[type="checkbox"] { accent-color: var(--accent); width: 20px; height: 20px; margin: 0; }
.reveal { display: none; margin-top: 10px; }
.reveal.on { display: block; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px;
  min-height: 40px; background: var(--surface); font-size: 14px; cursor: pointer;
}
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* ---- 写真のサムネイル ---- */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumb {
  position: relative; width: 88px; height: 88px; border-radius: 10px;
  overflow: hidden; border: 1px solid var(--line); background: var(--surface2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; min-height: 26px;
  border-radius: 50%; border: 0; padding: 0; background: rgba(0, 0, 0, .6); color: #fff; font-size: 13px;
}
.thumbs img { border-radius: 8px; border: 1px solid var(--line); }
.counter { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ---- 送信後 ---- */
.thanks { text-align: center; padding: 44px 20px; display: none; }
.thanks.on { display: block; }
.thanks .mark {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700;
}
.thanks h2 { margin: 0 0 6px; }
.thanks p { color: var(--muted); font-size: 14px; margin: 0; }

/* ---- 運営画面 ---- */
body.admin main { max-width: 1000px; }
.modetag { background: rgba(255, 255, 255, .22); border-radius: 6px; padding: 1px 7px; font-weight: 700; }
nav {
  display: flex; gap: 4px; background: var(--surface);
  border-bottom: 1px solid var(--line); overflow-x: auto;
}
nav button {
  flex: 0 0 auto; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; color: var(--muted); font-weight: 400; padding: 12px 16px;
}
nav button.on { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.tablewrap { overflow-x: auto; }
table.sub { font-size: 13px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag.ok, .tag.worker { background: var(--accent-soft); color: var(--accent); }
.tag.ng, .tag.error { background: var(--danger-soft); color: var(--danger); }
.tag.warn, .tag.light, .tag.pending, .tag.returned { background: var(--warn-soft); color: var(--warn); }
.tag.off { background: var(--surface2); color: var(--muted); }
.tag.applied { background: var(--accent-soft); color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 28px 0; }
.banner {
  border: 1px solid var(--line); border-left-width: 5px; border-radius: 10px;
  padding: 9px 12px; margin: 8px 0; font-size: 14px; background: var(--surface);
}
.banner.ok { border-color: var(--accent); background: var(--accent-soft); }
.banner.warn { border-color: var(--warn); background: var(--warn-soft); }
.banner.danger { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); font-weight: 700; }
/* 反映で登録から消える品目。折りたたまない赤枠（契約v2 §9-2 #4） */
.danger-card { border: 2px solid var(--danger); background: var(--danger-soft); }
.subcard { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; margin: 10px 0; background: var(--surface); }
.grouphead { margin: 16px 0 6px; padding-bottom: 4px; border-bottom: 2px solid var(--line); }
.warnline { font-size: 13px; color: var(--warn); font-weight: 700; margin: 4px 0; }

/* ---- 端の飾り ---- */
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
footer { max-width: 640px; margin: 0 auto; padding: 0 12px 24px; color: var(--muted); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- 残数（消込）の表示 ---- */
.bignum {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 4px;
}
.bignum.go { color: var(--accent); }
.bignum.warn { color: var(--warn); }
.bignum.done { color: var(--accent); font-size: 24px; }
#remainTable { margin-top: 8px; }
#placeTable { margin-top: 14px; }
#placeTable h3 { margin: 0 0 4px; font-size: 14px; }
#placeTable td.sub { padding-left: 14px; }
#placeTable tr.placehead td { background: var(--surface2); padding-top: 7px; }
#placeTable tr.placehead b { font-size: 14px; }
#remainTable td b.go { color: var(--accent); }
#remainTable td b.warn { color: var(--warn); }
#taskList .card.soft.attn { border-color: var(--warn); background: var(--warn-soft); }
.quick-row {
  display: grid;
  grid-template-columns: 1fr 128px;
  gap: 10px;
  align-items: end;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.quick-row:first-child { border-top: 0; }
.quick-row .field { margin: 0; }
.quick-row .field label { font-size: 13px; }
@media (max-width: 420px) {
  .quick-row { grid-template-columns: 1fr; align-items: stretch; }
}

/* ---- 1画面1操作（初めて使う人向け） ---- */
.stepbar {
  display: flex;
  gap: 4px;
  margin: 0 0 10px;
}
.stepdot {
  flex: 1 1 0;
  text-align: center;
  padding: 6px 2px;
  border-radius: 8px;
  background: var(--surface2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}
.stepdot .no { display: block; font-weight: 800; font-size: 14px; }
.stepdot .nm { display: block; }
.stepdot.on { background: var(--accent); color: var(--accent-ink); }
.stepdot.done { background: var(--accent-soft); color: var(--accent); }
.stepnav {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.stepnav button { flex: 1 1 auto; }
.stepnav #stepBack { flex: 0 0 96px; }
button.big {
  min-height: 56px;
  font-size: 17px;
  font-weight: 800;
}
#nextCard h2 { font-size: 20px; }
#nextCard #nextGo { width: 100%; }
