:root {
  --blue: #0b5ed7;
  --blue-dark: #0a4cb0;
  --ink: #1c1c1e;
  --gray: #6e6e73;
  --line: #d9d9de;
  --bg-soft: #f2f2f7;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #fff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 18px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.app-header {
  position: sticky;
  top: 0;
  background: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 20px 10px;
  border-bottom: 1px solid var(--line);
  z-index: 10;
}
.app-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
}

main {
  padding: 16px 20px calc(110px + env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
}

.view { display: none; }
.view.active { display: block; }

/* 入力フォーム */
.field { margin-bottom: 20px; }
.field label, .field-label {
  display: block;
  font-size: 17px;
  color: var(--gray);
  margin-bottom: 8px;
}
.field input[type="number"],
.field input[type="datetime-local"],
.field input[type="date"],
.field select {
  width: 100%;
  font-size: 24px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  min-height: 56px;
}
.batch-row, .temp-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.batch-row input, .temp-row input { flex: 1; }
.unit { font-size: 22px; color: var(--ink); }

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg {
  flex: 1;
  font-size: 22px;
  padding: 14px 0;
  background: var(--bg-soft);
  color: var(--gray);
  border: none;
  cursor: pointer;
  min-height: 56px;
}
.seg.selected {
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.btn-primary {
  display: block;
  width: 100%;
  font-size: 22px;
  font-weight: 700;
  padding: 16px 0;
  margin-top: 12px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 60px;
}
.btn-primary:active { background: var(--blue-dark); }

.btn-sub {
  font-size: 16px;
  padding: 8px 14px;
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 10px;
  cursor: pointer;
}
.btn-sub.small { margin-left: 10px; }

.hint { font-size: 14px; color: var(--gray); }
.save-msg { text-align: center; color: var(--blue); font-weight: 700; min-height: 1.5em; }

.note {
  position: relative;
  background: #fff8e1;
  border: 1px solid #f0d48a;
  border-radius: var(--radius);
  padding: 12px 40px 12px 14px;
  font-size: 14px;
}
.note-close {
  position: absolute;
  top: 6px; right: 8px;
  background: none; border: none;
  font-size: 20px; color: var(--gray); cursor: pointer;
}
.edit-banner {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 700;
}

/* 一覧 */
.empty { color: var(--gray); text-align: center; margin-top: 40px; }
.list-group { margin-bottom: 26px; }
.list-group h2 {
  font-size: 20px;
  margin: 0 0 8px;
  padding: 6px 12px;
  background: var(--bg-soft);
  border-radius: 10px;
}
.record-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fff;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-size: 17px;
  color: var(--ink);
}
.record-card:active { background: var(--bg-soft); }
.record-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  font-size: 19px;
  margin-bottom: 6px;
}
.record-cat {
  font-size: 14px;
  color: #fff;
  background: var(--blue);
  border-radius: 8px;
  padding: 2px 10px;
}
.record-temps { color: var(--ink); font-size: 16px; }
.record-del {
  margin-top: 8px;
  font-size: 14px;
  color: #c62828;
  background: none;
  border: 1px solid #e5b4b4;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

/* 報告テキスト */
.desc { color: var(--gray); font-size: 15px; }
.report-box {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 24px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: inherit;
  min-height: 120px;
}

/* CSV */
.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.range-row input { flex: 1; font-size: 18px !important; }
.csv-count { font-size: 20px; font-weight: 700; }

/* タブバー */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--gray);
  font-size: 12px;
  padding: 8px 2px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 56px;
}
.tab-icon { font-size: 22px; line-height: 1.2; }
.tab.selected { color: var(--blue); font-weight: 700; }
