:root {
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --accent: #ec4899;
  --sidebar-start: #4c1d95;
  --sidebar-middle: #6d28d9;
  --sidebar-end: #9d174d;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --surface: #ffffff;
  --soft: #f7f5ff;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 16px 50px rgba(55, 33, 95, .12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { width: 100%; max-width: 100%; overflow-x: hidden; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--app-background, #f8f7fb);
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}
#app { overflow-anchor: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(360px, 520px);
  background: var(--surface);
}
.auth-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(40px, 8vw, 110px);
  color: white;
  background: linear-gradient(135deg, #6d28d9 0%, #a855f7 46%, #ec4899 100%);
}
.auth-hero::before, .auth-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.11);
}
.auth-hero::before { width: 420px; height: 420px; right: -180px; top: -140px; }
.auth-hero::after { width: 260px; height: 260px; left: -90px; bottom: -110px; }
.hero-content { position: relative; z-index: 1; max-width: 590px; text-align: center; }
.auth-mascot {
  display: block;
  width: min(260px, 48vw);
  max-height: 360px;
  object-fit: contain;
  margin: 34px auto 0;
  filter: drop-shadow(0 20px 34px rgba(49, 17, 93, .22));
}
.brand-mark {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 20px;
  background: rgba(255,255,255,.16);
  font-size: 25px;
  font-weight: 800;
}
.hero-content h1 { margin: 0 0 12px; font-size: clamp(46px, 7vw, 82px); line-height: 1; }
.hero-content p { margin: 0; font-size: clamp(18px, 2vw, 25px); opacity: .92; }
.hero-points { display: grid; gap: 14px; margin-top: 56px; }
.hero-point { display: flex; align-items: center; justify-content: center; gap: 12px; color: rgba(255,255,255,.88); }
.hero-point span {
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(255,255,255,.18); font-size: 13px;
}
.auth-panel { display: grid; place-items: center; padding: 38px; }
.auth-card { width: min(100%, 400px); }
.auth-card h2 { margin: 0 0 8px; font-size: 30px; }
.auth-card > p { margin: 0 0 30px; color: var(--muted); }
.auth-links { display: flex; justify-content: space-between; margin-top: 20px; font-size: 14px; }
.demo-box {
  margin-top: 28px; padding: 16px; border: 1px solid #ddd6fe;
  border-radius: 16px; background: #f5f3ff; color: #5b21b6; font-size: 13px; line-height: 1.7;
}

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 14px; font-weight: 700; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 13px;
  padding: 13px 14px; background: white; color: var(--ink); outline: none;
  transition: .2s border-color, .2s box-shadow;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: #a78bfa; box-shadow: 0 0 0 4px rgba(124,58,237,.1);
}
.textarea { min-height: 110px; resize: vertical; }
.repeatable-fields { display: grid; gap: 10px; }
.repeatable-row { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 9px; align-items: center; }
.repeatable-row-song { grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; }
.field-number {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 10px; color: var(--primary-dark); background: #ede9fe;
  font-size: 12px; font-weight: 800;
}
.add-field-btn { justify-self: start; margin-top: 2px; }
.check-row { display: flex; flex-wrap: wrap; gap: 10px; }
.check-pill input { position: absolute; opacity: 0; }
.check-pill span {
  display: inline-flex; padding: 9px 13px; border: 1px solid var(--line);
  border-radius: 999px; background: white; font-size: 13px;
}
.check-pill input:checked + span { color: var(--primary-dark); border-color: #a78bfa; background: #ede9fe; font-weight: 700; }

.btn {
  border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700;
  transition: .2s transform, .2s opacity, .2s background;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.btn-primary { color: white; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.btn-secondary { color: var(--primary-dark); background: #ede9fe; }
.btn-ghost { color: #374151;; border: 1px solid var(--line); background: white; }
.btn-danger { color: var(--danger); background: #fef2f2; }
.btn-success { color: white; background: var(--success); }
.btn-block { width: 100%; padding: 14px; }
.btn-sm { padding: 8px 11px; font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 20;
  display: flex; flex-direction: column; padding: 24px 16px;
  color: white; background: linear-gradient(180deg, var(--sidebar-start), var(--sidebar-middle) 55%, var(--sidebar-end));
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 25px; }
.side-brand .brand-mark { width: 42px; height: 42px; border-radius: 13px; font-size: 17px; }
.side-brand strong { font-size: 21px; }
.side-brand small { display: block; opacity: .68; font-size: 11px; margin-top: 2px; }
.nav { display: grid; gap: 5px; }
.nav-btn {
  position: relative; width: 100%; display: flex; align-items: center; gap: 11px;
  border: 0; border-radius: 12px; padding: 11px 12px;
  color: rgba(255,255,255,.76); background: transparent; text-align: left;
}
.nav-btn.active { color: white; background: rgba(255,255,255,.16); }
@media (hover: hover) {
  .nav-btn:hover { color: white; background: rgba(255,255,255,.16); }
}
.nav-icon {
  width: 27px; height: 27px; display: grid; place-items: center;
  border-radius: 9px; background: rgba(255,255,255,.1); font-size: 12px; font-weight: 800;
}
.menu-icon-image {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
}
.nav-label { min-width: 0; }
.nav-unread-dot,
.chat-unread-dot {
  width: 10px; height: 10px; border: 2px solid white; border-radius: 50%;
  background: #ef4444; box-shadow: 0 2px 6px rgba(185,28,28,.28);
}
.nav-unread-dot { position: absolute; top: 7px; left: 31px; }
.side-user { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.18); }
.side-user strong { display: block; }
.side-user small { opacity: .7; }
.logout { margin-top: 12px; color: white; border: 1px solid rgba(255,255,255,.24); background: rgba(255,255,255,.08); }

.main { grid-column: 2; min-width: 0; padding: 30px clamp(20px, 4vw, 54px) 60px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 30px; }
.topbar h1 { margin: 0; font-size: clamp(25px, 3vw, 35px); }
.topbar p { margin: 7px 0 0; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.mobile-logout { display: none; }
.desktop-logout { display: inline-flex; }
.page-back { white-space: nowrap; }
.role-badge, .badge {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800;
}
.role-badge { color: var(--primary-dark); background: #ede9fe; }
.badge-purple { color: var(--primary-dark); background: #ede9fe; }
.badge-green { color: #047857; background: #d1fae5; }
.badge-amber { color: #b45309; background: #fef3c7; }
.badge-red { color: #b91c1c; background: #fee2e2; }
.badge-gray { color: #4b5563; background: #f3f4f6; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  padding: 23px; border: 1px solid rgba(229,231,235,.9);
  border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 35px rgba(49,33,75,.06);
}
.card h2, .card h3 { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-title h2 { margin: 0; font-size: 20px; }
.metric { position: relative; overflow: hidden; }
.metric-link {
  width: 100%; min-height: 116px; display: block; border: 1px solid rgba(229,231,235,.9);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.metric-link:focus-visible { outline: 3px solid rgba(124,58,237,.3); outline-offset: 2px; }
@media (hover: hover) {
  .metric-link:hover { transform: translateY(-2px); box-shadow: 0 13px 38px rgba(49,33,75,.11); }
}
.metric-arrow { position: absolute; z-index: 1; top: 50%; right: 20px; color: var(--primary); font-size: 28px; transform: translateY(-50%); }
.metric::after {
  content: ""; position: absolute; width: 90px; height: 90px; right: -25px; bottom: -40px;
  border-radius: 50%; background: linear-gradient(135deg, rgba(124,58,237,.1), rgba(236,72,153,.1));
}
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { display: block; margin-top: 8px; font-size: 30px; font-weight: 800; }
.section { margin-top: 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 14px; }
.section-heading h2 { margin: 0; font-size: 20px; }
.admin-history-heading {
  position: static;
  padding: 10px 0; border-radius: 16px;
  background: transparent;
}
.history-add-floating {
  position: fixed;
  top: 98px;
  right: clamp(18px, 3vw, 42px);
  z-index: 40;
  box-shadow: 0 12px 32px rgba(124,58,237,.22);
}
@media (min-width: 781px) {
  .app-shell:has(.sidebar) .history-add-floating {
    right: clamp(22px, 3vw, 54px);
  }
}
@media (max-width: 780px) {
  .history-add-floating {
    top: auto;
    right: 18px;
    bottom: 92px;
    border-radius: 999px;
    min-height: 48px;
    padding-inline: 18px;
  }
}

.notice-list, .list { display: grid; gap: 11px; }
.notice-item, .list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 15px;
  padding: 14px 15px; border: 1px solid var(--line); border-radius: 15px; background: white;
}
.notice-item { border: 0; background: var(--soft); }
.notice-item strong, .list-item strong { display: block; }
.notice-item small, .list-item small { color: var(--muted); }
.notice-categories, .notice-management { display: grid; gap: 18px; }
.notice-detail-list { display: grid; gap: 0; }
.notice-detail { padding: 18px 0; border-top: 1px solid var(--line); }
.notice-detail:first-child { padding-top: 0; border-top: 0; }
.notice-detail:last-child { padding-bottom: 0; }
.notice-detail h3 { margin: 0 0 8px; color: var(--primary-dark); font-size: 17px; }
.notice-detail p { margin: 0; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice-management-item { align-items: flex-start; }
.notice-management-item .item-main { flex: 1; }
.notice-management-item .item-main p {
  display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  line-height: 1.6;
}
.item-main { min-width: 0; }
.item-main p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.item-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.item-main-button {
  flex: 1; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.item-main-button:focus-visible { outline: 3px solid rgba(124,58,237,.25); outline-offset: 4px; border-radius: 10px; }
.session-message-item { align-items: flex-start; }
.session-message-item .item-actions { align-items: center; }

.menu-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.menu-card {
  min-height: 125px; display: flex; flex-direction: column; justify-content: space-between;
  border: 1px solid var(--line); border-radius: 18px; padding: 17px;
  background: white; color: var(--ink); text-align: left;
}
.menu-card:hover { border-color: #c4b5fd; box-shadow: 0 10px 28px rgba(124,58,237,.1); }
.menu-card .nav-icon {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  overflow: hidden;
  border-radius: 50%;
  color: inherit;
  background: transparent;
}
.menu-card strong {
  margin-top: 10px;
}
.menu-card small { color: var(--muted); }

.filter-bar {
  display: grid; grid-template-columns: 1.7fr 1fr 1fr auto; gap: 10px;
  padding: 16px; border-radius: 18px; background: white; border: 1px solid var(--line);
}
.user-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.user-card { position: relative; }
.avatar {
  width: 52px; height: 52px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 17px; color: white; background: linear-gradient(135deg, #8b5cf6, #ec4899);
  font-size: 19px; font-weight: 800;
}
.avatar.has-image { overflow: hidden; background: #e5e7eb; }
.avatar.has-image img { width: 100%; height: 100%; display: block; object-fit: cover; }
.avatar-row { display: flex; align-items: center; gap: 13px; }
.user-card h3 { margin: 0 0 4px; font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.chip { padding: 6px 9px; border-radius: 999px; background: #f3f4f6; color: #4b5563; font-size: 12px; }
.match { color: var(--primary); font-weight: 800; font-size: 13px; }
.match-empty { color: var(--muted); }
.user-card-count { margin-top: 12px; }
.participation-count {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px; border: 1px solid #fed7aa; border-radius: 999px;
  color: #7c2d12; background: linear-gradient(135deg, #fff7ed, #ffedd5);
  box-shadow: 0 8px 22px rgba(251,146,60,.12); font-size: 12px; font-weight: 800;
}
.participation-count-icon {
  width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 50%; color: white; background: linear-gradient(135deg, #f97316, #ec4899);
  font-size: 12px;
}
.participation-count strong { color: #9a3412; font-size: 16px; }
.participation-count-start {
  border-color: #e5e7eb; color: #4b5563; background: linear-gradient(135deg, #ffffff, #f3f4f6);
  box-shadow: 0 8px 20px rgba(107,114,128,.1);
}
.participation-count-start .participation-count-icon { background: linear-gradient(135deg, #9ca3af, #6b7280); }
.participation-count-note {
  border-color: #fed7aa; color: #7c2d12; background: linear-gradient(135deg, #fff7ed, #ffedd5);
  box-shadow: 0 8px 22px rgba(251,146,60,.12);
}
.participation-count-note .participation-count-icon { background: linear-gradient(135deg, #f97316, #ec4899); }
.participation-count-music {
  border-color: #c4b5fd; color: #4c1d95; background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  box-shadow: 0 8px 22px rgba(124,58,237,.14);
}
.participation-count-music .participation-count-icon { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.participation-count-band {
  border-color: #86efac; color: #14532d; background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  box-shadow: 0 8px 22px rgba(34,197,94,.14);
}
.participation-count-band .participation-count-icon { background: linear-gradient(135deg, #22c55e, #14b8a6); }
.participation-count-silver {
  border-color: #bfdbfe; color: #1e3a8a; background: linear-gradient(135deg, #eff6ff, #dbeafe);
  box-shadow: 0 8px 22px rgba(59,130,246,.14);
}
.participation-count-silver .participation-count-icon { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.participation-count-gold {
  border-color: #fde68a; color: #713f12; background: linear-gradient(135deg, #fffbeb, #fef3c7);
  box-shadow: 0 8px 24px rgba(245,158,11,.18);
}
.participation-count-gold .participation-count-icon { background: linear-gradient(135deg, #f59e0b, #f97316); }
.participation-count-legend {
  border-color: #fcd34d; color: #78350f; background: linear-gradient(135deg, #fef9c3, #fde68a);
  box-shadow: 0 8px 26px rgba(234,179,8,.2);
}
.participation-count-legend .participation-count-icon { background: linear-gradient(135deg, #eab308, #f97316); }
.participation-count-fire {
  border-color: #fb7185; color: #881337; background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  box-shadow: 0 8px 26px rgba(244,63,94,.18);
}
.participation-count-fire .participation-count-icon { background: linear-gradient(135deg, #ef4444, #f97316); }
.participation-count-star {
  border-color: #a5b4fc; color: #312e81; background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  box-shadow: 0 8px 26px rgba(99,102,241,.18);
}
.participation-count-star .participation-count-icon { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.participation-count-festival {
  border-color: #67e8f9; color: #164e63; background: linear-gradient(135deg, #ecfeff, #cffafe);
  box-shadow: 0 8px 26px rgba(6,182,212,.18);
}
.participation-count-festival .participation-count-icon { background: linear-gradient(135deg, #06b6d4, #14b8a6); }
.participation-count-diamond {
  border-color: #93c5fd; color: #1e40af; background: linear-gradient(135deg, #eff6ff, #e0f2fe);
  box-shadow: 0 8px 28px rgba(37,99,235,.2);
}
.participation-count-diamond .participation-count-icon { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.participation-count-crown {
  border-color: #f9a8d4; color: #831843; background: linear-gradient(135deg, #fdf2f8, #fae8ff);
  box-shadow: 0 8px 30px rgba(217,70,239,.22);
}
.participation-count-crown .participation-count-icon { background: linear-gradient(135deg, #d946ef, #ec4899); }

.member-filter-bar { grid-template-columns: minmax(220px, 1.5fr) minmax(130px, .8fr) minmax(150px, .9fr) minmax(130px, .8fr); }
.member-search-row { display: flex; gap: 10px; align-items: stretch; }
.member-search-row .input { flex: 1; min-width: 0; }
.member-search-row .btn { min-width: 96px; }
.member-management-list { margin-top: 18px; }
.member-management-card { display: grid; gap: 18px; }
.member-management-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.member-management-form { align-items: start; }
.member-management-card .chips { margin-top: 0; min-height: 38px; align-items: center; }

.event-card { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; align-items: center; gap: 18px; }
.party-deadline {
  width: fit-content; margin-top: 10px; padding: 6px 10px;
  border: 1px solid #fde68a; border-radius: 999px;
  color: #92400e; background: #fffbeb; font-size: 12px; font-weight: 800;
}
.party-deadline.is-closed { border-color: #fecaca; color: #b91c1c; background: #fef2f2; }
.event-registration-closed {
  width: fit-content; margin-top: 10px; padding: 6px 10px;
  border: 1px solid #fecaca; border-radius: 999px;
  color: #b91c1c; background: #fef2f2; font-size: 12px; font-weight: 800;
}
.event-schedule-card {
  grid-template-columns: 90px minmax(280px, 1fr) minmax(180px, 230px) minmax(210px, 250px);
  align-items: start;
}
.event-schedule-card .participation-status { align-self: center; }
.event-schedule-card .item-actions {
  display: grid; grid-template-columns: 1fr; align-self: center; justify-content: stretch;
}
.event-schedule-card .item-actions .btn { width: 100%; }
.date-box { padding: 13px 8px; border-radius: 16px; color: var(--primary-dark); background: #ede9fe; text-align: center; }
.date-box strong { display: block; font-size: 23px; }
.date-box small { font-size: 11px; }
.event-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 13px; margin-top: 8px; }
.event-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.event-links .btn { min-width: 112px; }
.participation-status { display: grid; grid-template-columns: repeat(2, minmax(90px, 1fr)); gap: 8px; }
.participation-status > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--soft); text-align: center; }
.status-label { display: block; color: var(--muted); font-size: 11px; }
.status-value { display: block; margin-top: 3px; font-size: 15px; }
.status-value.is-joined { color: var(--success); }
.status-value.is-not-joined { color: var(--danger); }
.part-sheet-btn { min-width: 130px; }

.history-summary { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.history-summary strong { color: var(--primary-dark); font-size: 34px; line-height: 1; }
.history-card {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center; gap: 14px;
}
.history-date { color: var(--ink); font-weight: 800; white-space: nowrap; }
.history-card .item-main { min-width: 0; }
.history-card .item-actions { flex-wrap: nowrap; }
.history-card-group { align-items: start; }
.history-members {
  display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px;
}
.history-member-count,
.history-member-chip {
  display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 800;
}
.history-member-count { color: #065f46; background: #d1fae5; }
.history-member-chip { color: #4b5563; background: #f3f4f6; }
.history-filter-bar { grid-template-columns: minmax(220px, 360px); margin-bottom: 16px; }
.history-member-list {
  display: grid; gap: 8px; width: 100%; max-width: 100%; max-height: 320px;
  overflow-x: hidden; overflow-y: auto;
  margin-top: 10px; padding: 10px; border: 1px solid var(--line);
  border-radius: 16px; background: #faf9fc;
}
.history-member-option {
  width: 100%; min-width: 0; max-width: 100%; align-items: center; border-radius: 14px; background: white;
}
.history-member-option .avatar-row,
.history-member-option .avatar-row > div { min-width: 0; max-width: 100%; }
.history-member-option .avatar-row { flex: 1; overflow: hidden; }
.history-member-option small { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.history-member-option input { width: 18px; height: 18px; accent-color: var(--primary); }

.chat-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); min-height: 590px; padding: 0; overflow: hidden; }
.chat-list { min-width: 0; border-right: 1px solid var(--line); overflow: hidden; }
.chat-list-head, .chat-head { padding: 18px; border-bottom: 1px solid var(--line); }
.chat-list-title, .chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-head { flex-direction: column; align-items: stretch; }
.chat-head-title { text-align: center; }
.chat-head-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }
.chat-head-title small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.chat-head-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-head-actions .btn { flex: 0 1 150px; }
.chat-list-title small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.chat-search { padding: 12px 14px; border-bottom: 1px solid var(--line); background: white; }
.chat-person { position: relative; width: 100%; display: flex; gap: 11px; padding: 14px 16px; border: 0; border-bottom: 1px solid #f1f1f3; background: white; text-align: left; }
.chat-person.active { background: #f5f3ff; }
.chat-person .avatar { width: 43px; height: 43px; border-radius: 14px; font-size: 15px; }
.chat-avatar-wrap { position: relative; flex: 0 0 43px; width: 43px; height: 43px; }
.chat-avatar-wrap .avatar { width: 100%; height: 100%; }
.chat-avatar-wrap .chat-unread-dot { position: absolute; top: -4px; left: -5px; }
.chat-person-content { min-width: 0; flex: 1; }
.chat-person-content div { display: flex; justify-content: space-between; gap: 8px; }
.chat-person p { margin: 5px 0 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-room { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head {
  position: sticky; top: 0; z-index: 3;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
}
.messages { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 20px; background: #faf9fc; overflow-y: auto; }
.chat-message-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-message-row.mine { justify-content: flex-end; }
.chat-message-row.other { justify-content: flex-start; }
.chat-message-avatar { width: 34px; height: 34px; border-radius: 50%; font-size: 12px; }
.bubble { max-width: min(75%, 580px); padding: 11px 14px; border-radius: 17px 17px 17px 4px; background: white; box-shadow: 0 4px 18px rgba(39,26,61,.06); }
.bubble.mine { color: white; border-radius: 17px 17px 4px 17px; background: linear-gradient(135deg, var(--primary), #9333ea); }
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble a {
  color: var(--primary-dark); font-size: .88em; font-weight: 800;
  line-height: 1.35; text-decoration: underline; overflow-wrap: anywhere; word-break: break-word;
}
.bubble.mine a { color: white; }
.deleted-message { color: var(--muted); font-style: italic; }
.bubble.mine .deleted-message { color: rgba(255,255,255,.78); }
.reply-preview, .reply-compose {
  margin-bottom: 8px; padding: 8px 10px; border-left: 3px solid #c4b5fd;
  border-radius: 10px; background: rgba(124,58,237,.08); color: var(--muted); font-size: 12px;
}
.reply-preview {
  width: 100%; border-top: 0; border-right: 0; border-bottom: 0;
  text-align: left; font-family: inherit; line-height: inherit; cursor: pointer;
}
.reply-preview:hover { background: rgba(124,58,237,.14); }
.bubble.mine .reply-preview { background: rgba(255,255,255,.14); color: rgba(255,255,255,.82); border-left-color: rgba(255,255,255,.75); }
.bubble.mine .reply-preview:hover { background: rgba(255,255,255,.22); }
.reply-preview span, .reply-compose span { display: block; margin-bottom: 2px; font-weight: 800; color: var(--primary-dark); }
.bubble.mine .reply-preview span { color: white; }
.bubble.reply-source-highlight { animation: reply-source-pulse 1.8s ease; }
@keyframes reply-source-pulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(39,26,61,.06); }
  25%, 70% { box-shadow: 0 0 0 4px rgba(236,72,153,.32), 0 8px 24px rgba(124,58,237,.2); }
}
.reaction-summary { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.reaction-summary span { padding: 3px 7px; border-radius: 999px; background: #f3f4f6; color: #4b5563; font-size: 11px; }
.reaction-buttons {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.reaction-buttons button {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid #ede9fe; border-radius: 999px; background: #fff;
  cursor: pointer; font-size: 14px; line-height: 1;
}
.reaction-buttons button.active {
  border-color: var(--primary); background: #ede9fe; box-shadow: 0 0 0 2px rgba(124,58,237,.1);
}
.reaction-buttons button:hover { background: #f5f3ff; }
.bubble b { display: block; margin-bottom: 4px; color: var(--primary-dark); font-size: 11px; }
.bubble.mine b { color: white; opacity: .8; }
.bubble small { display: block; margin-top: 5px; opacity: .62; font-size: 10px; }
.chat-message-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chat-message-actions button { padding: 0; border: 0; color: inherit; background: transparent; font-size: 11px; font-weight: 800; opacity: .78; text-decoration: underline; }
.chat-message-actions button:hover { opacity: 1; }
.chat-scroll-bottom {
  position: absolute; right: 18px; bottom: 86px; z-index: 4;
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 0; border-radius: 50%; color: white;
  background: linear-gradient(135deg, var(--primary), #ec4899);
  box-shadow: 0 12px 28px rgba(124,58,237,.25);
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: .18s ease;
  font-size: 20px; font-weight: 900;
}
.chat-scroll-bottom.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.chat-compose { position: sticky; bottom: 0; z-index: 3; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; padding: 15px; border-top: 1px solid var(--line); background: white; }
.chat-input {
  height: 48px; min-height: 48px; max-height: 132px; padding-block: 12px;
  line-height: 1.55; resize: none; overflow-y: hidden;
}
.reply-compose { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; margin-bottom: 0; }
.reply-compose span, .reply-compose strong { grid-column: 1; }
.reply-compose button { grid-row: 1 / 3; grid-column: 2; width: 28px; height: 28px; border: 0; border-radius: 50%; background: #ede9fe; color: var(--primary-dark); }
.group-detail-add-member span { display: grid; gap: 2px; }
.group-detail-add-member small { color: var(--muted); font-size: 11px; font-weight: 700; }

.board-filters { display: grid; grid-template-columns: minmax(220px, 1fr) 150px; gap: 10px; flex: 1; }
.board-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.board-card { display: flex; flex-direction: column; }
.board-card h3 { margin-bottom: 6px; }
.board-card p { color: var(--muted); line-height: 1.65; }
.board-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 18px; }
.board-footer small { color: var(--muted); }
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.theme-option input { position: absolute; opacity: 0; }
.theme-option span { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.theme-option input:checked + span { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(124,58,237,.1); }
.theme-option i { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; font-style: normal; font-weight: 800; }
.color-input { width: 100%; height: 48px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.customize-preview { min-height: 390px; transition: .2s background, .2s color; }
.customize-preview h2 { margin: 45px 0 25px; font-size: 34px; }
.preview-menu { display: grid; gap: 10px; }
.preview-menu span { padding: 14px; border: 1px solid currentColor; border-radius: 13px; opacity: .78; }
.profile-avatar { width: 72px; height: 72px; border-radius: 22px; font-size: 24px; }
.profile-detail-hero { display: flex; align-items: flex-start; gap: 14px; }
.profile-avatar-stack { display: grid; justify-items: center; gap: 8px; }
.profile-avatar-stack .participation-count { padding: 6px 10px; font-size: 11px; white-space: nowrap; }
.profile-avatar-stack .participation-count-icon { width: 20px; height: 20px; }
.profile-image-editor { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; padding: 18px; border-radius: 18px; background: var(--soft); }
.profile-image-large { width: 96px; height: 96px; border-radius: 28px; font-size: 30px; }
.profile-image-editor p { margin: 6px 0 12px; font-size: 13px; }
.profile-detail-section { padding: 18px 0; border-top: 1px solid var(--line); }
.profile-detail-section h3 { margin: 0 0 14px; color: var(--primary-dark); font-size: 16px; }
.profile-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.profile-facts > div { padding: 12px; border-radius: 13px; background: var(--soft); }
.profile-facts span, .detail-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.profile-facts strong { font-size: 14px; }
.detail-list { margin: 8px 0 0; padding-left: 20px; line-height: 1.8; }
.profile-bio { margin: 8px 0 0; padding: 14px; border-radius: 13px; background: var(--soft); line-height: 1.8; white-space: pre-wrap; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: 20px; background: rgba(17,24,39,.52); backdrop-filter: blur(5px);
}
.modal { width: min(100%, 620px); min-width: 0; max-width: 100%; max-height: 90vh; overflow-x: hidden; overflow-y: auto; padding: 25px; border-radius: 24px; background: white; box-shadow: var(--shadow); }
.modal * { min-width: 0; }
.modal-lg { width: min(100%, 820px); }
.modal-head { display: flex; justify-content: space-between; gap: 15px; align-items: start; margin-bottom: 22px; }
.modal-head h2 { margin: 0; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f3f4f6; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.empty { padding: 50px 20px; color: var(--muted); text-align: center; }
.divider { height: 1px; margin: 20px 0; background: var(--line); }
.muted { color: var(--muted); }
.toast {
  position: fixed; z-index: 100; right: 22px; bottom: 22px; max-width: 360px;
  padding: 13px 17px; border-radius: 13px; color: white; background: #111827;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-header { display: none; }
.mobile-menu-toggle { display: none; }

@media (max-width: 1050px) {
  .menu-grid, .user-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .board-grid { grid-template-columns: 1fr; }
  .event-schedule-card { grid-template-columns: 80px minmax(0, 1fr); }
  .event-schedule-card .participation-status,
  .event-schedule-card .item-actions { grid-column: 1 / -1; }
  .event-schedule-card .item-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { min-height: 290px; padding: 42px 28px; }
  .auth-mascot { width: min(190px, 44vw); margin-top: 24px; }
  .hero-points { display: none; }
  .auth-panel { padding: 34px 24px; }
  .app-shell { display: block; }
  .sidebar {
    inset: auto 0 0 0; width: 100vw; height: 72px; padding: 8px;
    max-width: 100vw; min-width: 100vw; flex-direction: row; overflow: hidden;
    background: linear-gradient(90deg, var(--sidebar-start), var(--sidebar-middle) 55%, var(--sidebar-end)); backdrop-filter: blur(10px);
  }
  .side-brand, .side-user { display: none; }
  .nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    flex: 1; min-width: 0; overflow: hidden; overscroll-behavior: contain;
  }
  .nav-btn {
    min-width: 0; width: auto; flex-direction: column; justify-content: center;
    gap: 3px; padding: 5px 2px; font-size: 10px; text-align: center;
  }
  .nav-unread-dot { top: 2px; left: calc(50% + 7px); }
  .nav-btn:nth-child(n+6) { display: none; }
  .nav-icon { width: 24px; height: 24px; }
  .mobile-menu-toggle {
    display: grid; place-items: center; flex: 0 0 58px; height: 100%;
    border: 0; border-radius: 14px; color: white; background: rgba(255,255,255,.12);
    font-size: 10px; font-weight: 800;
  }
  .mobile-menu-arrow { display: block; line-height: 1; font-size: 20px; }
  .sidebar.mobile-menu-open {
    height: min(78vh, 520px); padding: 14px; flex-direction: column;
    border-radius: 24px 24px 0 0; box-shadow: 0 -18px 48px rgba(17,24,39,.25);
  }
  .sidebar.mobile-menu-open .nav {
    order: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
    overflow-y: auto; padding-bottom: 8px;
  }
  .sidebar.mobile-menu-open .nav-btn,
  .sidebar.mobile-menu-open .nav-btn:nth-child(n+6) {
    display: flex; min-height: 56px; flex-direction: row; justify-content: flex-start;
    gap: 10px; padding: 10px; font-size: 13px; text-align: left;
  }
  .sidebar.mobile-menu-open .mobile-menu-toggle {
    order: 1; align-self: stretch; height: 42px; flex: 0 0 auto;
    grid-auto-flow: column; gap: 8px; margin-bottom: 10px;
  }
  .main { width: 100%; max-width: 100vw; padding: 22px 16px 100px; overflow-x: hidden; }
  .topbar { align-items: start; }
  .topbar-actions { align-items: flex-end; flex-direction: column; }
  .page-back { max-width: 150px; white-space: normal; line-height: 1.35; }
  .mobile-logout { display: inline-flex; }
  .desktop-logout { display: none; }
  .grid-2, .grid-3, .user-grid { grid-template-columns: 1fr; }
  .repeatable-row-song { grid-template-columns: 30px minmax(0, 1fr); }
  .repeatable-row-song .input { grid-column: 2; }
  .profile-facts { grid-template-columns: 1fr; }
  .profile-image-editor { align-items: flex-start; }
  .menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .event-card { grid-template-columns: 70px 1fr; }
  .event-card .participation-status { grid-column: 1 / -1; }
  .event-card .item-actions { grid-column: 1 / -1; justify-content: stretch; }
  .event-card .item-actions .btn { flex: 1 1 180px; }
  .event-schedule-card .item-actions { display: flex; }
  .history-card { grid-template-columns: 1fr; align-items: stretch; }
  .history-card .item-actions { justify-content: flex-start; flex-wrap: wrap; }
  .filter-bar { grid-template-columns: 1fr; }
  .board-filters { grid-template-columns: 1fr; width: 100%; }
  .section-heading:has(.board-filters) { align-items: stretch; flex-direction: column; }
  .chat-layout { grid-template-columns: 1fr; min-height: 650px; }
  .chat-layout:has(.chat-room:not(.mobile-hidden)) {
    height: clamp(560px, calc(100dvh - 160px), 760px);
    min-height: 560px;
    overflow: hidden;
  }
  .chat-layout:has(.chat-room:not(.mobile-hidden)) .chat-room {
    min-height: 0; max-height: 100%; overflow: hidden;
  }
  .chat-layout:has(.chat-room:not(.mobile-hidden)) .messages {
    min-height: 300px; overflow-y: auto; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch; touch-action: pan-y;
  }
  .chat-layout:has(.chat-room:not(.mobile-hidden)) .chat-compose { flex-shrink: 0; }
  .chat-list-head { padding: 18px 16px; }
  .chat-head { padding: 16px; gap: 12px; }
  .chat-head-title strong { font-size: 20px; white-space: normal; }
  .chat-head-actions .btn { flex: 1; min-height: 44px; padding-inline: 10px; }
  .chat-list-title { display: grid; grid-template-columns: 1fr; align-items: stretch; }
  .chat-list-title .btn {
    width: min(78%, 260px); max-width: 100%; min-height: 42px; justify-self: center;
    padding-inline: 14px; white-space: normal;
  }
  .chat-list { display: none; }
  .chat-list.mobile-open { display: block; border-right: 0; }
  .chat-room.mobile-hidden { display: none; }
  .member-search-row { flex-direction: column; }
  .member-search-row .btn { width: 100%; min-height: 44px; }
  .member-card, .member-card .list-item, .member-card .avatar-row { min-width: 0; overflow: hidden; }
  .member-card .avatar-row > div { min-width: 0; }
  .member-card small { overflow-wrap: anywhere; word-break: break-word; }
}
.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}
/* ホーム画面のメニューカードは常に濃い文字色にする */
.menu-card {
  color: #174b32;
}

.menu-card strong {
  color: #174b32;
}

.menu-card small {
  color: #6b7280;
}

.profile-save-actions {
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.profile-preview-note {
  margin: 8px 0 0;
  text-align: right;
  font-size: 12px;
}

.mobile-refresh {
  display: none;
}

@media (max-width: 780px) {
  .mobile-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

.stats-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}