/* 小さな画面でも日付の幅とタイトルの見た目を固定する共通調整 */
.fitness-feature-header > div,
.health-feature-header > div {
  display: grid;
  justify-items: center;
}

.fitness-feature-header img,
.health-feature-header img {
  width: 58px !important;
  height: 58px !important;
  margin: 0 auto -5px !important;
  object-fit: contain;
}

.popopo-date-field {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  height: 42px;
}

.popopo-date-display {
  box-sizing: border-box;
  display: flex;
  width: 100%;
  height: 42px;
  align-items: center;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid #bfdce3;
  border-radius: 12px;
  color: #315d68;
  background: #fff;
  font: 15px "Hiragino Maru Gothic ProN", sans-serif;
  line-height: 1;
  white-space: nowrap;
}

.popopo-date-display::after {
  content: "⌄";
  margin-left: auto;
  color: #7fa8b9;
  font-size: 16px;
}

.popopo-date-field input[type="date"] {
  position: absolute !important;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.health-section-title {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.health-page .health-accordion-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-height: 60px; }
.health-page .health-accordion-toggle { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 60px; padding: 12px 8px 12px 15px; }
.health-page .health-privacy { margin-right: 13px; }

.health-section-icon {
  display: block;
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  object-fit: contain;
}

.health-page .member-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin: 8px 0 7px;
  padding: 4px;
  border: 1px solid #c8e0e7;
  border-radius: 18px;
  background: rgba(255, 255, 255, .67);
}

.health-page .member-tabs button {
  min-height: 35px;
  border: 0;
  border-radius: 13px;
  color: #62838d;
  background: transparent;
  font: 700 14px "Yomogi Local", sans-serif;
}

.health-page .member-tabs button[aria-selected="true"] {
  color: #315d68;
  background: #fff;
  box-shadow: 0 3px 9px rgba(74, 128, 139, .14);
}

.health-page .member-tabs button:disabled {
  color: #9aabb0;
  cursor: default;
  opacity: .74;
}

.health-quick-actions {
  margin: 8px 0 12px;
  padding: 10px;
  border: 1px solid #d4e5e8;
  border-radius: 17px;
  background: rgba(255, 255, 255, .7);
}

.health-quick-actions p {
  margin: 0 0 7px;
  color: #66818d;
  font: 700 12px "Yomogi Local", sans-serif;
}

.health-quick-actions > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.health-quick-actions > div + div { margin-top: 5px; }

.health-quick-actions button {
  min-height: 35px;
  padding: 5px 3px;
  border: 1px solid #d6e4e9;
  border-radius: 11px;
  color: #527683;
  background: #fff;
  font: 700 11px "Yomogi Local", sans-serif;
  line-height: 1.25;
}

.health-quick-actions button[data-health-photo] {
  color: #557ca5;
  background: #f1f7ff;
}

.health-quick-actions button[data-health-photo] {
  min-height: 50px;
  font-size: 14px;
}

.health-quick-actions button:disabled { opacity: .55; }
.health-quick-actions.is-readonly { background: rgba(245, 247, 248, .72); }
.health-quick-actions.is-readonly p { color: #82919a; }
.health-quick-actions.is-readonly button { cursor: not-allowed; }
.health-status-top { min-height: 18px; margin: -5px 4px 8px; }

.health-section-help { margin: -2px 0 10px; color: #748b99; font-size: 12px; line-height: 1.5; }
.meal-history-picker { display: grid; gap: 5px; margin: 0 0 10px; color: #5b7889; font-size: 13px; }
.meal-history-picker .popopo-date-field, .meal-history-picker .popopo-date-display { height: 46px; }
.meal-history-picker .popopo-date-display { padding: 10px 12px; font-size: 16px; }
.health-dialog .meal-form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.health-dialog .meal-form-grid > .full { grid-column: 1 / -1; }
.health-dialog .meal-dishes { padding: 12px; border: 1px solid #d8e8ed; border-radius: 15px; background: #f8fcfd; }
.health-dialog .meal-dishes-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 9px; color: #567586; }
.health-dialog .meal-dishes-heading strong { font-size: 15px; }
.health-dialog .meal-dishes-heading span { color: #8195a0; font-size: 11px; }
.health-dialog #dish-list { display: grid; gap: 9px; }
.health-dialog .dish-row { display: block; padding: 10px; border: 1px solid #dce9ed; border-radius: 13px; background: #fff; }
.health-dialog .dish-row label { display: grid; gap: 4px; margin: 0; color: #668290; font-size: 11px; }
.health-dialog .meal-form-grid > label { display: grid; gap: 5px; color: #5b7889; font-size: 13px; }
.health-dialog .meal-form-grid > label input, .health-dialog .meal-form-grid > label select, .health-dialog .meal-form-grid > label textarea { min-height: 48px; box-sizing: border-box; padding: 10px 12px; border-color: #bfd9e1; border-radius: 13px; font-size: 16px; }
.health-dialog .meal-form-grid > label textarea { min-height: 76px; resize: vertical; }
.health-dialog .dish-row input, .health-dialog .dish-row select { min-height: 46px; box-sizing: border-box; font-size: 16px; }
.health-dialog .dish-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px; gap: 8px; align-items: end; margin-top: 10px; }
.health-dialog .dish-row button { width: 46px; min-height: 46px; height: 46px; font-size: 20px; }
.health-dialog .dish-calorie { position: relative; }
.health-dialog .dish-calorie input { width: 100%; padding-right: 42px; }
.health-dialog .dish-calorie i { position: absolute; right: 10px; bottom: 15px; color: #7790a0; font-size: 12px; font-style: normal; }
.health-dialog .dish-calorie-pending { display: flex; min-height: 46px; align-items: center; margin: 0; padding: 0 10px; border-radius: 11px; color: #7b92a1; background: #f0f5f7; font-size: 11px; line-height: 1.35; }
.health-dialog .dish-row.is-estimating { opacity: .62; }
.health-dialog .meal-dishes .add-dish { margin-top: 10px; min-height: 46px; font-size: 14px; }
.health-dialog .meal-calorie { display: grid; grid-template-columns: 1fr; gap: 5px; padding: 13px; border: 1px solid #d7e5f3; border-radius: 15px; background: #f5f9ff; }
.health-dialog .meal-calorie strong { color: #5d7890; font-size: 13px; }
.health-dialog .meal-calorie output { color: #4f7396; font: 700 19px "Yomogi Local", sans-serif; }
.health-dialog .meal-calorie p { margin: 1px 0 0; color: #7b90a0; font-size: 11px; line-height: 1.45; }

@media (max-width: 380px) {
  .health-dialog .meal-form-grid { grid-template-columns: 1fr; }
  .health-dialog .meal-calorie { grid-template-columns: 1fr; }
}

.health-dialog { width: min(410px, calc(100vw - 28px)); max-height: min(700px, calc(100dvh - 28px)); border: 1px solid #d3e7ed; border-radius: 24px; background: #fbfeff; }
.health-dialog.dialog-fallback-open { position: fixed; inset: 0; z-index: 100; margin: auto; box-shadow: 0 18px 48px rgba(56, 93, 109, .28); }
.health-dialog form { padding: 22px 20px 20px; }
.health-dialog .dialog-close { display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 50%; color: #537984; background: #e6f3f5; font-size: 22px; cursor: pointer; }
.health-photo-dialog { width: min(410px, calc(100% - 28px)); }
.health-photo-dialog form { display: grid; gap: 12px; }
.health-photo-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.health-photo-dialog h2 { margin: 0; color: #526379; font-size: 20px; }
.health-photo-dialog .health-photo-help { margin: 0; color: #728b9a; font-size: 13px; line-height: 1.55; }
.health-photo-dialog .health-photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.health-photo-dialog .health-photo-grid img { width: 100%; aspect-ratio: 1; border-radius: 12px; object-fit: cover; }
.health-photo-dialog .health-photo-add { width: 100%; min-height: 44px; border: 1px dashed #8fb2c5; border-radius: 13px; color: #4f7487; background: #f5fbfc; font: 700 14px "Yomogi Local", sans-serif; }
.health-photo-dialog .health-photo-primary { width: 100%; min-height: 45px; border: 0; border-radius: 13px; color: #fff; background: #719ec9; font: 700 15px "Yomogi Local", sans-serif; }
.health-photo-dialog .health-photo-primary:disabled { opacity: .5; }
.health-photo-dialog .health-photo-loader { margin: 5px 0; color: #587f99; text-align: center; }
.health-photo-dialog footer { display: flex; justify-content: flex-end; gap: 7px; }
.health-photo-dialog footer button { min-height: 39px; padding: 7px 13px; border: 0; border-radius: 11px; color: #587589; background: #eef4f7; font: 700 13px "Yomogi Local", sans-serif; }
.health-dialog .health-history-import { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid #d5e6ee; border-radius: 13px; color: #587589; background: #f4fbfd; font-size: 13px; line-height: 1.45; }
.health-dialog .health-history-import input { width: 18px; height: 18px; accent-color: #719ec9; }
.health-dialog.is-saving { cursor: progress; }
.health-dialog.is-saving form { pointer-events: none; }
.health-dialog.is-saving footer button[type="submit"], .health-dialog.is-saving .health-photo-primary { background: #91afc4; }
.health-dialog.is-saving .health-photo-loader::before { content: "● ● ●"; display: block; margin-bottom: 8px; color: #719ec9; letter-spacing: 4px; animation: health-popo-pulse 1.05s ease-in-out infinite; }
@keyframes health-popo-pulse { 50% { opacity: .35; transform: translateY(2px); } }

@media (max-width: 380px) {
  .health-quick-actions button { font-size: 10px; }
}

/* 食事・体組成・歩数で共通の、押しやすい記録フォーム */
#health-editor { overflow: auto; }
#health-editor form { display: grid; gap: 18px; padding: 20px; }
#health-editor form > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
#health-editor form > header h2 { margin: 0; color: #526379; font-size: 20px; }
#health-editor .dialog-close { flex: 0 0 auto; width: 38px; height: 38px; margin: 0; font-size: 24px; line-height: 1; }
#health-editor #health-form-fields { display: grid; gap: 14px; }
#health-editor .health-form-grid { grid-template-columns: 1fr; gap: 14px; }
#health-editor .health-form-grid label { display: grid; gap: 6px; color: #5b7889; font-size: 13px; }
#health-editor .health-form-grid input, #health-editor .health-form-grid select { min-height: 50px; box-sizing: border-box; padding: 10px 12px; border: 1px solid #bfd9e1; border-radius: 13px; color: #425f70; background: #fff; font-size: 17px; }
#health-editor .popopo-date-field, #health-editor .popopo-date-display { height: 50px; }
#health-editor .popopo-date-display { padding: 10px 12px; font-size: 17px; }
#health-editor footer { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; margin-top: 2px; }
#health-editor footer button { min-height: 54px; padding: 10px 16px; border: 0; border-radius: 15px; font: 700 16px "Yomogi Local", sans-serif; }
#health-editor footer button[type="submit"] { color: #fff; background: #6f9aca; box-shadow: 0 4px 10px rgba(83, 126, 167, .2); }
#health-editor footer .danger { color: #a75f6a; background: #fff0f1; }

/* ヘルスケア内の枠線を淡いブルーに揃える。 */
.health-page .health-accordion,
.health-page .health-popopo-comment,
.health-page .health-dialog,
.health-page .health-dialog .meal-dishes,
.health-page .health-dialog .dish-row,
.health-page .health-dialog .meal-calorie,
.health-page .health-dialog .meal-editor-images,
.health-page .health-dialog .dish-product-options button,
.health-page .health-dialog .body-source-images,
.health-page .health-dialog .body-extra-fields,
.health-page .health-dialog .body-photo-feedback,
.health-page .health-dialog .health-history-import,
.health-page .body-trash,
.health-page .body-trash-toggle { border: 1px solid #d2e3ea; }
#health-editor .body-extra-fields, #health-editor .body-source-images, #health-editor .body-photo-feedback, #health-editor .health-history-import { background: #f8fbfd; }
.health-page .health-dialog :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea, .popopo-date-display) { border: 1px solid #d2e3ea; }
.health-page #health-editor .health-form-grid :is(input:not([type="checkbox"]), select),
.health-page #health-editor .popopo-date-display { border: 1px solid #d2e3ea; }
.health-page .health-dialog .health-photo-add,
.health-page .health-dialog .add-dish { border: 1px dashed #b8d4df; }
.health-page .camera-flow-banner { --camera-frame-border: #d2e3ea; }
/* 待機中はダイアログ自体にフォーカスされるブラウザがある。操作部品のフォーカス表示は維持する。 */
.health-page #health-photo-reader.is-saving:focus { outline: none; }
.health-page .health-dialog :is(input, select, textarea, button):focus-visible { outline: 2px solid #628daa; outline-offset: 2px; }
.health-page .step-day.is-today { border-color: #b8d4df; box-shadow: none; }
.health-page .step-day:focus-visible { outline: 2px solid #628daa; outline-offset: -2px; }
.body-record-with-photo { display: flex; align-items: center; gap: 8px; }
.body-record-with-photo > .health-record { flex: 1; min-width: 0; }
.body-record-with-photo > .body-image-strip { flex: 0 0 auto; max-width: 70px; }
.body-record-with-photo .body-image-strip img { width: 52px; height: 52px; }
.body-image-error { color: #8b6874; font-size: 11px; line-height: 1.4; }
