/* ============================================
   お勉強お小遣い帳 - ポップ&カラフルデザイン
   ============================================ */

:root {
  --color-main: #E1F5FE;
  --color-accent-gold: #FFC107;
  --color-accent-gold-dark: #FFA000;
  --color-sub-pink: #FF4081;
  --color-sub-pink-dark: #E91E63;
  --color-bg: #FFF9E6;
  --color-text: #333333;
  --color-text-light: #757575;
  --color-blue: #29B6F6;
  --color-green: #66BB6A;
  --color-purple: #AB47BC;
  --shadow-pop: 0 6px 0 rgba(0,0,0,0.15);
  --shadow-pop-sm: 0 4px 0 rgba(0,0,0,0.15);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'M PLUS Rounded 1c', 'Zen Maru Gothic', sans-serif;
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle, rgba(255,193,7,0.15) 2px, transparent 2px),
    radial-gradient(circle, rgba(255,64,129,0.1) 2px, transparent 2px);
  background-size: 40px 40px, 60px 60px;
  background-position: 0 0, 20px 20px;
  color: var(--color-text);
  margin: 0;
  min-height: 100vh;
}

/* ============ ヘッダー ============ */
.app-header {
  background: linear-gradient(135deg, var(--color-blue) 0%, #4FC3F7 100%);
  box-shadow: 0 4px 12px rgba(41,182,246,0.35);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-title {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  color: white;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.15);
  letter-spacing: 0.02em;
}

/* ============ ボトムナビ ============ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 3px solid var(--color-main);
  display: flex;
  justify-content: space-around;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  z-index: 30;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  padding: 6px 12px;
  border-radius: 14px;
  color: var(--color-text-light);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s ease;
  flex: 1;
  max-width: 100px;
}

.nav-btn i {
  font-size: 1.25rem;
}

.nav-btn.active {
  color: var(--color-sub-pink-dark);
  background: #FFF0F5;
  transform: translateY(-2px);
}

.nav-btn:active {
  transform: scale(0.92);
}

/* ============ 汎用ボタン ============ */
.btn {
  font-family: inherit;
  font-weight: 800;
  border: none;
  border-radius: 16px;
  padding: 12px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1rem;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(3px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--color-blue);
  color: white;
  box-shadow: var(--shadow-pop-sm) #0288D1;
}
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 #0288D1; }

.btn-secondary {
  background: #ECEFF1;
  color: var(--color-text);
  box-shadow: var(--shadow-pop-sm) #B0BEC5;
}
.btn-secondary:active { box-shadow: 0 1px 0 #B0BEC5; }

.btn-gold {
  background: linear-gradient(135deg, #FFD54F, var(--color-accent-gold));
  color: #6D4C00;
  box-shadow: var(--shadow-pop-sm) var(--color-accent-gold-dark);
}
.btn-gold:active:not(:disabled) { box-shadow: 0 1px 0 var(--color-accent-gold-dark); }

.btn-danger {
  background: #EF5350;
  color: white;
  box-shadow: var(--shadow-pop-sm) #C62828;
}
.btn-danger:active { box-shadow: 0 1px 0 #C62828; }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; border-radius: 12px; }

.icon-btn {
  background: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-light);
  box-shadow: 0 2px 0 rgba(0,0,0,0.1);
  transition: transform 0.1s ease;
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }
.icon-btn.danger { color: #EF5350; }
.icon-btn.edit { color: var(--color-blue); }

/* ============ ダッシュボード：子どもカード ============ */
.section-title {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--color-text);
  margin: 20px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.children-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .children-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .children-grid { grid-template-columns: repeat(3, 1fr); }
}

.child-card {
  background: white;
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 6px 0 rgba(0,0,0,0.08), 0 8px 20px rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
  border: 3px solid white;
}

.child-card::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  background: var(--color-main);
  border-radius: 50%;
  opacity: 0.6;
  z-index: 0;
}

.child-card-inner { position: relative; z-index: 1; }

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

.child-name {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.child-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-sub-pink), #FF80AB);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
  font-size: 1rem;
  flex-shrink: 0;
}

.unsettled-label {
  font-size: 0.75rem;
  color: var(--color-text-light);
  font-weight: 700;
  margin-bottom: 2px;
}

.unsettled-amount {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 900;
  font-size: 2.1rem;
  color: var(--color-accent-gold-dark);
  text-shadow: 1px 1px 0 rgba(255,193,7,0.3);
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 14px;
}

.unsettled-amount .unit { font-size: 1.1rem; }

.child-card-actions {
  display: flex;
  gap: 8px;
}

.child-card-actions .btn { flex: 1; padding: 10px 8px; font-size: 0.85rem; }

/* ============ 空状態 ============ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--color-text-light);
}
.empty-state i { font-size: 3rem; color: #FFD54F; margin-bottom: 12px; }
.empty-state p { font-weight: 700; }

/* ============ カード（一覧系） ============ */
.list-card {
  background: white;
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.04);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.list-card-main { flex: 1; min-width: 0; }
.list-card-title { font-weight: 800; font-size: 0.98rem; }
.list-card-sub { font-size: 0.8rem; color: var(--color-text-light); margin-top: 2px; }

.list-card-amount {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--color-accent-gold-dark);
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge-unsettled { background: #FFEBEE; color: #E53935; }
.badge-settled { background: #E8F5E9; color: #43A047; }

.list-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ============ フィルタータブ・チップ ============ */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  background: white;
  border: 2px solid var(--color-main);
  color: var(--color-text);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-chip.active {
  background: var(--color-blue);
  border-color: var(--color-blue);
  color: white;
}

.filter-select-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.filter-select-row select {
  flex: 1;
  min-width: 0;
}

/* ============ きろく一覧：並び替え ============ */
.sort-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.sort-select-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-light);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sort-select {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  font-size: 0.85rem;
}

/* ============ 月別集計：月選択・合計 ============ */
.month-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.month-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: none;
  background: var(--color-main);
  color: #0288D1;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 3px 0 #B3E5FC;
}
.month-nav-btn:active { transform: translateY(2px); box-shadow: none; }

.month-input {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-weight: 800;
}

.summary-grand-total {
  margin-top: 6px;
  background: linear-gradient(135deg, #FFD54F, var(--color-accent-gold));
  border-radius: 18px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.95rem;
  color: #6D4C00;
  box-shadow: 0 4px 0 var(--color-accent-gold-dark);
}

.summary-grand-total strong {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 1.6rem;
}

/* ============ 設定画面タブ ============ */
.settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: white;
  padding: 5px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.settings-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--color-text-light);
  transition: all 0.15s ease;
}

.settings-tab.active {
  background: var(--color-sub-pink);
  color: white;
}

.fab-add {
  position: fixed;
  bottom: 92px;
  right: 20px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-sub-pink), var(--color-sub-pink-dark));
  color: white;
  font-size: 1.5rem;
  border: none;
  box-shadow: 0 5px 0 #C2185B, 0 8px 18px rgba(233,30,99,0.4);
  cursor: pointer;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease;
}
.fab-add:active { transform: translateY(4px); box-shadow: 0 1px 0 #C2185B; }

/* ============ モーダル / dialog ============ */
.app-dialog {
  border: none;
  border-radius: 24px;
  padding: 0;
  width: 92%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  background: var(--color-bg);
}

.app-dialog::backdrop {
  background: rgba(51,51,51,0.55);
  backdrop-filter: blur(2px);
}

.dialog-content { display: flex; flex-direction: column; }

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--color-blue), #4FC3F7);
  border-radius: 24px 24px 0 0;
}

.dialog-header h2 {
  color: white;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialog-close {
  background: rgba(255,255,255,0.25);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialog-body { padding: 20px; }

.dialog-footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px 20px;
}

.dialog-footer .btn { flex: 1; }

.form-label {
  display: block;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin: 14px 0 6px;
}
.form-label:first-child { margin-top: 0; }

.form-input, .form-select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #E0E0E0;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1rem;
  background: white;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--color-blue);
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: none;
  background: var(--color-main);
  color: #0288D1;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 3px 0 #B3E5FC;
}
.qty-btn:active { transform: translateY(2px); box-shadow: none; }

.amount-preview {
  margin-top: 16px;
  background: #FFF8E1;
  border: 2px dashed var(--color-accent-gold);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.9rem;
}

.amount-preview strong {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 1.4rem;
  color: var(--color-accent-gold-dark);
}

.price-input-wrap {
  position: relative;
}
.price-unit {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 800;
  color: var(--color-text-light);
}

/* ============ 一括登録：勉強項目リスト ============ */
.record-bulk-dialog {
  max-width: 460px;
}

.bulk-items-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 42vh;
  overflow-y: auto;
  padding: 2px;
  margin-top: 4px;
  margin-bottom: 4px;
}

.bulk-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: white;
  border: 2px solid var(--color-main);
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.bulk-item-row:last-child {
  margin-bottom: 0;
}

.bulk-item-row.has-quantity {
  border-color: var(--color-accent-gold);
  background: #FFFBEE;
}

.bulk-item-info { min-width: 0; flex: 1; }

.bulk-item-name {
  font-weight: 800;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bulk-item-price {
  font-size: 0.72rem;
  color: var(--color-text-light);
  font-weight: 700;
}

.bulk-item-qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  border: 2px solid var(--color-main);
  border-radius: 14px;
  padding: 4px 6px;
  background: #FBFEFF;
}

.bulk-item-row.has-quantity .bulk-item-qty-control {
  border-color: var(--color-accent-gold);
  background: white;
}

.bulk-qty-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: var(--color-main);
  color: #0288D1;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 0 #B3E5FC;
}
.bulk-qty-btn:active { transform: translateY(2px); box-shadow: none; }

.bulk-qty-input {
  width: 52px;
  text-align: center;
  padding: 8px 4px;
  border: 2px solid #E0E0E0;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  outline: none;
}
.bulk-qty-input:focus { border-color: var(--color-blue); }

.bulk-item-subtotal {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 900;
  font-size: 0.8rem;
  color: var(--color-accent-gold-dark);
  min-width: 52px;
  text-align: right;
  flex-shrink: 0;
}

.settlement-amount {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 900;
  font-size: 2.6rem;
  color: var(--color-accent-gold-dark);
  margin: 8px 0;
}

.settlement-note {
  color: var(--color-text-light);
}

/* ============ トースト ============ */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 92%;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  background: white;
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  animation: toast-in 0.3s ease;
  border-left: 5px solid var(--color-blue);
}

.toast.error { border-left-color: #EF5350; color: #C62828; }
.toast.success { border-left-color: var(--color-green); color: #2E7D32; }

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

.toast.hide {
  animation: toast-out 0.3s ease forwards;
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-10px); }
}

/* ============ カウントアップ ============ */
.count-up { transition: none; }

/* ============ 精算セレブレーション演出 ============ */
#celebration-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  overflow: hidden;
  display: none;
}

#celebration-overlay.active { display: block; }

.confetti-piece {
  position: absolute;
  top: -20px;
  will-change: transform, opacity;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.2;
  }
}

.celebration-badge {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: linear-gradient(135deg, #FFD54F, var(--color-accent-gold));
  color: #6D4C00;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  padding: 24px 36px;
  border-radius: 24px;
  box-shadow: 0 10px 0 var(--color-accent-gold-dark), 0 20px 40px rgba(0,0,0,0.3);
  text-align: center;
  animation: badge-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes badge-pop {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-10deg); }
  60% { transform: translate(-50%, -50%) scale(1.15) rotate(3deg); }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

/* ============ ローディング ============ */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-dark {
  border: 2.5px solid rgba(0,0,0,0.15);
  border-top-color: var(--color-text-light);
}

@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  color: var(--color-text-light);
}
.page-loading .spinner { width: 2rem; height: 2rem; border-width: 3px; }

/* ============ ユーティリティ ============ */
.text-center { text-align: center; }
.mb-2 { margin-bottom: 8px; }
.text-sm { font-size: 0.85rem; }

/* ============ 起動中 / ログイン画面 ============ */
.boot-loading {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--color-text-light);
  font-weight: 700;
}
.boot-loading .spinner { width: 2rem; height: 2rem; border-width: 3px; }
.boot-loading[hidden], .login-view[hidden], #app[hidden] { display: none; }

.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: white;
  border-radius: 28px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-pop), 0 12px 32px rgba(0,0,0,0.08);
  border: 4px solid var(--color-main);
}
.login-logo { font-size: 3.5rem; line-height: 1; }
.login-title {
  font-family: 'Zen Maru Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.6rem;
  color: var(--color-blue);
  margin: 10px 0 6px;
}
.login-lead { color: var(--color-text-light); font-weight: 700; margin-bottom: 22px; line-height: 1.6; }
.login-btn { margin-top: 12px; padding: 14px 16px; }

.header-inner { position: relative; }
.header-logout {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.22);
  border: none;
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
}
.header-logout:active { background: rgba(255,255,255,0.4); }

/* 子ども端末では「せってい」を出さない */
.role-child .nav-btn[data-view="settings"] { display: none; }

/* ============ ホーム画面追加バナー ============ */
.install-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 12px 0;
  padding: 12px 14px;
  background: white;
  border: 3px solid var(--color-main);
  border-radius: 16px;
  box-shadow: var(--shadow-pop-sm);
  color: var(--color-text);
}
.install-banner > i.fa-mobile-screen-button { color: var(--color-blue); font-size: 1.2rem; flex-shrink: 0; }
.install-banner-text { flex: 1; font-size: 0.85rem; line-height: 1.5; }
.install-banner-close {
  background: none;
  border: none;
  color: var(--color-text-light);
  font-size: 1rem;
  padding: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
@media (max-width: 420px) {
  .install-banner { flex-wrap: wrap; }
  .install-banner-text { flex-basis: 100%; order: 1; }
  #install-banner-btn { order: 2; }
  .install-banner-close { order: 3; margin-left: auto; }
}

/* ============ かぞくコード参加 / 自分を選ぶ ============ */
.join-code-input {
  text-align: center;
  font-size: 1.8rem;
  letter-spacing: 0.3em;
  font-weight: 900;
}
.picker-list { display: flex; flex-direction: column; gap: 10px; }
.picker-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: white;
  border: 3px solid var(--color-main);
  border-radius: 16px;
  padding: 12px 14px;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--color-text);
  box-shadow: var(--shadow-pop-sm);
  cursor: pointer;
}
.picker-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.15); }

/* ============ せってい：かぞく ============ */
.family-card {
  background: white;
  border-radius: 20px;
  padding: 20px 18px;
  margin-bottom: 14px;
  text-align: center;
  box-shadow: var(--shadow-pop-sm);
  border: 3px solid var(--color-main);
}
.family-label { font-weight: 800; color: var(--color-text-light); font-size: 0.9rem; }
.family-code {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--color-sub-pink-dark);
  margin: 6px 0 10px;
}
.family-qr { display: flex; justify-content: center; margin: 8px auto 12px; }
.family-qr svg { width: 180px; height: 180px; border-radius: 10px; background: white; }
.family-note { color: var(--color-text-light); line-height: 1.6; margin-bottom: 14px; }
.family-account-name { font-weight: 800; margin-top: 4px; }
.privacy-link { display: inline-block; margin-top: 16px; font-size: 0.85rem; color: var(--color-text-light); text-decoration: underline; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  margin: 10px 0;
  cursor: pointer;
}
.switch-row-text { font-size: 0.9rem; color: var(--color-text); }
.switch { position: relative; display: inline-block; width: 48px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0;
  background: #D9D9D9;
  border-radius: 999px;
  transition: background 0.2s;
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}
.switch input:checked + .switch-slider { background: var(--color-green); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }
.switch input:disabled + .switch-slider { opacity: 0.6; }

.sibling-note { color: var(--color-text-light); font-style: italic; }

/* ============ せいさん日の おしらせ ============ */
.settle-reminder {
  background: #FFF8E1;
  border: 3px solid var(--color-accent-gold);
  border-radius: 20px;
  padding: 14px 16px;
  margin: 16px 0 4px;
  box-shadow: var(--shadow-pop-sm);
}
.settle-reminder-title { font-weight: 900; font-size: 1.05rem; color: #E65100; }
.settle-reminder-title i { color: var(--color-accent-gold-dark); }
.settle-reminder-sub { font-size: 0.8rem; color: var(--color-text-light); margin-top: 2px; }
.settle-reminder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border-radius: 14px;
  padding: 8px 10px;
  margin-top: 8px;
}
.settle-reminder-name { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settle-reminder-amount { font-weight: 900; color: var(--color-accent-gold-dark); white-space: nowrap; }

.next-settle {
  margin: 16px 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-light);
  text-align: center;
}

.settle-schedule-row { display: flex; gap: 8px; margin: 12px 0 8px; }
.settle-schedule-row select { flex: 1; min-width: 0; }
.settle-schedule-row select[hidden] { display: none; }
.settle-next-note { font-weight: 700; color: var(--color-blue); margin-bottom: 6px; }

/* ============ カレンダー ============ */
.cal-stats {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-light);
  text-align: center;
  margin-bottom: 8px;
}
.cal-stats strong { color: var(--color-blue); font-size: 1.1rem; }

.cal-card {
  background: white;
  border-radius: 18px;
  padding: 10px 6px 8px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.04);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--color-text-light);
  padding-bottom: 4px;
}
.cal-weekdays span:first-child { color: #E53935; }
.cal-weekdays span:last-child { color: var(--color-blue); }

.cal-day {
  min-height: 58px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #FAFAFA;
  font-family: inherit;
  color: var(--color-text);
  padding: 4px 0 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}
.cal-day:active:not([disabled]) { transform: translateY(1px); }
.cal-day-num { font-size: 0.85rem; font-weight: 800; line-height: 1.2; }
.cal-day.is-today { border-color: var(--color-blue); }
.cal-day.is-selected { background: var(--color-main); border-color: var(--color-blue); }
.cal-day.is-future { opacity: 0.35; cursor: default; }
.cal-day.has-unsettled { background: #FFF3E0; }
.cal-day.has-settled { background: #E8F5E9; }
.cal-day.is-selected.has-unsettled,
.cal-day.is-selected.has-settled { border-color: var(--color-blue); box-shadow: inset 0 0 0 1px var(--color-blue); }

.cal-mark {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.has-unsettled .cal-mark, .cal-mark.legend-unsettled { background: #FB8C00; }
.has-settled .cal-mark, .cal-mark.legend-settled { background: var(--color-green); }
.cal-amount {
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  color: var(--color-text);
}

.cal-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-top: 8px;
}
.cal-legend > span { display: inline-flex; align-items: center; gap: 4px; }

.cal-day-panel { margin-top: 14px; padding-bottom: 72px; }
.cal-day-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 900;
  margin: 0 4px 8px;
}
.cal-day-header strong { color: var(--color-accent-gold-dark); font-size: 1.15rem; }
.cal-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-light);
  padding: 14px 0;
}
