/* =============================================
   棚田管理ツール - スタイルシート
   横瀬棚田プロジェクト
   ============================================= */

/* ─── CSS変数 ─── */
:root {
  --green-deep: #2E5A2E;
  --green-main: #4A7C3F;
  --green-light: #6B8E23;
  --green-pale: #A8C686;
  --gold-main: #D4A017;
  --gold-light: #E8C547;
  --gold-pale: #F5E6A3;
  --bg-main: #F5F0E8;
  --bg-card: #FFFFFF;
  --bg-warm: #FFF8F0;
  --text-main: #333333;
  --text-sub: #777777;
  --text-light: #AAAAAA;
  --border: #E8E0D0;
  --shadow-sm: 0 2px 8px rgba(74, 124, 63, 0.08);
  --shadow-md: 0 4px 20px rgba(74, 124, 63, 0.12);
  --shadow-lg: 0 8px 40px rgba(74, 124, 63, 0.16);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── リセット ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── ベース ─── */
html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
}

/* ─── パーティクルキャンバス ─── */
#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ─── ページ遷移 ─── */
body {
  animation: pageEnter 0.5s ease both;
}

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

/* ─── ヘッダー ─── */
.header {
  background: linear-gradient(135deg, var(--green-main) 0%, var(--green-deep) 100%);
  color: white;
  padding: 12px 16px 8px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(46, 90, 46, 0.3);
}

.header-inner {
  max-width: 480px;
  margin: 0 auto;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.header-title .rice-icon {
  font-size: 1.5rem;
  animation: sway 3s ease-in-out infinite;
}

@keyframes sway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* ─── ヘッダータイトルリンク ─── */
.header-title-link {
  text-decoration: none;
  color: inherit;
}

.header-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.header-subtitle {
  font-size: 0.75rem;
  opacity: 0.8;
  letter-spacing: 0.05em;
}

/* ─── ナビゲーション ─── */
.nav {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 3px;
}

.nav-link {
  flex: 1;
  text-align: center;
  padding: 8px 2px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-link .nav-icon {
  display: block;
  font-size: 1rem;
  margin-bottom: 2px;
}

.nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.22);
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ─── メインコンテンツ ─── */
.main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  position: relative;
  z-index: 1;
  padding-bottom: 100px;
}

/* ─── カード ─── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--green-main), var(--gold-main));
  opacity: 0;
  transition: var(--transition);
}

.card:hover::before {
  opacity: 1;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.calendar-month {
  font-size: 1.2rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: var(--green-deep);
}

.calendar-month .month-year {
  font-size: 0.8rem;
  color: var(--text-sub);
  font-weight: 400;
  display: block;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

.calendar-nav button {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--bg-main);
  color: var(--green-main);
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--bounce);
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-nav button:hover {
  background: var(--green-main);
  color: white;
  transform: scale(1.1);
}

.calendar-nav button:active {
  transform: scale(0.95);
}

.calendar-nav button:focus {
  outline: none;
}

.calendar-nav button:focus:not(:active) {
  background: var(--bg-main);
  color: var(--green-main);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 4px;
}

.calendar-weekdays span {
  font-size: 0.7rem;
  color: var(--text-sub);
  font-weight: 600;
  padding: 6px 0;
}

.calendar-weekdays span:first-child { color: #e74c3c; }
.calendar-weekdays span:last-child { color: #3498db; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.calendar-day:hover {
  background: rgba(74, 124, 63, 0.06);
}

.calendar-day.other-month {
  color: var(--text-light);
  opacity: 0.4;
}

.calendar-day.today {
  background: var(--gold-pale);
  font-weight: 700;
  color: var(--green-deep);
}

.calendar-day.today::after {
  content: '今日';
  position: absolute;
  bottom: 1px;
  font-size: 0.5rem;
  color: var(--gold-main);
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 700;
}

.calendar-day.has-schedule {
  background: rgba(107, 142, 35, 0.1);
  font-weight: 600;
}

.calendar-day.has-schedule::before {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-light);
  animation: pulse-dot 2s ease-in-out infinite;
}

.calendar-day.selected {
  background: var(--green-main);
  color: white;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(74, 124, 63, 0.3);
}

.calendar-day.selected::before {
  background: white;
}

/* 天気アイコン */
.day-number {
  font-size: 0.85rem;
  line-height: 1;
}

.day-weather {
  font-size: 0.7rem;
  line-height: 1;
  margin-top: 1px;
  opacity: 0.8;
}

/* 日誌リンクボタン */
.diary-link-section {
  margin-top: 12px;
}

.btn-diary-link {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, #FF9800, #F57C00);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-diary-link:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.calendar-day.sunday { color: #e74c3c; }
.calendar-day.saturday { color: #3498db; }
.calendar-day.selected.sunday,
.calendar-day.selected.saturday { color: white; }

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* ─── スケジュール詳細パネル ─── */
.schedule-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              margin 0.3s ease;
  opacity: 0;
  margin-top: 0;
}

.schedule-panel.open {
  max-height: 3000px;
  opacity: 1;
  margin-top: 16px;
}

.schedule-detail {
  background: linear-gradient(135deg, var(--bg-warm) 0%, var(--bg-card) 100%);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 2px solid var(--green-pale);
  animation: slideDown 0.4s ease;
}

@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.schedule-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-main);
  color: white;
  padding: 6px 14px;
  border-radius: var(--radius-xl);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.schedule-work {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.schedule-time {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-bottom: 16px;
}

.schedule-note {
  font-size: 0.82rem;
  color: var(--text-sub);
  background: rgba(168, 198, 134, 0.15);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* ─── 参加者一覧 ─── */
.participants-section {
  margin-bottom: 16px;
}

.participants-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.participants-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--green-pale);
  color: var(--green-deep);
  padding: 5px 12px;
  border-radius: var(--radius-xl);
  font-size: 0.8rem;
  font-weight: 600;
  animation: chipIn 0.3s var(--bounce) both;
}

.participant-chip.is-me {
  background: var(--gold-main);
  color: white;
}

@keyframes chipIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.participant-chip .remove-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.6;
  transition: var(--transition);
  padding: 0 0 0 2px;
}

.participant-chip .remove-btn:hover {
  opacity: 1;
}

.no-participants {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}

/* ─── 参加ボタン ─── */
.join-section {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* ─── Googleカレンダー登録 ─── */
.gcal-section {
  margin-bottom: 16px;
}

.btn-gcal {
  width: 100%;
  padding: 10px 16px;
  background: white;
  color: var(--text-main);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-gcal:hover {
  background: var(--green-pale);
  border-color: var(--green-main);
}

.member-select {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: inherit;
  background: white;
  color: var(--text-main);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%23777' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: var(--transition);
}

.member-select:focus {
  outline: none;
  border-color: var(--green-main);
  box-shadow: 0 0 0 3px rgba(74, 124, 63, 0.15);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--bounce);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: linear-gradient(135deg, var(--green-main), var(--green-light));
  color: white;
  box-shadow: 0 4px 12px rgba(74, 124, 63, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(74, 124, 63, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
}

.btn-danger {
  background: #f5f5f5;
  color: #e74c3c;
}

.btn-danger:hover {
  background: #fde8e8;
}

/* ─── コメント ─── */
.comments-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.comments-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green-main);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.comment-item {
  display: flex;
  gap: 10px;
  animation: fadeInUp 0.3s ease both;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--green-deep);
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
  background: var(--bg-main);
  padding: 10px 14px;
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--green-main);
}

.comment-time {
  font-size: 0.65rem;
  color: var(--text-light);
}

.comment-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-main);
}

.comment-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.2s;
}

.comment-item:hover .comment-actions {
  opacity: 1;
}

.comment-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.7rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.2s;
  line-height: 1;
}

.comment-action-btn:hover {
  background: var(--border);
}

.comment-edit-form {
  margin-top: 6px;
}

.comment-edit-input {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid var(--green-main);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-family: inherit;
  box-sizing: border-box;
}

.comment-edit-buttons {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.comment-edit-save,
.comment-edit-cancel {
  padding: 4px 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
}

.comment-edit-save {
  background: var(--green-main);
  color: white;
}

.comment-edit-save:hover {
  background: var(--green-deep);
}

.comment-edit-cancel {
  background: var(--border);
  color: var(--text-main);
}

.comment-edit-cancel:hover {
  background: #ccc;
}

.comment-like {
  margin-top: 4px;
}

.comment-like-btn {
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
  line-height: 1;
}

.comment-like-btn:hover:not(.liked) {
  background: #f0f7ee;
  border-color: var(--green-main);
}

.comment-like-btn.liked {
  background: #f0f7ee;
  border-color: var(--green-main);
  cursor: default;
}

.like-icon {
  font-size: 0.75rem;
}

.like-count {
  font-size: 0.72rem;
  color: var(--text-main);
  font-weight: 600;
}

.comment-form {
  display: flex;
  gap: 8px;
}

.inline-comment-form {
  margin-top: 12px;
  margin-bottom: 4px;
  overflow: hidden;
}

.comment-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: inherit;
  transition: var(--transition);
  resize: none;
  box-sizing: border-box;
}

.comment-input:focus {
  outline: none;
  border-color: var(--green-main);
  box-shadow: 0 0 0 3px rgba(74, 124, 63, 0.15);
}

.comment-submit {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--green-main);
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--bounce);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.comment-submit:hover {
  transform: scale(1.1);
  background: var(--green-deep);
}

.comment-submit:active {
  transform: scale(0.95);
}

/* ─── お知らせバー ─── */
.announcement-bar {
  background: linear-gradient(135deg, #FFF0F0, #FFE8E8);
  border: 2px solid #FFCDD2;
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 16px;
  animation: fadeInUp 0.5s ease both;
}

.announcement-item {
  color: #C62828;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.6;
}

.announcement-item + .announcement-item {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #FFCDD2;
}

/* ─── 年間工程（縦タイムライン） ─── */
/* ─── 縦型ガントチャート ─── */
.gantt-chart {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.gantt-inner {
  min-width: 700px;
  position: relative;
}

.gantt-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 2;
}

.gantt-months {
  position: relative;
  flex: 1;
  height: 28px;
  background: var(--green-deep);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.gantt-month {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  border-right: 1px solid rgba(255,255,255,0.15);
}

.gantt-month.current {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.gantt-body {
  position: relative;
}

.gantt-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  min-height: 44px;
}

.gantt-row-label {
  width: 60px;
  min-width: 60px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-sub);
  padding: 6px 4px;
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border-right: 1px solid var(--border);
  line-height: 1.2;
}

.gantt-header .gantt-row-label {
  background: var(--green-deep);
}

.gantt-row-bars {
  flex: 1;
  position: relative;
  min-height: 44px;
  background: repeating-linear-gradient(
    to right,
    transparent,
    transparent calc(100% / 9 - 1px),
    var(--border) calc(100% / 9 - 1px),
    var(--border) calc(100% / 9)
  );
}

/* バー */
.gantt-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  transition: opacity 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.gantt-bar.past {
  opacity: 0.45;
}

.gantt-bar.active {
  box-shadow: 0 1px 6px rgba(0,0,0,0.25);
  animation: gantt-pulse 2s ease-in-out infinite;
}

@keyframes gantt-pulse {
  0%, 100% { box-shadow: 0 1px 6px rgba(0,0,0,0.25); }
  50% { box-shadow: 0 2px 10px rgba(74,124,63,0.4); }
}

.gantt-bar-text {
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* マイルストーン */
.gantt-milestone {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  z-index: 1;
}

.gantt-milestone.past {
  opacity: 0.45;
}

.gantt-ms-diamond {
  font-size: 0.85rem;
  color: #e53935;
  line-height: 1;
}

.gantt-ms-label {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  background: rgba(255,255,255,0.85);
  padding: 1px 3px;
  border-radius: 2px;
}

/* 今日の線 */
.gantt-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e53935;
  z-index: 3;
  pointer-events: none;
}

.gantt-today::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -4px;
  width: 10px;
  height: 10px;
  background: #e53935;
  border-radius: 50%;
}

.gantt-today-label {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: 800;
  color: #e53935;
  white-space: nowrap;
}

/* ガントチャート吹き出し */
.gantt-tooltip {
  position: absolute;
  transform: translateX(-50%) translateY(-100%);
  background: var(--text-main);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: nowrap;
  z-index: 10;
  box-shadow: var(--shadow-md);
  animation: gantt-tooltip-in 0.15s ease;
  pointer-events: none;
}

.gantt-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--text-main);
}

.gantt-tooltip-period {
  font-size: 0.68rem;
  opacity: 0.75;
}

@keyframes gantt-tooltip-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-100%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(-100%); }
}

/* ─── 写真セクション ─── */
.photos-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-bottom: 16px;
}

.photos-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green-main);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.photo-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.photo-thumb:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}

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

.photo-upload-area {
  text-align: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--green-pale);
}

.photo-upload-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--green-main);
  margin-bottom: 10px;
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--bg-main);
  color: var(--green-main);
  border: 2px dashed var(--green-pale);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-upload:hover {
  background: rgba(74, 124, 63, 0.06);
  border-color: var(--green-main);
}

.photo-modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 20px;
  max-width: 480px;
  width: 95%;
  margin: auto;
}

/* ─── 写真ビューア（左右ナビ付き） ─── */

.photo-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
  overflow: hidden;
  touch-action: none;
}

.photo-viewer-content {
  position: relative;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.photo-viewer-img {
  max-width: 95vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
}

.photo-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s;
}

.photo-nav-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.photo-nav-prev {
  left: 8px;
}

.photo-nav-next {
  right: 8px;
}

.photo-viewer-caption {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  margin-top: 10px;
  text-align: center;
}

.photo-viewer-counter {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
  margin-top: 6px;
}

/* 写真ビューア内アクションボタン */
.photo-action-btn {
  position: absolute;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  font-size: 0.75rem;
  padding: 6px 12px;
  transition: background 0.2s;
}

.photo-delete-btn {
  bottom: 16px;
  right: 16px;
  background: rgba(220, 53, 69, 0.8);
  color: #fff;
  backdrop-filter: blur(4px);
}

.photo-delete-btn:hover {
  background: rgba(220, 53, 69, 1);
}

.photo-download-btn {
  background: rgba(34, 139, 34, 0.8);
  color: #fff;
  backdrop-filter: blur(4px);
}

.photo-download-btn:hover {
  background: rgba(34, 139, 34, 1);
}

.photo-viewer-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
}

.photo-viewer-actions .photo-action-btn {
  position: static;
}

.photo-batch-download-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  background: rgba(34, 139, 34, 0.85);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.photo-batch-download-btn:hover {
  background: rgba(34, 139, 34, 1);
}

.gallery-date-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gallery-bulk-download-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  background: var(--green-main);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  white-space: nowrap;
}

.gallery-bulk-download-btn:hover {
  opacity: 0.85;
}

/* 編集モーダル */
.edit-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.edit-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.edit-modal-header h3 {
  margin: 0;
  font-size: 1rem;
}

.edit-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  padding: 0 4px;
}

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

.edit-modal-body label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 4px;
  margin-top: 12px;
  color: var(--text-sub);
}

.edit-modal-body label:first-child {
  margin-top: 0;
}

.edit-modal-body textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
  box-sizing: border-box;
}

.edit-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.btn-secondary {
  background: var(--bg-main);
  color: var(--text-sub);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-secondary:hover {
  background: var(--green-pale);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-in-left {
  animation: slideInLeft 0.25s ease-out both;
}

.slide-in-right {
  animation: slideInRight 0.25s ease-out both;
}

.fade-in-photo {
  animation: fadeInPhoto 0.2s ease both;
}

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

@keyframes slideInRight {
  from { transform: translateX(-60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeInPhoto {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ─── ギャラリーページ ─── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.gallery-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.gallery-item-info {
  padding: 8px 10px;
  font-size: 0.72rem;
  color: var(--text-sub);
}

.gallery-item-date {
  font-weight: 600;
  color: var(--green-main);
}

/* バッチ写真スタック表示 */
.gallery-batch {
  position: relative;
}

.gallery-stack-wrapper {
  position: relative;
}

.gallery-stack-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-card);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.08);
}

.gallery-stack-wrapper img {
  position: relative;
  z-index: 1;
}

.gallery-batch-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  z-index: 2;
  backdrop-filter: blur(4px);
}

.gallery-date-group {
  margin-bottom: 20px;
}

.gallery-date-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green-main);
  padding: 8px 0;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--green-pale);
}

/* ─── Googleカレンダーボタン ─── */
.gcal-section {
  margin-top: 12px;
}

.btn-gcal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, #4285F4, #34A853);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-gcal:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ─── 業務日誌 ─── */
.diary-description {
  font-size: 0.82rem;
  color: var(--text-sub);
  line-height: 1.6;
  margin-bottom: 16px;
}

.diary-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diary-form label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
}

.diary-form-row {
  display: flex;
  gap: 8px;
}

.diary-form-row > * {
  flex: 1;
}

.diary-select,
.diary-textarea {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: inherit;
  transition: var(--transition);
  width: 100%;
  background: var(--bg-card);
}

.diary-select:focus,
.diary-textarea:focus {
  outline: none;
  border-color: var(--green-main);
  box-shadow: 0 0 0 3px rgba(74, 124, 63, 0.15);
}

.diary-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.field-error {
  color: #D32F2F;
  font-size: 0.8rem;
  margin-top: 4px;
}

.diary-filter {
  display: flex;
  gap: 6px;
  padding: 12px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.diary-filter-btn {
  padding: 6px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-sub);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.diary-filter-btn.active {
  border-color: var(--green-main);
  background: var(--green-main);
  color: white;
}

.diary-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.4s ease both;
}

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

.diary-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.diary-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-main), var(--green-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.diary-meta {
  flex: 1;
  min-width: 0;
}

.diary-author {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.diary-date-info {
  font-size: 0.72rem;
  color: var(--text-sub);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.diary-schedule-date {
  color: var(--green-main);
  font-weight: 600;
}

.diary-category-badge {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.diary-category-badge[data-category="作業メモ"] {
  background: #E3F2FD;
  color: #1565C0;
}

.diary-category-badge[data-category="気づき"] {
  background: #FFF9C4;
  color: #F57F17;
}

.diary-category-badge[data-category="ナレッジ"] {
  background: #E8F5E9;
  color: #2E7D32;
}

.diary-category-badge[data-category="改善提案"] {
  background: #FBE9E7;
  color: #D84315;
}

.diary-card-body {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-main);
  padding-left: 46px;
}

.diary-card-footer {
  padding-left: 46px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.diary-timestamp {
  font-size: 0.7rem;
  color: var(--text-light);
}

.diary-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.diary-card:hover .diary-actions {
  opacity: 1;
}

/* SP: 常に表示 */
@media (max-width: 600px) {
  .diary-actions { opacity: 0.6; }
}

.diary-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.2s;
}

.diary-action-btn:hover {
  background: var(--green-pale);
}

.diary-action-delete:hover {
  background: #fde8e8;
}

/* ─── 日誌メディアアップロード ─── */
.diary-media-upload {
  margin-bottom: 12px;
}

.diary-file-label {
  display: inline-block;
  padding: 8px 16px;
  background: var(--bg-warm);
  border: 2px dashed var(--green-pale);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--green-main);
  font-weight: 600;
  transition: all 0.2s;
}

.diary-file-label:hover {
  background: var(--green-pale);
  color: #fff;
  border-color: var(--green-main);
}

.diary-media-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.diary-media-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--green-pale);
}

.diary-media-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.diary-media-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  font-size: 0.65rem;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 1px 4px;
  border-radius: 4px;
}

.diary-media-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* 日誌カード内メディア表示 */
.diary-card-media {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0 0 46px;
}

.diary-card-media-item {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.diary-card-media-item:hover {
  transform: scale(1.05);
}

video.diary-card-media-item {
  cursor: default;
}

/* ─── ギャラリーアップロード ─── */
.gallery-upload-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 2px dashed var(--green-pale);
}

.gallery-upload-section .upload-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 10px;
}

.gallery-upload-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gallery-upload-form label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
}

.gallery-upload-row {
  display: flex;
  gap: 8px;
}

.gallery-upload-row > * {
  flex: 1;
}

/* ステップ式アップロード */
.gallery-upload-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upload-step {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.upload-step.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.step-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green-main);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
}

.upload-step.disabled .step-num {
  background: var(--text-light);
}

.upload-btn-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.gallery-preview {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.gallery-preview img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* ─── 写真プレビュー共通 ─── */
.photo-preview-area,
.gallery-preview {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  align-items: center;
}

.preview-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--green-pale);
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.preview-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green-main);
  padding: 4px 0;
  width: 100%;
}

.photo-send-btn {
  margin-top: 8px;
  width: 100%;
}

/* ─── 写真モーダル（コメント付き） ─── */
.photo-modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.photo-comments-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.photo-comments-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 8px;
}

.photo-comment-item {
  display: flex;
  gap: 8px;
  padding: 6px 0;
}

.photo-comment-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-pale);
  color: var(--green-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.photo-comment-body {
  flex: 1;
}

.photo-comment-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-main);
}

.photo-comment-text {
  font-size: 0.8rem;
  color: var(--text-sub);
  line-height: 1.5;
}

.photo-comment-time {
  font-size: 0.65rem;
  color: var(--text-light);
}

.photo-comment-form {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.photo-comment-form input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: inherit;
}

.photo-comment-form input:focus {
  outline: none;
  border-color: var(--green-main);
}

.photo-comment-form button {
  padding: 8px 14px;
  background: var(--green-main);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  cursor: pointer;
}

/* ─── 管理画面 ─── */
.admin-section {
  margin-bottom: 24px;
}

.admin-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-form label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
}

.admin-form input,
.admin-form textarea,
.admin-form select {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: inherit;
  transition: var(--transition);
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  outline: none;
  border-color: var(--green-main);
  box-shadow: 0 0 0 3px rgba(74, 124, 63, 0.15);
}

.admin-form textarea {
  resize: vertical;
  min-height: 60px;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-main);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.admin-list-item .item-actions {
  display: flex;
  gap: 6px;
}

.admin-list-item .item-actions button {
  padding: 4px 10px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-edit {
  background: var(--green-pale);
  color: var(--green-deep);
}

.btn-delete {
  background: #FFCDD2;
  color: #C62828;
}

.admin-row {
  display: flex;
  gap: 8px;
}

.admin-row > * {
  flex: 1;
}

/* ─── 管理カレンダー ─── */
.admin-calendar-section {
  margin-bottom: 16px;
}

.admin-calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.admin-calendar-nav .btn-nav {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-calendar-nav .btn-nav:hover {
  border-color: var(--green-main);
  background: var(--green-pale);
}

.admin-month-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-deep);
  min-width: 120px;
  text-align: center;
}

.admin-edit-panel {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-warm);
  border-radius: var(--radius-md);
  border: 2px solid var(--green-pale);
  animation: slideDown 0.3s ease;
}

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

.admin-edit-header {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--green-pale);
}

.btn-danger {
  background: #FFCDD2;
  color: #C62828;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background: #EF9A9A;
}

.admin-login {
  max-width: 320px;
  margin: 60px auto;
  text-align: center;
}

.admin-login h2 {
  font-size: 1.2rem;
  color: var(--green-main);
  margin-bottom: 20px;
}

.admin-login input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: inherit;
  text-align: center;
  margin-bottom: 12px;
}

.admin-login input:focus {
  outline: none;
  border-color: var(--green-main);
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-tab {
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: white;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-sub);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.admin-tab.active {
  border-color: var(--green-main);
  background: var(--green-main);
  color: white;
}

/* ─── ランキング ─── */
.point-rules {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  font-size: 0.78rem;
  color: var(--text-sub);
}
.point-rule {
  white-space: nowrap;
}
.point-rule strong {
  color: var(--green-deep);
  font-weight: 700;
}
.point-rule-goal {
  margin-left: auto;
  white-space: nowrap;
  color: var(--gold-main);
  font-weight: 600;
}
.point-rule-goal strong {
  color: var(--gold-main);
}

.ranking-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.ranking-tab {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: white;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-sub);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.ranking-tab.active {
  border-color: var(--green-main);
  background: var(--green-main);
  color: white;
}

.ranking-tab:hover:not(.active) {
  border-color: var(--green-pale);
  background: rgba(74, 124, 63, 0.04);
}

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

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  animation: fadeInUp 0.4s ease both;
  position: relative;
  overflow: hidden;
}

.ranking-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ranking-item.rank-1 {
  border: 2px solid #FFD700;
  background: linear-gradient(135deg, #FFFEF0, #FFF8DC);
}

.ranking-item.rank-2 {
  border: 2px solid #C0C0C0;
  background: linear-gradient(135deg, #FAFAFA, #F5F5F5);
}

.ranking-item.rank-3 {
  border: 2px solid #CD7F32;
  background: linear-gradient(135deg, #FFF8F0, #FDEBD0);
}

.ranking-number {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  min-width: 32px;
  text-align: center;
}

.rank-1 .ranking-number { color: #FFD700; }
.rank-2 .ranking-number { color: #C0C0C0; }
.rank-3 .ranking-number { color: #CD7F32; }

.ranking-info {
  flex: 1;
}

.ranking-name-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.ranking-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.ranking-points {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--green-main);
}

.ranking-points small {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-sub);
}

.point-breakdown {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.pb-item {
  font-size: 0.72rem;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 3px;
}

.pb-pt {
  font-family: 'Outfit', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-light);
  margin-left: 2px;
}

.ranking-bar-track {
  height: 8px;
  background: var(--bg-main);
  border-radius: 4px;
  overflow: hidden;
}

.ranking-bar-stacked {
  height: 100%;
  border-radius: 4px;
  display: flex;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.bar-seg {
  height: 100%;
  min-width: 0;
}

.bar-seg-join {
  background: var(--green-main);
}

.bar-seg-photo {
  background: #42a5f5;
}

.bar-seg-diary {
  background: var(--gold-main);
}

.ranking-progress-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-light);
  text-align: right;
  margin-top: 3px;
}

.rank-1 .bar-seg-join {
  background: linear-gradient(90deg, #FFD700, #FFA500);
}

/* 旧互換（使われなくなったが安全のため残す） */
.ranking-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--green-main), var(--green-light));
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ─── 豊作メーター ─── */
.harvest-meter {
  background: linear-gradient(135deg, var(--bg-warm), var(--bg-card));
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin-top: 20px;
  border: 2px solid var(--gold-pale);
  position: relative;
  overflow: hidden;
}

.harvest-meter::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(212, 160, 23, 0.05) 0%, transparent 70%);
  animation: rotate-bg 20s linear infinite;
}

@keyframes rotate-bg {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

.harvest-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  position: relative;
}

.harvest-circle {
  width: 160px;
  height: 160px;
  margin: 0 auto 16px;
  position: relative;
}

.harvest-circle svg {
  transform: rotate(-90deg);
}

.harvest-circle .circle-bg {
  fill: none;
  stroke: var(--bg-main);
  stroke-width: 10;
}

.harvest-circle .circle-fill {
  fill: none;
  stroke: var(--gold-main);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dasharray 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.harvest-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.harvest-value .number {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold-main);
}

.harvest-value .unit {
  font-size: 0.7rem;
  color: var(--text-sub);
  display: block;
}

.harvest-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  position: relative;
}

.harvest-stat {
  text-align: center;
}

.harvest-stat .stat-label {
  font-size: 0.7rem;
  color: var(--text-sub);
  margin-bottom: 2px;
}

.harvest-stat .stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--green-main);
}

/* ─── マニュアル ─── */
.manual-category {
  margin-bottom: 20px;
}

.manual-category-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green-main);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--green-pale);
  display: flex;
  align-items: center;
  gap: 6px;
}

.manual-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manual-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.manual-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
  background: var(--bg-warm);
}

.manual-item .manual-icon {
  font-size: 1.2rem;
}

.manual-item .manual-arrow {
  margin-left: auto;
  color: var(--text-light);
  transition: var(--transition);
}

.manual-item:hover .manual-arrow {
  color: var(--green-main);
  transform: translateX(4px);
}

/* ─── アニメーション ─── */
@keyframes fadeInUp {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.fade-in { animation: fadeIn 0.5s ease both; }
.fade-in-up { animation: fadeInUp 0.5s ease both; }
.bounce-in { animation: bounceIn var(--bounce) both; }

/* ─── コンフェティ ─── */
.confetti {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  animation: confetti-fly 1s ease-out forwards;
  font-size: 20px;
}

@keyframes confetti-fly {
  0% {
    transform: translate(0, 0) rotate(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) rotate(720deg) scale(0);
    opacity: 0;
  }
}

/* ─── トースト ─── */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--green-deep);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-xl);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast-error {
  background: #e74c3c;
}

/* ─── リップル ─── */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: ripple-expand 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-expand {
  to { transform: scale(2.5); opacity: 0; }
}

/* ─── モーダル ─── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* ─── 空状態 ─── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  animation: sway 3s ease-in-out infinite;
}

.empty-state .empty-text {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ─── スケルトンローディング ─── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-main) 25%, #EDE8DE 50%, var(--bg-main) 75%);
  background-size: 200% 100%;
  animation: skeleton-load 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-load {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── スクロールバー ─── */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--green-pale);
  border-radius: 2px;
}

/* ─── レスポンシブ ─── */
@media (min-width: 481px) {
  .main {
    max-width: 520px;
  }
}

@media (min-width: 768px) {
  .main {
    max-width: 560px;
  }

  .calendar-day {
    font-size: 0.9rem;
  }
}

/* ─── 成功ポップアップ ─── */
.success-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: successOverlayIn 0.3s ease both;
  cursor: pointer;
}

.success-popup-overlay.fade-out {
  animation: successOverlayOut 0.4s ease both;
}

.success-popup {
  background: white;
  border-radius: var(--radius-xl);
  padding: 36px 32px 28px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: successPopIn 0.4s var(--bounce) both;
  max-width: 300px;
  width: 85%;
}

.success-popup-overlay.fade-out .success-popup {
  animation: successPopOut 0.3s ease both;
}

.success-popup-icon {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 12px;
}

.success-popup-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.success-popup-message {
  font-size: 0.82rem;
  color: var(--text-sub);
  line-height: 1.5;
}

@keyframes successOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes successOverlayOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes successPopIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes successPopOut {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.8); opacity: 0; }
}

/* ─── 天気詳細セクション ─── */
.weather-detail {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #E8F5E9, #F1F8E9);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.weather-detail-icon {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.weather-detail-info {
  flex: 1;
}

.weather-detail-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 2px;
}

.weather-detail-temp {
  display: flex;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
}

.weather-detail-temp .temp-max {
  color: #e74c3c;
}

.weather-detail-temp .temp-min {
  color: #3498db;
}

.weather-detail.weather-detail-na {
  background: var(--bg-main);
  opacity: 0.7;
}

.weather-detail-na .weather-detail-name {
  color: var(--text-sub);
  font-weight: 500;
  font-size: 0.82rem;
}

.btn-tenki {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--green-main);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--green-pale);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  transition: var(--transition);
}

.btn-tenki:hover {
  background: var(--green-pale);
  color: var(--green-deep);
}

/* ─── 参加申請セクション ─── */
.join-apply-section {
  margin-bottom: 16px;
}

.join-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.join-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.join-section .member-select,
.join-section .comment-input,
.join-section .btn-primary {
  width: 100%;
}

.join-section .btn-primary {
  padding: 12px 20px;
}

/* ─── 掲示板セクション ─── */
.board-section {
  margin-bottom: 16px;
}

.board-section .join-section-title {
  margin-bottom: 10px;
}

.board-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.board-form .member-select {
  width: 100%;
}

.board-form .inline-comment-form {
  margin-top: 0;
  display: flex;
  gap: 8px;
  overflow: hidden;
}

.board-section .comments-section {
  border-top: none;
  padding-top: 0;
}

/* ─── 成功ポップアップ ─── */
.success-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.success-popup-overlay.show {
  opacity: 1;
}

.success-popup {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 32px 28px 24px;
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: successPopIn 0.4s var(--bounce) both;
}

.success-popup-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 8px;
}

.success-popup-message {
  font-size: 0.88rem;
  color: var(--text-sub);
  margin-bottom: 20px;
  line-height: 1.5;
}

.success-popup-btn {
  width: 100%;
  padding: 12px;
}
