/* 健康管理WEBアプリ - モバイルファースト */
:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --text: #2a2a2a;
  --muted: #7a7a7a;
  --accent: #2d7a4f;
  --accent-light: #e8f2ec;
  --warn: #c77d3a;
  --danger: #c05050;
  --border: #e2dfd8;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  padding-bottom: 80px;
  -webkit-text-size-adjust: 100%;
}

header {
  background: var(--accent);
  color: white;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}
header h1 { margin: 0; font-size: 18px; font-weight: 600; }
header .date { font-size: 13px; opacity: 0.9; margin-top: 2px; }

main { padding: 16px 14px; max-width: 640px; margin: 0 auto; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 15px;
  margin: 0 0 10px 0;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.card h3 {
  font-size: 14px;
  margin: 10px 0 6px;
  color: var(--accent);
}

.row {
  display: flex;
  align-items: center;
  padding: 6px 0;
}
.row .label { flex: 0 0 78px; color: var(--muted); font-size: 14px; }
.row .value { flex: 1; font-size: 15px; }

.menu-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.menu-item:last-child { border-bottom: none; }
.menu-item .tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 10px;
  font-size: 12px;
  margin-right: 6px;
}
.menu-item .text { font-size: 15px; line-height: 1.5; }

.btn {
  display: inline-block;
  padding: 14px 18px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  min-height: 48px;
  width: 100%;
  margin: 4px 0;
}
.btn.secondary { background: #8a8a8a; }
.btn.warn { background: var(--warn); }
.btn.danger { background: var(--danger); }
.btn.outline { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn[disabled] { opacity: 0.5; }

.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row .btn { margin: 0; }

/* 名前ラベル選択ボタン(ログイン画面) */
.label-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.label-btn {
  padding: 14px 12px;
  min-height: 52px;
  border: 2px solid #d0d0d0;
  border-radius: 10px;
  background: #fafafa;
  color: #444;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.label-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.label-btn:active { transform: scale(0.97); }

input[type=text], input[type=number], input[type=password], input[type=date], textarea, select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: white;
  color: var(--text);
  font-family: inherit;
}
textarea { min-height: 80px; resize: vertical; }
label { display: block; margin: 10px 0 4px; font-size: 14px; color: var(--muted); }

.banner {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 14px;
}
.banner.skip { background: #fff4e8; border-left: 4px solid var(--warn); }
.banner.override { background: #eaf3ff; border-left: 4px solid #3a7ab8; }
.banner.ok { background: var(--accent-light); border-left: 4px solid var(--accent); }
.banner.err { background: #fbe6e6; border-left: 4px solid var(--danger); }

.check-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.check-item input[type=checkbox] {
  width: 24px;
  height: 24px;
  margin-top: 1px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}
.check-item.done { opacity: 0.5; text-decoration: line-through; }
.check-item .itm { flex: 1; font-size: 15px; }

nav.tabs {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs a {
  padding: 10px 4px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}
nav.tabs a.active { color: var(--accent); font-weight: 600; }
nav.tabs a .ico { display: block; font-size: 20px; margin-bottom: 2px; }

.spinner {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  font-size: 14px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.log-row {
  display: grid;
  grid-template-columns: 80px 1fr 1fr;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.log-row.head { color: var(--muted); font-size: 12px; }

.tag-kind { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; margin-right: 4px; }
.tag-kind.外食 { background: #fff0d6; color: #a06820; }
.tag-kind.旅行 { background: #e3edf6; color: #3a6a92; }
.tag-kind.体調不良 { background: #fbe6e6; color: #9a4040; }
.tag-kind.その他 { background: #eeeeee; color: #555; }

#modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 30;
  align-items: flex-end;
  justify-content: center;
}
#modal-backdrop.show { display: flex; }
.modal {
  background: white;
  width: 100%;
  max-width: 640px;
  border-radius: 14px 14px 0 0;
  padding: 18px 16px 24px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal h3 { margin: 0 0 12px; font-size: 16px; }

.muted { color: var(--muted); font-size: 13px; }
