:root {
  --bg: #F7F6F2;
  --surface: #FFFFFF;
  --border: #E7E3D8;
  --text: #33312C;
  --text-muted: #948F82;
  --accent-bg: #EAF1EC;
  --accent-border: #BFDCC9;
  --accent-text: #2E6A4E;
  --danger-bg: #FBEAE8;
  --danger-text: #B3453B;
  --today: #3478F6;
  --selected: #5B6EF5;
}

body {
  margin: 0;
  padding-top: 56px;
  padding-bottom: 64px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

/* ==== レイアウト ==== */
.container {
  max-width: 420px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

/* ==== フォーム ==== */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-sizing: border-box;
  background: var(--surface);
  color: var(--text);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.alert {
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 1rem;
}

/* ==== ボタン ==== */
.btn {
  display: inline-block;
  padding: 12px;
  font-size: 15px;
  text-align: center;
  border: none;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.btn-block {
  width: 100%;
  box-sizing: border-box;
}

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 8px;
  background: var(--accent-bg);
  color: var(--accent-text);
}

.btn-text {
  font-size: 14px;
  text-decoration: none;
  color: var(--text-muted);
  background: none;
  border: none;
  -webkit-appearance: none;
  appearance: none;
}

.btn-order {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.btn-order:disabled {
  color: var(--text-muted);
  opacity: 0.4;
  cursor: default;
}

/* ==== カード ==== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-title {
  font-size: 19px;
  font-weight: 500;
}

/* ==== 成功メッセージ ==== */
.notice {
  background: var(--accent-bg);
  color: var(--accent-text);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 1rem;
}

/* ==== カレンダー ==== */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.calendar-month-label {
  font-size: 19px;
  font-weight: 600;
}

.calendar-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.calendar-nav-arrow {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-left: 2px solid var(--text);
  border-bottom: 2px solid var(--text);
}

.calendar-nav-prev {
  transform: rotate(45deg);
}

.calendar-nav-next {
  transform: rotate(-135deg);
}

.calendar-grid {
  background: var(--surface);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.calendar-weekday {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 48px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  box-sizing: border-box;
  border: 1.5px solid transparent;
}

.calendar-day-number {
  font-size: 16px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.calendar-day-label {
  display: none;
}

.calendar-day-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  margin: 2px auto 0;
  visibility: hidden;
}

.calendar-day.is-registered .calendar-day-dot {
  visibility: visible;
  background-color: var(--accent-text);
}

.calendar-day.is-today {
  border-color: var(--today);
  border-width: 2px;
}

.calendar-day.is-today .calendar-day-number {
  color: var(--today);
  font-weight: 700;
}

.calendar-day.is-registered {
  background: var(--accent-bg);
}

.calendar-day.is-selected .calendar-day-number {
  background: var(--selected);
  color: #fff;
  font-weight: 600;
}

/* ==== メニュー検索候補 ==== */
.menu-search-wrapper {
  position: relative;
}

.menu-search-wrapper::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 15px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.menu-search-input {
  padding-right: 28px;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.search-result-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  font-size: 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--accent-bg);
}


/* ==== 詳細パネル ==== */
.detail-meal-time {
  font-size: 15px;
  color: var(--text-muted);
  margin: 12px 0 6px;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-label {
  color: var(--text-muted);
  width: 44px;
  flex-shrink: 0;
  font-size: 14px;
}

.detail-recipe {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
  padding: 2px 0 6px;
}

.detail-note {
  font-size: 15px;
  color: var(--text-muted);
  padding: 2px 0 4px;
}

.detail-empty {
  font-size: 16px;
  color: var(--text-muted);
}

/* ==== タップハイライト除去・タブ区切り線 ==== */
a, button, .tab-item, .app-header-logout-form button {
  -webkit-tap-highlight-color: transparent;
}

/* ==== タブバー（画面下部に固定するフッター） ==== */
.tab-bar-fixed {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 10;
}

.tab-bar-inner {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom));
}

.tab-item {
  font-size: 15px;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  flex: 1;
  padding: 0 8px;
}

.tab-item:not(:last-child) {
  border-right: 1px solid var(--border);
}

.tab-item.is-active {
  font-weight: 500;
  color: var(--accent-text);
}

/* ==== 設定リスト ==== */
.settings-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.settings-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.settings-list li:last-child .settings-link {
  border-bottom: none;
}

.settings-link::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg);
  flex-shrink: 0;
  margin-left: 8px;
}

.settings-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 16px;
  border-bottom: 1px solid var(--border);
}

.settings-list li:last-child .settings-list-item {
  border-bottom: none;
}

.settings-list-item form {
  margin: 0;
}

/* ==== トグルスイッチ ==== */
.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 13px;
  background: var(--border);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}

.toggle-switch.is-on {
  background: var(--accent-text);
}

.toggle-switch.is-on::after {
  transform: translateX(20px);
}

/* ==== 設定：戻るリンク ==== */
.settings-back {
  display: flex;
  align-items: center;
  padding: 8px 4px;
  font-size: 16px;
  color: var(--text-muted);
  text-decoration: none;
}

.settings-back-arrow {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-left: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  margin-right: 8px;
}

/* ==== ヘッダー ==== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  z-index: 10;
}

.app-header-user {
  font-size: 16px;
  color: var(--text-muted);
}

.app-header-logout-form {
  margin: 0;
}
