/* ============================================================
   mogu mogu Dog - My Page Stylesheet
   カルテ風マイページ用スタイル
   ============================================================ */

:root {
  --teal: #40BFC0;
  --teal-dark: #2fa3a4;
  --teal-light: #e6f7f7;
  --teal-mid: #b3e8e9;
  --orange: #FF7B54;
  --orange-light: #fff1ec;
  --orange-dark: #e55c2e;
  --green: #52b788;
  --green-light: #edf7f2;
  --pink: #f87171;
  --pink-light: #fef2f2;
  --purple: #a78bfa;
  --purple-light: #f5f3ff;
  --bg: #f7fafa;
  --bg-card: #ffffff;
  --border: #e2eded;
  --text: #1a3a3a;
  --text-mid: #4a6b6b;
  --text-light: #8aaaaa;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(64,191,192,0.10);
  --shadow-md: 0 4px 24px rgba(64,191,192,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #fff;
  border-right: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
  height: 36px;
  object-fit: contain;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-mid);
  cursor: pointer;
  padding: 4px 8px;
}

/* ペット切り替え */
.pet-switcher {
  padding: 16px;
  background: var(--teal-light);
  margin: 12px;
  border-radius: var(--radius-sm);
}

.pet-switcher-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--teal-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.pet-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pet-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  border: 2px solid transparent;
}

.pet-tab:hover { background: rgba(64,191,192,0.1); }
.pet-tab.active { background: #fff; border-color: var(--teal); }

.pet-tab-photo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--teal-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}

.pet-tab-photo img { width: 100%; height: 100%; object-fit: cover; }

.pet-tab-info { flex: 1; min-width: 0; }
.pet-tab-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pet-tab-breed { font-size: 11px; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.btn-add-pet {
  width: 100%;
  margin-top: 8px;
  padding: 7px;
  border: 1.5px dashed var(--teal);
  background: transparent;
  border-radius: 8px;
  color: var(--teal-dark);
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-add-pet:hover { background: rgba(64,191,192,0.1); }

/* サイドナビ */
.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
}

.sidebar-nav ul { list-style: none; }
.sidebar-nav li + li { margin-top: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-mid);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-item i { font-size: 16px; width: 20px; text-align: center; }
.nav-item:hover { background: var(--teal-light); color: var(--teal-dark); }
.nav-item.active { background: var(--teal); color: #fff; font-weight: 700; box-shadow: 0 2px 8px rgba(64,191,192,0.35); }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}
.sidebar-back-btn:hover { background: var(--teal-light); color: var(--teal-dark); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 99;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 50;
}

.topbar-menu {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-mid);
  cursor: pointer;
  padding: 4px 8px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-btn {
  position: relative;
  background: var(--teal-light);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  color: var(--teal-dark);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar-btn:hover { background: var(--teal); color: #fff; }

.notif-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--orange);
  border-radius: 50%;
  border: 2px solid #fff;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

#userName { font-size: 13px; font-weight: 600; color: var(--text); }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.tab-content {
  display: none;
  padding: 28px 28px 48px;
  flex: 1;
  animation: fadeIn 0.3s ease;
}
.tab-content.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  font-family: 'Zen Maru Gothic', sans-serif;
}

.page-desc {
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 4px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary-sm:hover { background: var(--teal-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(64,191,192,0.3); }

.btn-primary-lg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary-lg:hover { background: var(--teal-dark); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(64,191,192,0.35); }

.btn-outline-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--teal);
  border: 1.5px solid var(--teal);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-outline-sm:hover { background: var(--teal); color: #fff; }

.btn-cancel {
  background: #f0f0f0;
  color: var(--text-mid);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel:hover { background: #e0e0e0; }

.btn-danger-sm {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger-sm:hover { background: #dc2626; }

.btn-orange-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-orange-sm:hover { background: var(--orange-dark); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.current-pet-hero {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  border-radius: var(--radius);
  padding: 24px 28px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
}

.current-pet-hero::before {
  content: '🐾';
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 80px;
  opacity: 0.15;
}

.cph-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.6);
  object-fit: cover;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
  overflow: hidden;
}
.cph-photo img { width: 100%; height: 100%; object-fit: cover; }

.cph-info { flex: 1; }
.cph-name { font-size: 22px; font-weight: 800; margin-bottom: 4px; font-family: 'Zen Maru Gothic', sans-serif; }
.cph-meta { font-size: 13px; opacity: 0.85; margin-bottom: 8px; }
.cph-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.cph-tag {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

/* サマリーグリッド */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.summary-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--teal);
  transition: transform 0.2s;
}
.summary-card:hover { transform: translateY(-2px); }
.summary-card.teal { border-left-color: var(--teal); }
.summary-card.orange { border-left-color: var(--orange); }
.summary-card.green { border-left-color: var(--green); }
.summary-card.pink { border-left-color: var(--pink); }

.summary-icon {
  font-size: 22px;
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.summary-card.teal .summary-icon { background: var(--teal-light); color: var(--teal); }
.summary-card.orange .summary-icon { background: var(--orange-light); color: var(--orange); }
.summary-card.green .summary-icon { background: var(--green-light); color: var(--green); }
.summary-card.pink .summary-icon { background: var(--pink-light); color: var(--pink); }

.summary-num { font-size: 15px; font-weight: 800; color: var(--text); }
.summary-label { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ダッシュボード行 */
.dashboard-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.dashboard-card.flex-2 { flex: 2; }
.dashboard-card.flex-1 { flex: 1; }

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

.card-header-row h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-header-row h3 i { color: var(--teal); }

.card-link {
  font-size: 12px;
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}
.card-link:hover { text-decoration: underline; }

/* メニューサマリー */
.menu-summary { display: flex; flex-direction: column; gap: 8px; }
.menu-item-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.menu-item-row .mi-label { font-size: 11px; color: var(--text-light); min-width: 48px; }
.menu-item-row .mi-val { font-weight: 600; color: var(--text); }
.menu-item-row .mi-badge {
  font-size: 10px;
  background: var(--teal-light);
  color: var(--teal-dark);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

/* お知らせ */
.notice-list { display: flex; flex-direction: column; gap: 10px; }
.notice-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f9f9f9;
  font-size: 13px;
  line-height: 1.7;
}
.notice-item.new { background: var(--teal-light); }
.notice-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}
.notice-badge.new { background: var(--teal); color: #fff; }
.notice-badge.info { background: #3b82f6; color: #fff; }
.notice-badge.tip { background: var(--orange); color: #fff; }

.link-teal { color: var(--teal); font-weight: 600; text-decoration: none; }
.link-teal:hover { text-decoration: underline; }

/* ============================================================
   CARTE (カルテ)
   ============================================================ */
.carte-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

/* カルテ左 */
.carte-left { display: flex; flex-direction: column; gap: 16px; }

.carte-photo-area {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.carte-photo-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}

.carte-photo, .carte-photo-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
}

.carte-photo {
  display: none;
  border: 4px solid var(--teal-mid);
}

.carte-photo-placeholder {
  background: var(--teal-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 3px dashed var(--teal-mid);
}
.carte-photo-placeholder i { font-size: 36px; color: var(--teal); }
.carte-photo-placeholder span { font-size: 11px; color: var(--text-light); }

.carte-photo-upload {
  position: absolute;
  bottom: 4px; right: 4px;
  background: var(--teal);
  color: #fff;
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: all 0.2s;
}
.carte-photo-upload i { font-size: 12px; }
.carte-photo-upload:hover { background: var(--teal-dark); transform: scale(1.1); }

.carte-pet-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  font-family: 'Zen Maru Gothic', sans-serif;
}
.carte-pet-breed { font-size: 13px; color: var(--text-mid); margin-top: 2px; }
.carte-pet-age {
  display: inline-block;
  margin-top: 8px;
  background: var(--teal-light);
  color: var(--teal-dark);
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.carte-info-box {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
}

.carte-info-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
}

.carte-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.carte-info-item { display: flex; flex-direction: column; gap: 2px; }
.ci-label { font-size: 10px; color: var(--text-light); font-weight: 600; }
.ci-value { font-size: 13px; font-weight: 600; color: var(--text); }

.allergy-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.allergy-tag {
  background: var(--orange-light);
  color: var(--orange);
  border: 1px solid var(--orange);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.allergy-tag.none { background: var(--green-light); color: var(--green); border-color: var(--green); }

/* カルテ右 */
.carte-right { display: flex; flex-direction: column; gap: 16px; }

.carte-health-status {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
}

.health-status-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.health-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.health-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.health-chip.healthy { background: var(--green-light); color: var(--green); }
.health-chip.caution { background: #fff7ed; color: #d97706; }
.health-chip.care { background: var(--pink-light); color: var(--pink); }

.carte-body-stats {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.body-stat-item { display: flex; align-items: center; gap: 12px; }
.bsi-icon { font-size: 24px; }
.bsi-label { font-size: 11px; color: var(--text-light); }
.bsi-value { font-size: 16px; font-weight: 800; color: var(--text); }

.carte-memo-box {
  background: #fffdf4;
  border: 1.5px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 16px;
}

.carte-memo-text { font-size: 13px; color: var(--text-mid); line-height: 1.8; white-space: pre-wrap; }

.carte-timeline-box {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
}

.carte-timeline { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.timeline-item { display: flex; align-items: flex-start; gap: 12px; }
.tl-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.tl-dot.teal { background: var(--teal); }
.tl-dot.orange { background: var(--orange); }
.tl-dot.green { background: var(--green); }
.tl-content { display: flex; flex-direction: column; gap: 2px; }
.tl-date { font-size: 11px; color: var(--text-light); }
.tl-text { font-size: 13px; color: var(--text); }

/* ============================================================
   WEIGHT (体重記録)
   ============================================================ */
.weight-chart-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.chart-period-tabs { display: flex; gap: 4px; }
.period-tab {
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.2s;
}
.period-tab.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.period-tab:hover:not(.active) { border-color: var(--teal); color: var(--teal); }

.weight-stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.weight-stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 3px solid transparent;
}
.weight-stat-card.highlight { border-top-color: var(--teal); }

.ws-icon { font-size: 20px; margin-bottom: 6px; }
.ws-label { font-size: 11px; color: var(--text-light); margin-bottom: 4px; }
.ws-value { font-size: 16px; font-weight: 800; color: var(--text); }

.weight-records-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.records-count { font-size: 12px; color: var(--text-light); }

.weight-records-table-wrap { overflow-x: auto; margin-top: 4px; }

.records-table {
  width: 100%;
  border-collapse: collapse;
}
.records-table th, .records-table td {
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.records-table th {
  background: var(--bg);
  font-weight: 700;
  color: var(--text-mid);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.records-table tbody tr:hover { background: var(--teal-light); }
.empty-row { text-align: center; color: var(--text-light); padding: 32px; }

.bcs-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.bcs-1, .bcs-2 { background: #fef2f2; color: #ef4444; }
.bcs-3, .bcs-4, .bcs-5 { background: var(--green-light); color: var(--green); }
.bcs-6, .bcs-7 { background: #fff7ed; color: #d97706; }
.bcs-8, .bcs-9 { background: #fef2f2; color: #ef4444; }

.delete-row-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.2s;
}
.delete-row-btn:hover { color: #ef4444; background: #fef2f2; }

/* ============================================================
   CALORIE CALCULATOR TAB（カロリー計算タブ）
   ============================================================ */
.nav-item-calorie i { color: var(--teal); }

.mp-calorie-wrap {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 20px;
  align-items: start;
}

/* ── フォームパネル ── */
.mp-calc-form-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.mp-calc-panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}

/* 自動入力バー */
.mp-calc-prefill-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--teal-light);
  border-radius: var(--radius-sm);
  border: 1px solid var(--teal-mid);
}
.mp-calc-prefill-btn {
  padding: 6px 14px;
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: background 0.2s;
}
.mp-calc-prefill-btn:hover { background: var(--teal-dark); }
.mp-calc-prefill-hint { font-size: 12px; color: var(--text-mid); }

/* フィールド共通 */
.mp-calc-field { margin-bottom: 16px; }
.mp-calc-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 6px;
}
.mp-help-btn {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--teal-light);
  border: 1px solid var(--teal-mid);
  color: var(--teal);
  font-size: 9px; font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 4px;
  transition: background 0.2s;
}
.mp-help-btn:hover { background: var(--teal); color: white; }

/* 体重 */
.mp-calc-weight-row {
  display: flex; align-items: center; gap: 8px;
}
.mp-calc-w-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--teal);
  background: white;
  color: var(--teal);
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.mp-calc-w-btn:hover { background: var(--teal); color: white; }
.mp-calc-w-input-wrap {
  flex: 1;
  display: flex; align-items: center; gap: 6px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.mp-calc-w-input {
  width: 60px;
  border: none;
  background: transparent;
  font-size: 18px; font-weight: 700;
  color: var(--text);
  text-align: center;
}
.mp-calc-w-input:focus { outline: none; }

/* ラジオピル */
.mp-calc-radio-row { display: flex; flex-wrap: wrap; gap: 6px; }
.mp-calc-radio-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  background: white;
  color: var(--text);
  transition: all 0.2s;
  white-space: nowrap;
}
.mp-calc-radio-pill:hover { border-color: var(--teal); background: var(--teal-light); }
.mp-calc-radio-pill input[type="radio"] { display: none; }
.mp-calc-radio-pill:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-light);
  color: var(--teal-dark);
  font-weight: 700;
}

/* BCS スライダー */
.mp-bcs-wrap { padding: 4px 0; }
.mp-bcs-slider {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(to right, #ef4444 0%, #f97316 25%, #22c55e 50%, #eab308 75%, #ef4444 100%);
  outline: none; cursor: pointer;
}
.mp-bcs-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--teal);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  cursor: pointer;
}
.mp-bcs-value-row { text-align: center; margin-top: 6px; }
.mp-bcs-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  border: 1.5px solid;
  transition: all 0.25s;
}
.mp-bcs-guide { margin-top: 8px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }

/* 計算ボタン */
.mp-calc-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 4px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(64,191,192,0.3);
}
.mp-calc-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(64,191,192,0.4); }

/* ── 結果パネル ── */
.mp-result-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
}

/* メインカロリーカード */
.mp-result-main-card {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  text-align: center;
}
.mp-result-main-label { font-size: 11px; opacity: 0.85; margin-bottom: 4px; }
.mp-result-main-val {
  display: flex; align-items: baseline;
  justify-content: center; gap: 6px;
}
.mp-result-big-num { font-size: 44px; font-weight: 900; letter-spacing: -1px; }
.mp-result-unit { font-size: 14px; opacity: 0.9; }
.mp-result-rer { font-size: 11px; opacity: 0.8; margin-top: 6px; }

/* 3カラム */
.mp-result-trio {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.mp-result-trio-card {
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}
.mp-result-trio-card.teal   { background: var(--teal-light); border: 1px solid var(--teal-mid); }
.mp-result-trio-card.orange { background: var(--orange-light); border: 1px solid #ffd5bb; }
.mp-result-trio-card.green  { background: var(--green-light); border: 1px solid #bbf7d0; }
.mp-trio-icon { font-size: 20px; margin-bottom: 3px; }
.mp-trio-label { font-size: 10px; color: var(--text-light); margin-bottom: 4px; }
.mp-trio-val { font-size: 20px; font-weight: 800; color: var(--text); }
.mp-trio-val small { font-size: 10px; font-weight: 400; color: var(--text-light); margin-left: 2px; }
.mp-trio-sub { font-size: 10px; color: var(--text-light); margin-top: 2px; }

/* 栄養素テーブル */
.mp-nutrient-table {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.mp-nutrient-row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-mid);
}
.mp-nutrient-row-item strong { font-size: 14px; color: var(--teal-dark); }

/* コメント */
.mp-calc-comment {
  font-size: 11px;
  color: var(--text-mid);
  line-height: 1.7;
  padding: 8px 12px;
  background: #fffdf9;
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 10px;
}
.mp-calc-note {
  font-size: 10px;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 12px;
}

/* 保存ボタン */
.mp-save-result-btn {
  width: 100%;
  padding: 11px;
  background: white;
  border: 2px solid var(--teal);
  color: var(--teal);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s;
}
.mp-save-result-btn:hover { background: var(--teal); color: white; }
.mp-save-msg {
  margin-top: 8px;
  font-size: 12px;
  text-align: center;
  min-height: 18px;
}
.mp-save-msg.success { color: var(--green); }
.mp-save-msg.error   { color: #ef4444; }

/* 更新アニメーション */
@keyframes mpResultIn {
  from { opacity: 0.4; transform: translateY(6px); }
  to   { opacity: 1;   transform: translateY(0); }
}
.mp-result-panel.mp-result-updated {
  animation: mpResultIn 0.3s ease;
}

/* レスポンシブ */
@media (max-width: 860px) {
  .mp-calorie-wrap { grid-template-columns: 1fr; }
  .mp-result-panel { position: static; }
}
@media (max-width: 500px) {
  .mp-calc-radio-row { gap: 4px; }
  .mp-calc-radio-pill { padding: 5px 10px; font-size: 11px; }
  .mp-result-trio { grid-template-columns: 1fr 1fr 1fr; }
}

/* ── マイページ 計算根拠（details/summary） ── */
.mp-basis-details {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.mp-basis-summary {
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--teal-dark);
  background: var(--teal-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  user-select: none;
}
.mp-basis-summary::-webkit-details-marker { display: none; }
.mp-basis-summary::after {
  content: '▼';
  margin-left: auto;
  font-size: 9px;
  transition: transform 0.2s;
}
details[open] .mp-basis-summary::after { transform: rotate(180deg); }
.mp-basis-body {
  padding: 12px 14px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mp-basis-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 11px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.mp-basis-row:last-of-type { border-bottom: none; }
.mp-basis-label {
  font-weight: 700;
  color: var(--text-mid);
}
.mp-basis-val {
  color: var(--text);
  line-height: 1.6;
}
.mp-basis-val small {
  display: block;
  font-size: 10px;
  color: var(--text-light);
  margin-top: 1px;
}
.mp-basis-disclaimer {
  background: #fff8f0;
  border: 1px solid #ffd5a0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 10px;
  color: #92400e;
  line-height: 1.6;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.mp-basis-disclaimer i { color: #d97706; margin-top: 1px; flex-shrink: 0; }

/* ============================================================
   SUBSCRIPTION (定期便管理)
   ============================================================ */
.subscription-layout { display: flex; flex-direction: column; gap: 16px; }

.sub-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.sub-card-header {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}

.sub-plan-name { font-size: 18px; font-weight: 800; font-family: 'Zen Maru Gothic', sans-serif; }
.sub-status-badge {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,0.25);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5);
}
.sub-status-badge.active { background: #22c55e; border-color: #22c55e; }
.sub-status-badge.paused { background: #f59e0b; border-color: #f59e0b; }
.sub-status-badge.cancelled { background: #6b7280; border-color: #6b7280; }

.sub-card-body { padding: 20px 24px; }

.sub-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.sub-detail-item { display: flex; flex-direction: column; gap: 4px; }
.sdl { font-size: 11px; color: var(--text-light); font-weight: 600; }
.sdv { font-size: 14px; font-weight: 700; color: var(--text); }

.sub-menu-list { margin-bottom: 20px; }
.sub-menu-title { font-size: 12px; color: var(--text-mid); font-weight: 700; margin-bottom: 8px; }
.sub-menu-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sub-menu-tag {
  background: var(--teal-light);
  color: var(--teal-dark);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.sub-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.no-subscription {
  text-align: center;
  padding: 64px 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.no-sub-icon { font-size: 64px; margin-bottom: 16px; }
.no-subscription h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.no-subscription p { color: var(--text-mid); margin-bottom: 20px; }

/* ============================================================
   ORDERS (注文履歴)
   ============================================================ */
.orders-filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-select, .filter-input {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-card);
  outline: none;
  transition: border-color 0.2s;
}
.filter-select:focus, .filter-input:focus { border-color: var(--teal); }
.filter-input { flex: 1; min-width: 200px; }

.orders-list { display: flex; flex-direction: column; gap: 12px; }

.order-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s;
  cursor: pointer;
}
.order-card:hover { transform: translateX(4px); }

.order-num { font-size: 12px; color: var(--text-light); margin-bottom: 2px; }
.order-name { font-size: 14px; font-weight: 700; color: var(--text); }
.order-date { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.order-info { flex: 1; }
.order-price { font-size: 16px; font-weight: 800; color: var(--teal-dark); white-space: nowrap; }

.order-status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.order-status.pending { background: #fff7ed; color: #d97706; }
.order-status.confirmed { background: var(--teal-light); color: var(--teal-dark); }
.order-status.shipped { background: var(--purple-light); color: var(--purple); }
.order-status.delivered { background: var(--green-light); color: var(--green); }
.order-status.subscription { background: var(--teal-light); color: var(--teal-dark); }

.empty-orders {
  text-align: center;
  padding: 64px 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-orders p { color: var(--text-mid); margin-bottom: 20px; line-height: 1.8; }

/* ============================================================
   PROFILE (アカウント)
   ============================================================ */
.profile-layout { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

.profile-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 20px;
  box-shadow: var(--shadow);
}

.profile-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile-card h3 i { color: var(--teal); }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; }
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
  font-family: 'Noto Sans JP', sans-serif;
}
.form-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(64,191,192,0.1); }

textarea.form-input { resize: vertical; }
select.form-input { cursor: pointer; }

/* トグル */
.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.toggle-item:last-of-type { border-bottom: none; }

.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #cbd5e1;
  border-radius: 22px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--teal); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  animation: modalIn 0.3s ease;
}
.modal-box.large { max-width: 720px; }
.modal-box.small { max-width: 420px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1.5px solid var(--border);
}
.modal-head h3 { font-size: 16px; font-weight: 800; color: var(--text); }
.modal-head button {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.modal-head button:hover { background: #f0f0f0; color: var(--text); }

.modal-body { padding: 20px 24px; }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1.5px solid var(--border);
}

/* モーダル写真アップロード */
.modal-photo-upload {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--teal-light);
  border-radius: var(--radius-sm);
}

.modal-photo-preview {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--teal-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--teal-dark);
  overflow: hidden;
  flex-shrink: 0;
}
.modal-photo-preview img { width: 100%; height: 100%; object-fit: cover; }

.btn-upload {
  padding: 8px 16px;
  background: var(--teal);
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-upload:hover { background: var(--teal-dark); }

/* フォームグリッド */
.modal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-form-grid label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 5px; }
.mfg-full { grid-column: 1 / -1; }

.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-opt {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 13px;
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s;
}
.radio-opt:hover { border-color: var(--teal); }
.radio-opt input[type="radio"]:checked + span { color: var(--teal-dark); font-weight: 700; }
.radio-opt:has(input:checked) { border-color: var(--teal); background: var(--teal-light); }

.check-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.check-opt {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 12px;
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s;
}
.check-opt:hover { border-color: var(--orange); }
.check-opt:has(input:checked) { border-color: var(--orange); background: var(--orange-light); color: var(--orange-dark); }

/* BCSセレクター */
.bcs-selector { margin-top: 4px; }
.bcs-options { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.bcs-opt {
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.bcs-opt:hover { border-color: var(--teal); }
.bcs-opt.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.bcs-desc { font-size: 12px; color: var(--text-mid); background: var(--teal-light); padding: 6px 10px; border-radius: 6px; }

/* ============================================================
   CHAT WIDGET
   ============================================================ */
.chat-widget {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 320px;
  max-height: 480px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  z-index: 300;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}
.chat-widget.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  color: #fff;
}
.chat-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.chat-logo { height: 24px; border-radius: 50%; }
.chat-widget-header button { background: none; border: none; color: #fff; font-size: 16px; cursor: pointer; opacity: 0.8; }
.chat-widget-header button:hover { opacity: 1; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
}

.chat-msg { display: flex; align-items: flex-end; gap: 8px; }
.chat-msg.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.msg-avatar.bot { background: var(--teal-light); color: var(--teal); }
.msg-avatar.user { background: var(--orange-light); color: var(--orange); }

.msg-bubble {
  max-width: 200px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
}
.chat-msg.bot .msg-bubble {
  background: var(--teal-light);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-msg.user .msg-bubble {
  background: var(--teal);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.chat-input-area input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input-area input:focus { border-color: var(--teal); }

.chat-input-area button {
  width: 34px; height: 34px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.chat-input-area button:hover { background: var(--teal-dark); }

.chat-fab {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(64,191,192,0.4);
  z-index: 301;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.chat-fab:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(64,191,192,0.5); }

.fab-badge {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  border: 2px solid #fff;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  min-width: 220px;
  animation: toastIn 0.3s ease;
  border-left: 4px solid var(--teal);
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: #ef4444; }
.toast.warning { border-left-color: var(--orange); }
.toast-icon { font-size: 18px; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .weight-stats-row { grid-template-columns: repeat(3, 1fr); }
  .carte-layout { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .topbar-menu { display: block; }

  .tab-content { padding: 16px 16px 48px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dashboard-row { flex-direction: column; }
  .weight-stats-row { grid-template-columns: repeat(2, 1fr); }
  .sub-details-grid { grid-template-columns: 1fr; }
  .modal-form-grid { grid-template-columns: 1fr; }
  .chat-widget { width: calc(100vw - 32px); right: 16px; }
}

@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .carte-body-stats { grid-template-columns: 1fr 1fr; }
  .current-pet-hero { flex-direction: column; text-align: center; }
  .cph-photo { margin: 0 auto; }
}

/* ============================================================
   AI推薦タブ（マイページ内）
   ============================================================ */
.nav-item-ai {
  position: relative;
}
.nav-badge-new {
  display: inline-block;
  padding: 1px 6px;
  background: linear-gradient(135deg, var(--orange), #e0603b);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: 8px;
  margin-left: 4px;
  vertical-align: middle;
  animation: newBadgePulse 2s ease-in-out infinite;
}
@keyframes newBadgePulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.7; }
}

/* AI 推薦サマリーカード */
.ai-rec-summary-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  padding: 36px 28px;
  margin-bottom: 24px;
  box-shadow: 0 2px 16px rgba(64,191,192,0.08);
}

.ai-rec-placeholder {
  text-align: center;
  padding: 20px;
}
.ai-rec-placeholder-icon {
  font-size: 56px;
  margin-bottom: 16px;
  line-height: 1;
}
.ai-rec-placeholder h3 {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.ai-rec-placeholder p {
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.7;
  margin-bottom: 22px;
}

.btn-ai-start {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border-radius: 28px;
  text-decoration: none;
  box-shadow: 0 6px 22px rgba(64,191,192,0.35);
  transition: all 0.25s ease;
  font-family: 'Noto Sans JP', sans-serif;
}
.btn-ai-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(64,191,192,0.45);
}

/* AI フィーチャーカード */
.ai-feature-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.ai-feat-card {
  background: var(--card);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  padding: 20px;
  transition: all 0.2s;
}
.ai-feat-card:hover {
  border-color: var(--teal-mid);
  box-shadow: 0 4px 16px rgba(64,191,192,0.12);
  transform: translateY(-2px);
}

.afc-icon {
  font-size: 28px;
  margin-bottom: 10px;
  line-height: 1;
}
.ai-feat-card h4 {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.ai-feat-card p {
  font-size: 12px;
  color: var(--text-mid);
  line-height: 1.6;
}

.btn-ai-full-diagnose {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 36px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  border-radius: 28px;
  text-decoration: none;
  box-shadow: 0 6px 22px rgba(64,191,192,0.3);
  transition: all 0.25s ease;
  font-family: 'Noto Sans JP', sans-serif;
}
.btn-ai-full-diagnose:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(64,191,192,0.4);
  filter: brightness(1.05);
}

@media (max-width: 600px) {
  .ai-feature-cards { grid-template-columns: 1fr; }
}
