/* 安全施工サイクル 入力画面
   UI仕様書（2026-11-18）§2〜3: 白基調・Calinetの緑・装飾なし / 本文16〜18px / ボタン高さ52〜60px / タップ領域44px以上
   色の意味: 緑＝選択済み・次へ・実行可能 / 青＝名前追加などの補助操作だけ / グレー＝戻る・操作不可 / 赤＝必須・警告 */
:root {
  --bg: #f7f7f7;
  --fg: #222222;
  --sub: #777777;
  --line: #cccccc;
  --green: #287d38;
  --green-bg: #eaf4ec;
  --blue: #1769c2;
  --gray: #e5e5e5;
  --warn-bg: #fff3e0;
  --warn-fg: #8a4b00;
  --err-bg: #ffebee;
  --err-fg: #b71c1c;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 17px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  -webkit-text-size-adjust: 100%;
}
.head { text-align: center; padding: 12px 0 4px; }
.app-title { font-size: 20px; font-weight: bold; }
.date-label { font-size: 15px; color: var(--sub); }
.team-name { font-size: 17px; font-weight: bold; }

.screen { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 8px 0 24px; }
/* 戻る・次へを画面下に固定する画面では、最後の項目・版の表示がボタンの下に隠れないよう下を空ける */
body.has-nav { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.screen[hidden], [hidden] { display: none !important; }

.btn {
  display: block;
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: bold;
  font-family: inherit;
  color: #fff;
  padding: 10px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { filter: brightness(0.85); }
.btn:disabled { background: var(--gray); color: #999; }
.btn-huge { min-height: 60px; font-size: 19px; }
.btn-green { background: var(--green); }
.btn-blue { background: var(--blue); }
.btn-gray { background: var(--gray); color: var(--fg); }
.btn-outline { background: #fff; color: var(--fg); border: 1px solid var(--line); }

.big-text { text-align: center; font-size: 18px; margin: 0; }
.hint { font-size: 14px; color: var(--sub); margin: 0; }
.message { border-radius: 12px; padding: 12px 14px; margin: 0; font-size: 16px; font-weight: bold; }
.message.big { font-size: 20px; text-align: center; }
.message.error { background: var(--err-bg); color: var(--err-fg); }
.message.warn { background: var(--warn-bg); color: var(--warn-fg); }
.message ul { margin: 4px 0 0; padding-left: 1.2em; }
.detail { font-size: 15px; }
.done-mark { text-align: center; font-size: 26px; font-weight: bold; color: var(--green); margin: 24px 0 0; }

/* トップ */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.info-card { font-size: 15px; display: flex; flex-direction: column; gap: 4px; }
.info-card div { display: flex; gap: 8px; }
.info-card b { flex: 0 0 4em; color: var(--sub); font-weight: normal; }
.status-list { display: flex; flex-direction: column; gap: 14px; }
.status-row { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.status-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.status-name { font-size: 19px; font-weight: bold; }
.badge { font-size: 14px; font-weight: bold; border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.badge-done { background: var(--green); color: #fff; }
.badge-ready { background: #fff; color: var(--green); border: 1px solid var(--green); }
.badge-waiting { background: #fff; color: var(--err-fg); border: 1px solid var(--err-fg); }
.badge-notyet { background: var(--gray); color: var(--sub); }
.status-row .status-sub { font-size: 14px; color: var(--sub); }

/* 入力 */
.step-head { display: flex; flex-direction: column; gap: 6px; }
.step-line { display: flex; justify-content: space-between; align-items: baseline; }
.step-name { font-size: 15px; color: var(--sub); }
.step-count { font-size: 15px; color: var(--sub); font-weight: bold; }
.progress { height: 6px; background: var(--gray); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--green); }
.step-title { font-size: 20px; font-weight: bold; }
.step-body { display: flex; flex-direction: column; gap: 16px; }
/* 戻る・次へは常に画面の一番下（セーフエリアの上）。長いリストをスクロールしても見失わない */
.step-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr 2fr; gap: 12px;
  background: #fff; border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.step-nav .btn { min-height: 56px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 18px; font-weight: bold; }
.field-label .req { color: var(--err-fg); font-size: 13px; margin-left: 6px; }
.field-note { font-size: 14px; color: var(--sub); }
.box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.box-title { font-size: 19px; font-weight: bold; }

input[type="text"], input[type="time"], textarea {
  width: 100%;
  font-size: 17px; /* iPhone は16px未満だと入力時に拡大されるため、これより小さくしない */
  font-family: inherit;
  padding: 12px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--fg);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--blue); }

/* タップで選ぶボタン（1つ選ぶ／複数選ぶ） */
.choices { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  flex: 1 1 auto;
  min-width: 30%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--fg);
  font-size: 17px;
  font-family: inherit;
  padding: 8px 12px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.chip.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: bold; }
.chip.sub { min-width: 45%; }

/* チェック項目 */
.checks { display: flex; flex-direction: column; gap: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.check {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 10px 14px;
  border: none; border-bottom: 1px solid var(--line);
  background: #fff; color: var(--fg);
  font-size: 17px; font-family: inherit; text-align: left; width: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.check:last-child { border-bottom: none; }
.checks-heading { background: #f0f0f0; color: var(--sub); font-size: 14px; font-weight: bold; padding: 6px 14px; border-bottom: 1px solid var(--line); }
.check .box-mark { flex: 0 0 28px; height: 28px; border: 2px solid #999; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: bold; color: #fff; }
.check.on { background: var(--green-bg); }
.check.on .box-mark { background: var(--green); border-color: var(--green); }
.bulk { display: flex; flex-direction: column; gap: 6px; }

/* ＋／− */
.counter { display: flex; align-items: center; gap: 12px; }
.counter button { width: 60px; height: 52px; font-size: 26px; font-weight: bold; border: none; border-radius: 12px; background: var(--gray); font-family: inherit; touch-action: manipulation; }
.counter .count { min-width: 3em; text-align: center; font-size: 22px; font-weight: bold; }

.add-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.add-row .btn { width: auto; min-height: 52px; padding: 0 14px; font-size: 16px; }

.spinner {
  width: 56px; height: 56px; margin: 24px auto 0;
  border: 6px solid var(--gray); border-top-color: var(--green); border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.foot { text-align: center; font-size: 13px; color: var(--sub); padding: 8px 0 12px; }
.foot-warning { background: var(--err-bg); color: var(--err-fg); font-size: 14px; font-weight: bold; border-radius: 8px; padding: 8px; margin-bottom: 6px; }
