/* ---------- Insights ---------- */
.chart-controls { display: flex; gap: 6px; background: rgba(255,255,255,0.05); border-radius: 12px; padding: 3px; margin: 4px 4px 16px; width: fit-content; border: 0.5px solid var(--hair); }
.seg {
  border: 0; background: none; color: var(--text-dim);
  padding: 7px 14px; font-size: 13px; font-weight: 600; border-radius: 9px;
  transition: all .2s ease;
}
.seg.active { background: var(--bg-3); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }

.chart-card, .list-card {
  background: rgba(255, 255, 255, 0.06);
  border: 0.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  margin-bottom: 14px;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.chart-card h3, .list-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.chart-card .sub { margin: 0 0 12px; color: var(--text-faint); font-size: 12px; }
canvas.chart { width: 100%; height: 200px; display: block; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.picker {
  width: 100%; appearance: none; -webkit-appearance: none;
  background: var(--bg-3); color: var(--text);
  border: 0.5px solid var(--hair); border-radius: 12px;
  padding: 10px 12px; font-size: 14px; font-weight: 600;
  margin-bottom: 12px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

/* ---------- Hearts tab ---------- */
.heart-summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.heart-summary-card {
  background: rgba(255, 255, 255, 0.06);
  border: 0.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 14px 16px;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.heart-summary-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.heart-summary-head .avatar {
  width: 36px;
  height: 36px;
  font-size: 13px;
}
.heart-summary-info { flex: 1; min-width: 0; }
.heart-summary-name { font-size: 15px; font-weight: 600; }
.heart-summary-stats { display: flex; gap: 12px; margin-top: 2px; font-size: 12px; }
.heart-stat.received { color: var(--heart); font-weight: 600; }
.heart-stat.given { color: var(--text-faint); }
.heart-bar-track {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.heart-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--heart), #e84d6e);
  border-radius: 2px;
  transition: width .3s ease;
}
.h-note {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
  font-style: italic;
}
.h-thumb {
  max-width: 100%;
  width: auto;
  max-height: 320px;
  height: auto;
  border-radius: 8px;
  border: 0.5px solid var(--hair);
  display: block;
  margin-top: 4px;
  cursor: pointer;
  transition: opacity .15s ease;
}

.h-thumb:active {
  opacity: 0.7;
}

.h-main {
  min-width: 0;
  overflow: hidden;
}

/* ---------- Image Viewer ---------- */
#imageViewer {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: none;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#imageViewer.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

#imageViewer .viewer-close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 18px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease;
}

#imageViewer .viewer-close:active {
  background: rgba(255,255,255,0.25);
}

#imageViewer .viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Settings ---------- */
.settings-user { display: flex; align-items: center; gap: 8px; padding: 4px 0 14px; font-size: 13px; }
.settings-user .avatar { border-radius: 50%; flex-shrink: 0; }
.settings-user .name { font-weight: 600; }
.settings-user .dim { color: var(--text-faint); font-size: 12px; }
.settings-user .logout-btn { margin-left: auto; font-size: 16px; opacity: 0.5; transition: opacity .15s; }
.settings-user .logout-btn:hover { opacity: 1; }
.settings-group { background: rgba(255, 255, 255, 0.06); border: 0.5px solid rgba(255, 255, 255, 0.12); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.25); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
.settings-group .group-title { padding: 16px 16px 6px; font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-top: 0.5px solid var(--hair);
  background: transparent;
}
.row:first-of-type { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 15px; font-weight: 500; margin: 0; }
.ver { font-size: 11px; color: var(--text-faint); font-weight: 400; margin-left: 4px; }
.row .desc { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.drag-handle {
  cursor: grab;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
  padding: 4px 2px;
  transition: color .2s ease;
}
.drag-handle:active { cursor: grabbing; }
.person-row.dragging { opacity: 0.3; }
.person-row.drag-over {
  background: rgba(255,255,255,0.06);
  box-shadow: inset 3px 0 0 var(--accent);
}

.person-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 0.5px solid var(--hair); }
.person-row:first-of-type { border-top: 0; }
.person-row .avatar,
.candidate-row .avatar { width: 34px; height: 34px; font-size: 13px; object-fit: cover; display: block; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12); flex-shrink: 0; }
.person-row .name { flex: 1; font-size: 15px; font-weight: 500; }
.toggle-label { font-size: 11px; font-weight: 600; color: var(--text-faint); }
.person-row-info { flex: 1; min-width: 0; }
.person-row .stats { font-size: 11px; color: var(--text-faint); }

/* ---------- Member management ---------- */
.candidate-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-top: 0.5px solid var(--hair);
}
.candidate-row:first-of-type { border-top: 0; }
.candidate-row .avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; }
.candidate-row .name { flex: 1; font-size: 15px; font-weight: 500; min-width: 0; }

.toggle-wrap {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--text-faint);
  cursor: pointer; user-select: none; flex-shrink: 0;
}
.toggle {
  position: relative; width: 36px; height: 22px; border-radius: 11px;
  margin: 0;
  background: var(--bg-3); border: 0.5px solid var(--hair);
  transition: background .2s ease, border-color .2s ease;
  cursor: pointer; appearance: none; -webkit-appearance: none;
}
.toggle:checked { background: var(--accent); border-color: var(--accent); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .2s cubic-bezier(.2,.9,.3,1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle:checked::after { transform: translateX(14px); }

.btn-add {
  font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 8px;
  border: 0.5px solid var(--hair); background: var(--accent-soft); color: var(--accent);
  cursor: pointer; transition: transform .12s ease, background .2s ease; flex-shrink: 0;
}
.btn-add:active { transform: scale(0.94); background: rgba(229,152,155,0.28); }

.empty-text {
  padding: 14px 16px; color: var(--text-faint); font-size: 13px;
  border-top: 0.5px solid var(--hair); margin: 0;
}

/* ---------- Login ---------- */
.login-body form {
  margin: 0;
}
.login-body {
  padding: 0 0 12px;
}
.login-desc {
  margin: 4px 16px 16px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.45;
}
.login-error {
  margin: 0 16px 12px;
  font-size: 13px;
  color: var(--neg);
  display: none;
}
.login-btn {
  margin: 8px 16px 0;
  width: calc(100% - 32px);
  padding: 13px;
  font-size: 16px;
}

.group-subtitle {
  padding: 16px 16px 6px; font-size: 12px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}

/* ---------- Push notification toggle ---------- */
.push-toggle-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}

.push-toggle-btn:not(.push-enabled):not(.push-blocked) {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 0.5px solid var(--hair);
}

.push-toggle-btn.push-enabled {
  background: var(--heart);
  color: #fff;
  border: 0;
}

.push-toggle-btn.push-blocked {
  background: var(--neg-soft);
  color: var(--neg);
  border: 0;
  cursor: default;
}

.push-toggle-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
