/* ===== カラーテーマ（コーポレートカラーはここ1箇所で差し替え） ===== */
:root {
  --accent: #F97316;        /* オレンジ系アクセント（仮。正式色が決まればここを変更） */
  --accent-dark: #EA580C;
  --accent-weak: #FFF1E6;
  --bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --ok: #16a34a;
  --minus: #9ca3af;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", Meiryo, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* iOS の safe-area 対応 */
body { min-height: 100vh; }

.hidden { display: none !important; }

/* ===== ヘッダー ===== */
header.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
header.app-header .title { font-size: 18px; font-weight: 700; }
header.app-header .who { font-size: 12px; opacity: 0.95; }
header.app-header button.logout {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

/* ===== 認証カード（ログイン/登録/再設定） ===== */
.auth-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}
.auth-wrap h1 {
  color: var(--accent);
  font-size: 22px;
  margin: 8px 0 4px;
}
.auth-wrap .lead { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 4px; }
input, select {
  width: 100%;
  padding: 12px 12px;
  font-size: 16px; /* iOS ズーム防止のため16px以上 */
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

.note {
  font-size: 12px;
  color: var(--accent-dark);
  background: var(--accent-weak);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 6px;
}

button.primary {
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 12px;
}
button.primary:active { background: var(--accent-dark); }
button.primary:disabled { opacity: 0.55; }

.link-row { margin-top: 16px; text-align: center; font-size: 14px; }
.link-row a { color: var(--accent-dark); text-decoration: underline; cursor: pointer; }

.msg { margin-top: 14px; font-size: 14px; border-radius: 8px; padding: 10px 12px; }
.msg.error { color: var(--danger); background: #fef2f2; }
.msg.ok { color: var(--ok); background: #f0fdf4; }

/* ===== カウンター画面 ===== */
.counter-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 12px 120px; /* 下部固定の送信ボタン分の余白 */
}

.date-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
}
.date-bar label { margin: 0; }
.date-bar input[type="date"] { width: auto; flex: 1; }

.counter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.counter-row .label {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
}
.counter-row .value {
  min-width: 56px;
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent-dark);
}

/* ＋ボタンは大きく（56px以上）、−ボタンは小さめ */
button.plus {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  flex: none;
}
button.plus:active { background: var(--accent-dark); transform: scale(0.96); }
button.minus {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--minus);
  font-size: 22px;
  line-height: 1;
  flex: none;
}
button.minus:active { background: #f3f4f6; }

.toolbar {
  display: flex;
  gap: 10px;
  margin: 8px 4px 0;
}
button.reset {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 14px;
}

/* 下部固定の送信ボタン */
.submit-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, #fff 70%, rgba(255,255,255,0));
}
button.submit {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: block;
  padding: 16px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(249,115,22,0.35);
}
button.submit:active { background: var(--accent-dark); }
button.submit:disabled { opacity: 0.6; }

.status {
  max-width: 520px;
  margin: 0 auto 8px;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}
.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }
