/* ============================================================
   資材販売システム 共通スタイル（スマホ優先）
   ============================================================ */
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --text: #1d2329;
  --muted: #6b7580;
  --line: #dde2e7;
  --primary: #1f6f5c;
  --primary-weak: #e3f1ed;
  --danger: #c23b30;
  --danger-weak: #fbe9e7;
  --warn: #9a6400;
  --warn-weak: #fff3dc;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- ヘッダー ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 12px;
  background: var(--primary); color: #fff;
}
.appbar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar a, .appbar button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; color: #fff;
  font-size: 15px; text-decoration: none; cursor: pointer;
}
.appbar a:active, .appbar button:active { background: rgba(255,255,255,.15); }

.page { max-width: 760px; margin: 0 auto; padding: 12px 16px 40px; }

/* ---------- 部品 ---------- */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-size: 15px;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.input {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-size: 16px; /* iPhoneでズームしないよう16px以上 */
}
.input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }

.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 14px; min-height: 1.5em; margin: 8px 0 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 下から出るシート ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.35);
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-backdrop.open { display: flex; }
.sheet {
  width: 100%; max-width: 760px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 18px; }

/* ---------- お知らせ ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translateX(-50%);
  background: #222; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: .92; }
