/* 変数定義 */
:root {
  --primary-color: #4CAF50; /* 緑 */
  --secondary-color: #555; /* 濃いグレー */
  --light-gray: #f4f4f4;
  --dark-gray: #ccc;
  --white: #ffffff;
  --border-radius-sm: 5px;
  --border-radius-md: 10px;
  --border-radius-lg: 15px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
}

/* 全体的なスタイル */
body {
  font-family: 'Arial', sans-serif;
  margin: 0;
  padding: 20px;
  background-color: var(--light-gray);
  color: var(--secondary-color);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  box-sizing: border-box;
}

#main-content {
  width: 100%;
  max-width: 900px;
  background-color: var(--white);
  padding: 40px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

h1 {
  color: var(--primary-color);
  margin-bottom: 30px;
  font-size: 2.5em;
  letter-spacing: 1px;
}

/* 表示切り替えボタン */
#view-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
}

#view-buttons button {
  padding: 12px 25px;
  border: none;
  background-color: var(--primary-color);
  color: var(--white);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 1.1em;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: var(--shadow-sm);
}

#view-buttons button:hover {
  background-color: #3e8e41;
  transform: translateY(-2px);
}

/* カレンダーに戻るボタン */
.back-to-calendar {
  padding: 10px 20px;
  border: none;
  background-color: #6c757d; /* グレー */
  color: var(--white);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s ease, transform 0.2s ease;
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
}

.back-to-calendar:hover {
  background-color: #5a6268;
  transform: translateY(-1px);
}

/* === カレンダービューのスタイル === */
#calendar-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 15px 25px;
  background-color: var(--light-gray);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

#header button {
  padding: 8px 15px;
  border: none;
  background-color: var(--primary-color);
  color: var(--white);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 1.1em;
  transition: background-color 0.3s ease;
}

#header button:hover {
  background-color: #3e8e41;
}

#month-year {
  font-size: 1.8em;
  font-weight: 600;
  color: var(--secondary-color);
  margin: 0;
}

#calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  background-color: var(--white);
  padding: 20px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
}

.weekday {
  font-weight: bold;
  color: var(--primary-color);
  text-align: center;
  padding: 10px 0;
  font-size: 1.1em;
}

.day {
  aspect-ratio: 1 / 1; /* 正方形にする */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 5px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  background-color: #fcfcfc;
  border: 1px solid #eee;
  transition: background-color 0.2s ease;
  font-size: 1.1em;
  font-weight: 500;
  box-sizing: border-box;
  overflow: hidden; /* イベントがはみ出さないように */
  position: relative; /* 星マークを配置するために必要 */
}

.day:hover {
  background-color: #e0f2f1;
}

.day.empty {
  background-color: transparent;
  border: none;
  cursor: default;
}

.sunday {
  color: #dc3545; /* 赤 */
}

.saturday {
  color: #007bff; /* 青 */
}

/* カレンダーの日付セル内の星マーク */
.day .star-icon {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 0.8em;
  color: gold; /* 星の色 */
  z-index: 10;
}


.event {
  width: calc(100% - 4px); /* border-leftを含めた幅 */
  background-color: #e0e0e0;
  color: #333;
  font-size: 0.75em;
  padding: 2px 4px;
  border-radius: 3px;
  margin-top: 3px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  border-left: 4px solid var(--primary-color); /* カテゴリ色で上書きされる */
}

.event.more-indicator {
  font-weight: bold;
  text-align: center;
  background-color: #f0f0f0 !important;
  color: #666 !important;
}

#event-list-container {
  background-color: var(--white);
  padding: 25px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  margin-top: 20px;
  text-align: left;
}

#event-list-container h2 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--light-gray);
  padding-bottom: 10px;
}

#event-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#event-list li {
  background-color: #f8f8f8;
  padding: 12px 15px;
  margin-bottom: 10px;
  border-radius: var(--border-radius-md);
  border-left: 5px solid var(--dark-gray); /* JSでカテゴリ色に上書き */
  font-size: 1em;
  color: #333;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

#event-list li:hover {
  transform: translateX(5px);
}

/* 今月の振り返りボタン */
#monthly-review-btn {
  padding: 12px 25px;
  border: none;
  background-color: #007bff; /* 青系統の色 */
  color: var(--white);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 1.1em;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: var(--shadow-sm);
  margin-top: 20px; /* カレンダーとの間隔 */
}

#monthly-review-btn:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
}


/* === 日単位表示パネルのスタイル === */
#daily-view-panel {
  display: none; /* JSで表示制御 */
  margin-top: 30px;
  width: 100%;
  max-width: 900px;
  background-color: var(--white);
  padding: 30px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  box-sizing: border-box;
  text-align: center;
}

#daily-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 15px 25px;
  background-color: var(--light-gray);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  box-sizing: border-box;
}

#daily-view-header button {
  padding: 8px 15px;
  border: none;
  background-color: var(--primary-color);
  color: var(--white);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 1.1em;
  transition: background-color 0.3s ease;
}

#daily-view-header button:hover {
  background-color: #3e8e41;
}

/* 星マークボタンのスタイル */
.star-btn {
  background: none !important;
  border: none !important;
  color: gold !important;
  font-size: 2em !important;
  cursor: pointer;
  padding: 0 !important;
  box-shadow: none !important;
  transition: transform 0.1s ease, color 0.1s ease;
  margin-left: 10px;
  margin-right: 10px;
}

.star-btn.active {
  color: gold;
  transform: scale(1.1);
}

.star-btn:hover {
  transform: scale(1.2);
  color: #ffd700;
}


#daily-current-date {
  font-size: 1.6em;
  font-weight: 600;
  color: var(--secondary-color);
  margin: 0;
  flex-grow: 1;
  text-align: right;
  padding-right: 15px;
}

.daily-comparison-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  margin-top: 20px;
  text-align: left;
}

.daily-timeline-section {
  background-color: #fcfcfc;
  border-radius: var(--border-radius-md);
  border: 1px solid #eee;
  padding: 20px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.daily-timeline-section h3 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.3em;
}

.daily-timeline-content {
  position: relative;
  height: 600px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: var(--border-radius-sm);
  padding-top: 10px;
}

.time-slot {
  position: relative;
  height: 40px;
  border-bottom: 1px dashed #eee;
}

.time-label {
  position: absolute;
  left: 5px;
  top: -10px;
  font-size: 0.8em;
  color: #888;
  background-color: var(--white);
  padding: 0 5px;
  z-index: 1;
}

.schedule-event {
  position: absolute;
  left: 50px;
  right: 5px;
  background-color: #e0f7fa;
  border-left: 5px solid #00bcd4;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 0.9em;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  box-sizing: border-box;
}

.add-schedule-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: var(--white);
  border: none;
  font-size: 1.5em;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.3s ease;
}

.add-schedule-btn:hover {
  background-color: #3e8e41;
}

.daily-divider {
  width: 2px;
  background-color: var(--dark-gray);
  height: 100%;
  min-height: 500px;
}

/* 実際の結果セクション内のToDoリスト */
.actual-sub-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.actual-sub-section h4 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 1.1em;
  text-align: center;
}

.add-todo-area {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#daily-new-todo {
  flex-grow: 1;
  padding: 10px;
  border: 1px solid var(--dark-gray);
  border-radius: var(--border-radius-md);
  font-size: 0.95em;
}

#daily-add-todo {
  padding: 10px 15px;
  border: none;
  background-color: var(--primary-color);
  color: var(--white);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 0.95em;
  transition: background-color 0.3s ease;
  box-shadow: var(--shadow-sm);
}

#daily-add-todo:hover {
  background-color: #3e8e41;
}

#daily-todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#daily-todo-list li {
  display: flex;
  align-items: center;
  background-color: #f8f8f8;
  padding: 10px 15px;
  margin-bottom: 8px;
  border-radius: var(--border-radius-md);
  border: 1px solid #eee;
  box-shadow: var(--shadow-sm);
}

#daily-todo-list li input[type="checkbox"] {
  margin-right: 10px;
  transform: scale(1.2);
  accent-color: var(--primary-color);
  cursor: pointer;
}

#daily-todo-list li span {
  flex-grow: 1;
  font-size: 0.95em;
  color: #333;
}

#daily-todo-list li .delete-todo-btn {
  padding: 5px 10px;
  background-color: #dc3545;
  color: var(--white);
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 0.8em;
  transition: background-color 0.3s ease;
  margin-left: 15px;
  box-shadow: var(--shadow-sm);
}

#daily-todo-list li .delete-todo-btn:hover {
  background-color: #c82333;
}

/* 振り返りセクション */
.daily-reflection-section {
  background-color: #f8f8f8;
  padding: 25px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  margin-top: 30px;
  text-align: left;
}

.daily-reflection-section h3 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.3em;
}

#daily-reflection-text {
  width: calc(100% - 20px);
  padding: 10px;
  border: 1px solid var(--dark-gray);
  border-radius: var(--border-radius-md);
  font-size: 1em;
  resize: vertical;
  min-height: 100px;
  box-sizing: border-box;
  margin-bottom: 15px;
}

#save-reflection-btn {
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: var(--white);
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s ease;
  box-shadow: var(--shadow-sm);
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#save-reflection-btn:hover {
  background-color: #3e8e41;
}

/* === 新しく追加する出費セクションのスタイル === */
.daily-expenses-section {
  background-color: #f8f8f8;
  padding: 25px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  margin-top: 30px; /* 振り返りセクションとの間隔 */
  text-align: center; /* 中央寄せ */
  position: relative; /* 罫線のため */
}

.daily-expenses-section h3 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.3em;
}

.expense-input-area {
  display: flex;
  justify-content: center; /* 中央寄せ */
  gap: 10px;
  margin-bottom: 20px;
}

.expense-input-area input {
  padding: 10px;
  border: 1px solid var(--dark-gray);
  border-radius: var(--border-radius-md);
  font-size: 0.95em;
  width: 120px; /* 用途と金額の入力欄の幅を調整 */
}

.expense-input-area input[type="text"] {
  flex-grow: 1; /* 用途入力欄を少し広げる */
  max-width: 200px;
}

.expense-input-area input[type="number"] {
  max-width: 100px;
}


.expense-input-area button {
  padding: 10px 15px;
  border: none;
  background-color: var(--primary-color);
  color: var(--white);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 0.95em;
  transition: background-color 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.expense-input-area button:hover {
  background-color: #3e8e41;
}

#expense-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid #ddd; /* 外側の罫線 */
  border-radius: var(--border-radius-md);
  overflow: hidden; /* 角丸のため */
  background-color: var(--white);
}

#expense-list li {
  display: grid;
  grid-template-columns: 1fr 100px auto; /* 用途、金額、削除ボタン */
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #eee; /* 行間の罫線 */
  font-size: 0.95em;
  color: #333;
  text-align: left;
}

#expense-list li:last-child {
  border-bottom: none; /* 最後の子要素の下線は不要 */
}

#expense-list li span:first-child {
  /* 用途 */
}

#expense-list li span:nth-child(2) {
  /* 金額 */
  text-align: right;
  padding-right: 10px;
}

#expense-list li .delete-expense-btn {
  padding: 5px 10px;
  background-color: #dc3545;
  color: var(--white);
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 0.8em;
  transition: background-color 0.3s ease;
  margin-left: 15px;
  box-shadow: var(--shadow-sm);
}

#expense-list li .delete-expense-btn:hover {
  background-color: #c82333;
}

/* ヘッダー行 */
#expense-list::before {
  content: "用途                                          金額"; /* スペースで調整 */
  display: grid;
  grid-template-columns: 1fr 100px auto; /* 用途、金額、削除ボタン（ここでは表示されない） */
  padding: 10px 15px;
  font-weight: bold;
  background-color: #e0e0e0;
  border-bottom: 1px solid #ddd;
  color: var(--secondary-color);
  text-align: left;
}

/* 合計金額表示エリア */
.total-expense-area {
  margin-top: 20px;
  font-size: 1.2em;
  font-weight: bold;
  color: var(--primary-color);
  text-align: right; /* 右寄せ */
  padding-right: 15px; /* リストと揃えるため */
}


/* === 週単位表示パネルのスタイル === */
#weekly-view-panel {
  display: none; /* JSで表示制御 */
  margin-top: 30px;
  width: 100%;
  max-width: 900px; /* 週ビューの最大幅を調整 */
  background-color: var(--white);
  padding: 30px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  box-sizing: border-box;
  text-align: center;
}

#weekly-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 15px 25px;
  background-color: var(--light-gray);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  box-sizing: border-box;
}

#weekly-header button {
  padding: 8px 15px;
  border: none;
  background-color: var(--primary-color);
  color: var(--white);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 1.1em;
  transition: background-color 0.3s ease;
}

#weekly-header button:hover {
  background-color: #3e8e41;
}

#weekly-range {
  font-size: 1.4em;
  font-weight: 600;
  color: var(--secondary-color);
  margin: 0;
}

/* 予定/実際 切り替えボタン */
.schedule-toggle-buttons {
  display: flex;
  justify-content: center;
  margin-bottom: 25px;
  background-color: #eee;
  border-radius: var(--border-radius-lg);
  padding: 5px;
  box-shadow: var(--shadow-sm) inset;
}

.schedule-toggle-buttons button {
  flex: 1;
  padding: 10px 20px;
  border: none;
  background-color: transparent;
  color: #555;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--border-radius-lg);
  transition: all 0.3s ease;
}

.schedule-toggle-buttons button.active {
  background-color: var(--primary-color);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.schedule-toggle-buttons button:not(.active):hover {
  background-color: #e0e0e0;
}

/* グラフコンテナ */
.weekly-chart-container {
  position: relative;
  width: 100%;
  height: 400px; /* グラフの高さ */
  margin-bottom: 30px;
  background-color: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  padding: 20px;
  box-sizing: border-box;
}

/* Chart.js の凡例 */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px 25px;
  margin-top: 20px;
  margin-bottom: 40px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  font-size: 1em;
  color: #555;
}

.chart-legend-color {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  margin-right: 8px;
  border: 1px solid rgba(0,0,0,0.1);
}

/* 目標ごとの振り返りセクション */
.goal-reflection-section {
  background-color: #f8f8f8;
  padding: 25px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  margin-top: 30px;
  text-align: left;
}

.goal-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 15px;
}

.goal-header input[type="checkbox"] {
  transform: scale(1.3);
  margin-right: 12px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.goal-header label {
  font-size: 1.2em;
  font-weight: 600;
  color: var(--secondary-color);
  cursor: pointer;
}

#goal-list {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-bottom: 20px;
  max-height: 200px; /* スクロール可能にするため */
  overflow-y: auto;
}

#goal-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--white);
  padding: 10px 15px;
  margin-bottom: 10px;
  border-radius: var(--border-radius-md);
  border: 1px solid #eee;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#goal-list li .goal-item-content {
  display: flex;
  align-items: center;
  flex-grow: 1;
}

#goal-list li .goal-color-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  margin-right: 10px;
  border: 1px solid rgba(0,0,0,0.1);
}

#goal-list li span {
  font-size: 1em;
  color: #333;
  flex-grow: 1;
}

#goal-list li .delete-goal-btn {
  padding: 6px 12px;
  background-color: #dc3545; /* Red */
  color: var(--white);
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 0.85em;
  transition: background-color 0.3s ease;
  margin-left: 15px;
  box-shadow: var(--shadow-sm);
}

#goal-list li .delete-goal-btn:hover {
  background-color: #c82333;
}

#add-goal-btn {
  padding: 10px 20px;
  background-color: #007bff;
  color: var(--white);
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s ease;
  box-shadow: var(--shadow-sm);
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#add-goal-btn:hover {
  background-color: #0056b3;
}

/* === 月単位振り返りパネルのスタイル === */
#monthly-review-panel {
  display: none; /* JSで表示制御 */
  margin-top: 30px;
  width: 100%;
  max-width: 900px;
  background-color: var(--white);
  padding: 30px; /* 適切なパディングを設定 */
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  box-sizing: border-box;
  text-align: center;
}

#monthly-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 15px 0px;
  margin-bottom: 20px;
  box-sizing: border-box;
  border-bottom: 2px solid var(--light-gray);
}

#monthly-review-header .back-to-calendar {
  margin-top: 0;
}

#monthly-review-title {
  color: var(--primary-color);
  font-size: 1.8em;
  margin: 0 auto;
  flex-grow: 1; /* タイトルが中央に広がるように */
  text-align: center;
  padding-left: 10px; /* ボタンとの隙間調整 */
  padding-right: 10px; /* ボタンとの隙間調整 */
}

.review-section {
  background-color: #f8f8f8;
  padding: 25px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  margin-top: 30px;
  margin-bottom: 30px; /* 各セクションの下に余白を追加 */
  text-align: left;
}

.review-section:last-child {
    margin-bottom: 0; /* 最後のセクションには下余白不要 */
}

.review-section h3 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.4em;
  border-bottom: 1px dashed #ddd;
  padding-bottom: 10px;
}

.review-section h4 {
  color: var(--secondary-color);
  font-size: 1.2em;
  margin-top: 20px;
  margin-bottom: 15px;
  text-align: center;
}

.section-description {
  font-size: 0.95em;
  color: #666;
  margin-bottom: 15px;
  text-align: center;
}

.section-description .highlight {
  color: #007bff;
  font-weight: bold;
}

/* 月次サマリーセクション */
.monthly-summary-section .chart-container {
  width: 100%; /* 親要素の幅いっぱいに */
  max-width: 500px; /* 最大幅を設定 */
  height: 400px; /* グラフの高さも確保 */
  margin: 0 auto 20px auto; /* 中央寄せと下部余白 */
  position: relative; /* Canvasがはみ出さないように */
  display: flex; /* Chart.jsのCanvasがflexアイテムとして中央配置されやすくなる */
  justify-content: center;
  align-items: center;
}

/* Canvas要素そのもののスタイルはChart.jsが制御しますが、親コンテナが重要です */
#monthly-pie-chart {
    max-width: 100%; /* 親コンテナのサイズに合わせる */
    max-height: 100%; /* 親コンテナのサイズに合わせる */
}


.monthly-summary-section .chart-description {
  text-align: center;
  margin-top: 15px;
  font-size: 0.9em;
  color: #777;
}

/* カテゴリごとの振り返りセクション */
.category-item-review {
    background-color: var(--white);
    padding: 20px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid #eee;
    text-align: left;
}

.category-item-review h4 {
    color: var(--primary-color);
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px dashed #eee;
    padding-bottom: 10px;
}

.category-item-review p {
    font-size: 1.05em;
    color: #333;
    margin-bottom: 10px;
    text-align: center; /* 中央寄せに */
}

/* 時給入力部分のスタイル */
.hourly-wage-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.hourly-wage-input label {
    font-weight: bold;
    color: var(--secondary-color);
    white-space: nowrap;
}

.hourly-wage-input input[type="number"] {
    padding: 8px 12px;
    border: 1px solid var(--dark-gray);
    border-radius: var(--border-radius-md);
    font-size: 1em;
    width: 100px; /* 幅を固定 */
    text-align: right;
    -moz-appearance: textfield; /* Firefoxで矢印を非表示 */
}

/* Chrome, Safari, Edge, Operaで矢印を非表示 */
.hourly-wage-input input[type="number"]::-webkit-outer-spin-button,
.hourly-wage-input input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}


/* カテゴリごとの振り返りセクション - 勉強テーブル */
.category-study-review {
  margin-top: 30px;
  border-top: 1px solid #eee;
  padding-top: 20px;
}

.study-review-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  text-align: left; /* テーブルのテキストは左寄せ */
}

.study-review-table th,
.study-review-table td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: left;
}

.study-review-table th {
  background-color: #e0e0e0;
  font-weight: bold;
  color: var(--secondary-color);
}

.study-review-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}


/* 出費と収入セクション */
.expenses-income-section .summary-amounts {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  font-size: 1.1em;
  font-weight: bold;
  color: var(--primary-color);
  border-bottom: 1px dashed #ddd;
  padding-bottom: 15px;
  text-align: center; /* 子要素のテキストを中央寄せ */
}

.expenses-income-section .summary-amounts p {
    margin: 0; /* Pタグのデフォルトマージンをリセット */
    flex-basis: 48%; /* 各Pタグが均等な幅を占めるように */
    display: flex;
    flex-direction: column; /* テキストと金額を縦に並べる場合 */
    align-items: center; /* 中央寄せ */
}
.expenses-income-section .summary-amounts span {
    display: block; /* 金額をブロック要素にして改行 */
    font-size: 1.2em; /* 金額を少し大きく */
    color: #333; /* 金額の色を少し濃く */
}

/* 月次サマリーセクションのテーブル（出費まとめ） */
/* index.htmlのtable要素にmonthly-summary-sectionが直接指定されているため、
   ここを調整することで出費まとめテーブルに影響を与えます。 */
.daily-expenses-section { /* monthly-review-panel内のmonthly-summary-sectionにあるtableに適用 */
  width: 100%; /* 親要素の幅いっぱいに広げる */
  border-collapse: collapse;
  margin-top: 15px;
  margin-left: auto; /* 左マージンを自動調整 */
  margin-right: auto; /* 右マージンを自動調整 */
  max-width: 600px; /* 必要に応じて最大幅を設定 */
}

.monthly-review-panel .monthly-summary-section th,
.monthly-review-panel .monthly-summary-section td {
  border: 1px solid #ddd;
  padding: 10px;
}

.monthly-review-panel .monthly-summary-section th {
  background-color: #e0e0e0;
  font-weight: bold;
  color: var(--secondary-color);
  text-align: left; /* ヘッダーのテキストを左寄せに統一 */
}

/* テーブルのtbody内のtrの偶数行に背景色 */
.monthly-review-panel .monthly-summary-section tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* 各列のテキストアラインメント調整 */
.monthly-review-panel .monthly-summary-section th:nth-child(1),
.monthly-review-panel .monthly-summary-section td:nth-child(1) {
  text-align: left; /* 日付を左寄せ */
  width: 20%; /* 必要に応じて幅調整 */
}

.monthly-review-panel .monthly-summary-section th:nth-child(2),
.monthly-review-panel .monthly-summary-section td:nth-child(2) {
  text-align: left; /* 用途を左寄せ */
  width: 50%; /* 必要に応じて幅調整 */
}

.monthly-review-panel .monthly-summary-section th:nth-child(3),
.monthly-review-panel .monthly-summary-section td:nth-child(3) {
  text-align: right; /* 金額を右寄せ */
  width: 30%; /* 必要に応じて幅調整 */
}

/* 合計行のスタイル調整 (script.jsで'total-expense'クラスが追加される想定) */
.monthly-review-panel .monthly-summary-section .total-expense {
    background-color: #e8f5e9; /* 薄い緑色の背景 */
    font-weight: bold;
}
.monthly-review-panel .monthly-summary-section .total-expense td {
    border-top: 2px solid var(--primary-color); /* 上部に強調線 */
}
/* 思い出の振り返りセクション */
.memory-reflection-section .section-description {
  margin-bottom: 25px; /* 説明文とグリッドの間隔を調整 */
}

.starred-reflections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.starred-reflection-item {
  background-color: var(--white);
  border: 1px solid #eee;
  border-radius: var(--border-radius-md);
  padding: 15px;
  box-shadow: var(--shadow-sm);
  position: relative;
  text-align: left;
}

.starred-reflection-item h5 {
  font-size: 1.1em;
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}

.starred-reflection-item p {
  font-size: 0.9em;
  color: #444;
  line-height: 1.5;
  white-space: pre-wrap; /* 改行を保持 */
  max-height: 150px; /* 適切な高さに制限 */
  overflow-y: auto; /* 溢れたらスクロール */
}


/* === モーダル共通スタイル (既存と統合または上書き) === */
/* schedule-add-modal, todo-add-modal にも適用 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background-color: var(--white);
  padding: 30px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-content h3 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.4em;
}

.modal-content label {
  text-align: left;
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--secondary-color);
}

.modal-content input[type="time"],
.modal-content input[type="text"],
.modal-content select {
  width: calc(100% - 20px);
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid var(--dark-gray);
  border-radius: var(--border-radius-md);
  font-size: 1em;
  box-sizing: border-box;
}

.modal-content button {
  padding: 12px 25px;
  border: none;
  background-color: var(--primary-color);
  color: var(--white);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 1.1em;
  transition: background-color 0.3s ease;
  box-shadow: var(--shadow-sm);
  width: 100%;
  margin-top: 10px;
}

.modal-content button:hover {
  background-color: #3e8e41;
  transform: translateY(-1px);
}

/* 目標タグ選択のカラープレビュー */
.goal-color-preview {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  margin-left: 10px;
  border: 1px solid #ccc;
  vertical-align: middle;
  display: inline-block;
}

/* レスポンシブデザインの調整 */
@media (max-width: 992px) {
  #weekly-view-panel {
    padding: 20px;
  }
  .weekly-chart-container {
    height: 350px;
  }
}

@media (max-width: 768px) {
  #weekly-header button {
    font-size: 0.9em;
    padding: 6px 12px;
  }
  #weekly-range {
    font-size: 1.2em;
  }
  .schedule-toggle-buttons button {
    font-size: 1em;
    padding: 8px 15px;
  }
  .weekly-chart-container {
    height: 300px;
    padding: 10px;
  }
  .chart-legend {
    gap: 10px 15px;
    font-size: 0.9em;
  }
  .chart-legend-color {
    width: 15px;
    height: 15px;
  }
  .goal-reflection-section {
    padding: 15px;
  }
  .goal-header label {
    font-size: 1.1em;
  }
  #goal-list li {
    font-size: 0.9em;
    padding: 8px 10px;
  }
  #goal-list li .delete-goal-btn {
    padding: 5px 10px;
    font-size: 0.8em;
  }
  .daily-expenses-section .expense-input-area input {
    width: 80px; /* 小さい画面での幅調整 */
  }

  /* 月次振り返りパネルの調整 */
  #monthly-review-header h2 {
    font-size: 1.5em;
  }
  .review-section {
    padding: 15px;
  }
  .review-section h3 {
    font-size: 1.2em;
  }
  .review-section h4 {
    font-size: 1.1em;
  }
  .monthly-summary-section .chart-container { /* グラフコンテナの幅調整 */
    width: 100%;
    height: 280px; /* モバイルでのグラフの高さ */
  }
  .starred-reflections-grid {
    grid-template-columns: 1fr; /* 1列にする */
  }
}