/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  transition: var(--transition);
}

.card:hover { border-color: var(--border-hover); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-tabs {
  display: flex;
  gap: 6px;
}

.tab-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.tab-btn:hover, .tab-btn.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: white;
}

/* ===== Subscription List ===== */
.subscription-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-gutter: stable;
}

.subscription-list::-webkit-scrollbar { width: 6px; }
.subscription-list::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 6px; }
.subscription-list::-webkit-scrollbar-thumb { background: var(--accent-purple); border-radius: 6px; opacity: 0.8; }
.subscription-list::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

.sub-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 12px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.sub-item::after { display: none; }

.sub-item.status-active  { border-left: 4px solid var(--accent-green); }
.sub-item.status-warning { border-left: 4px solid var(--accent-gold); }
.sub-item.status-unused  { border-left: 4px solid var(--accent-pink); }

.sub-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateX(2px);
}

.sub-emoji {
  font-size: 24px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  overflow: hidden;
}

.sub-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.sub-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.sub-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.sub-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
}

.sub-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}

.sub-status.active { background: rgba(92, 252, 143, 0.15); color: var(--accent-green); }
.sub-status.warning { background: rgba(252, 201, 53, 0.15); color: var(--accent-gold); }
.sub-status.unused { background: rgba(252, 92, 139, 0.15); color: var(--accent-pink); }

/* ===== Upcoming List ===== */
.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upcoming-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.upcoming-day {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upcoming-day .day-num {
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.upcoming-day .day-label {
  font-size: 9px;
  opacity: 0.8;
}

.upcoming-info { flex: 1; }
.upcoming-name { font-size: 13px; font-weight: 600; }
.upcoming-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.upcoming-price { font-size: 14px; font-weight: 700; }

/* ===== Category Chart ===== */
.chart-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-bar-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.chart-bar-amount { font-size: 13px; font-weight: 700; color: var(--text-primary); }

.chart-bar-track {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Badges ===== */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.badge-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
}

.badge-item:hover { transform: translateY(-4px); border-color: var(--border-hover); }

.badge-item.locked { opacity: 0.4; filter: grayscale(1); }

.badge-item.unlocked {
  border-color: rgba(252, 201, 53, 0.3);
  background: linear-gradient(135deg, rgba(252, 201, 53, 0.08), var(--bg-secondary));
}

.badge-emoji { font-size: 40px; margin-bottom: 10px; }
.badge-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.badge-desc { font-size: 11px; color: var(--text-muted); }

/* ===== Rewards Shop ===== */
/* ===== Rewards Tabs ===== */
.rewards-tabbed-card { padding: 0; overflow: hidden; }

.rewards-tabs-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.rewards-tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 16px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.rewards-tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: var(--transition);
}

.rewards-tab-btn:hover { color: var(--text-secondary); }
.rewards-tab-btn.active { color: var(--accent-purple); }
.rewards-tab-btn.active::after { transform: scaleX(1); }

.coupon-count-badge {
  background: var(--accent-pink);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  display: none;
}

.coupon-count-badge.visible { display: inline-block; }

.rewards-tab-pane { display: none; padding: 24px; }
.rewards-tab-pane.active { display: block; }

/* ===== Earn Methods ===== */
.earn-methods-card .card-header { padding-bottom: 0; margin-bottom: 16px; }
.earn-subtitle { font-size: 12px; color: var(--accent-cyan); font-weight: 600; }

.earn-methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.earn-method-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
  cursor: pointer;
}

.earn-method-item:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  background: rgba(92, 252, 218, 0.05);
}

.earn-method-item.claimed {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--border);
}

.earn-method-icon { font-size: 28px; flex-shrink: 0; }

.earn-method-info { flex: 1; min-width: 0; }
.earn-method-name { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.earn-method-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

.earn-method-points {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-gold);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Coupon Cards ===== */
.coupons-list { display: flex; flex-direction: column; gap: 14px; }

.coupon-card {
  background: var(--bg-secondary);
  border: 1px dashed rgba(252, 201, 53, 0.4);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  transition: var(--transition);
}

.coupon-card:hover { border-color: rgba(252, 201, 53, 0.7); transform: translateY(-2px); }

.coupon-left {
  background: var(--gradient-gold);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  text-align: center;
}

.coupon-icon { font-size: 28px; margin-bottom: 6px; }
.coupon-brand { font-size: 10px; font-weight: 800; color: rgba(0,0,0,0.6); }

.coupon-right {
  flex: 1;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.coupon-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.coupon-date { font-size: 12px; color: var(--text-muted); }

.coupon-code {
  background: rgba(252,201,53,0.1);
  border: 1px dashed rgba(252,201,53,0.4);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 800;
  font-family: monospace;
  color: var(--accent-gold);
  white-space: nowrap;
  cursor: pointer;
}

.coupon-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.coupon-empty .empty-icon { font-size: 48px; margin-bottom: 12px; }
.coupon-empty p { font-size: 14px; line-height: 1.6; }

/* ===== Rewards Shop ===== */
.rewards-shop {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.shop-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  transition: var(--transition);
}

.shop-item:hover { transform: translateY(-4px); border-color: var(--accent-purple); }

.shop-icon { font-size: 40px; margin-bottom: 12px; }
.shop-name { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.shop-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.5; }

.shop-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-gold);
  margin-bottom: 12px;
}

.btn-shop {
  background: var(--gradient-gold);
  border: none;
  color: var(--bg-primary);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  width: 100%;
}

.btn-shop:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(252, 201, 53, 0.4); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;            /* 헤더 고정을 위해 모달 자체는 hidden */
  display: flex;
  flex-direction: column;
  transform: scale(0.9) translateY(20px);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;              /* 헤더 고정 */
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-secondary);
}

.modal-header h2 { font-size: 18px; font-weight: 700; }

.modal-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}

.modal-close:hover { border-color: var(--accent-pink); color: var(--accent-pink); }

.modal-body {
  padding: 24px 28px;
  overflow-y: auto;            /* body만 스크롤 */
  flex: 1;
}

.quick-services h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quick-services-grid {
  display: block;
  width: 100%;
  margin-bottom: 24px;
}

.quick-service-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  color: var(--text-primary);
  font-family: inherit;
}

.quick-service-btn:hover {
  border-color: var(--accent-purple);
  background: rgba(124, 92, 252, 0.1);
  transform: translateY(-2px);
}

.quick-service-btn .qs-emoji { font-size: 24px; display: block; margin-bottom: 6px; }
.quick-service-btn .qs-name { font-size: 11px; font-weight: 600; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== Forms ===== */
.add-sub-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input, .form-group select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.1);
}

.emoji-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.emoji-option {
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: var(--transition);
}

.emoji-option:hover, .emoji-option.selected {
  border-color: var(--accent-purple);
  background: rgba(124, 92, 252, 0.1);
  transform: scale(1.1);
}

.btn-submit {
  background: var(--gradient-primary);
  border: none;
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  margin-top: 8px;
}

.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(124, 92, 252, 0.4); }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 32px;
  right: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  min-width: 260px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-pink); }
.toast.info { border-left: 3px solid var(--accent-purple); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(10px); }
}

/* ===== Subscription Detail Modal ===== */
.sub-detail-modal { max-width: 620px; }

.sub-detail-header {
  background: linear-gradient(135deg, rgba(124,92,252,0.08), rgba(252,92,139,0.05));
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sub-detail-title-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sub-detail-emoji {
  width: 60px;
  height: 60px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

#detailName { font-size: 20px; font-weight: 800; margin-bottom: 4px; }

.sub-detail-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.detail-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.detail-badge.active { background: rgba(92,252,143,0.15); color: var(--accent-green); }
.detail-badge.warning { background: rgba(252,201,53,0.15); color: var(--accent-gold); }
.detail-badge.unused { background: rgba(252,92,139,0.15); color: var(--accent-pink); }
.detail-badge.cat { background: rgba(255,255,255,0.07); color: var(--text-secondary); }

.detail-section { margin-bottom: 24px; }

.detail-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

/* Plan Cards */
.detail-plans {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-plan-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.detail-plan-card:hover { border-color: rgba(124,92,252,0.4); background: rgba(124,92,252,0.05); }

.detail-plan-card.current {
  border-color: var(--accent-purple);
  background: rgba(124,92,252,0.08);
}

.detail-plan-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.detail-plan-card.current .detail-plan-radio {
  border-color: var(--accent-purple);
  background: var(--accent-purple);
}

.detail-plan-card.current .detail-plan-radio::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
}

.detail-plan-info { flex: 1; }
.detail-plan-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.detail-plan-desc { font-size: 12px; color: var(--text-muted); }

.detail-plan-price { font-size: 16px; font-weight: 800; color: var(--text-primary); white-space: nowrap; }
.detail-plan-card.current .detail-plan-price { color: var(--accent-purple); }

.detail-plan-tag {
  background: var(--gradient-primary);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Info Grid */
.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.detail-info-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.detail-info-label { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-info-value { font-size: 15px; font-weight: 700; color: var(--text-primary); }

/* Usage */
.detail-usage-wrap {
  display: flex;
  gap: 12px;
}

.detail-usage-item {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: center;
}

.detail-usage-icon { font-size: 24px; margin-bottom: 6px; }
.detail-usage-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.detail-usage-value { font-size: 16px; font-weight: 800; }
.detail-usage-value.good { color: var(--accent-green); }
.detail-usage-value.medium { color: var(--accent-gold); }
.detail-usage-value.bad { color: var(--accent-pink); }

/* Detail Actions */
.detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.detail-actions-right { display: flex; gap: 10px; }

.btn-detail-website {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-detail-website:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }

.btn-detail-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-detail-close:hover { border-color: var(--text-secondary); color: var(--text-primary); }

.btn-detail-cancel {
  background: rgba(252,92,139,0.12);
  border: 1px solid rgba(252,92,139,0.3);
  color: var(--accent-pink);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-detail-cancel:hover { background: var(--accent-pink); color: white; }

.btn-detail-change {
  background: rgba(92,252,218,0.12);
  border: 1px solid rgba(92,252,218,0.3);
  color: var(--accent-cyan);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-detail-change:hover { background: var(--accent-cyan); color: var(--bg-primary); }

/* ===== Auto Discovery Modal ===== */
.discovery-modal { max-width: 520px; }

/* Step 1: Login choice */
.discovery-step { animation: fadeIn 0.3s ease; }

.discovery-intro {
  text-align: center;
  padding: 8px 0 20px;
}

.discovery-intro-icon { font-size: 48px; margin-bottom: 12px; }
.discovery-intro-title { font-size: 17px; font-weight: 800; margin-bottom: 8px; }
.discovery-intro-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

.discovery-notice {
  background: rgba(124,92,252,0.08);
  border: 1px solid rgba(124,92,252,0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 16px;
  line-height: 1.5;
}

.login-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}

.login-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-align: left;
}

.login-btn:hover { transform: translateY(-2px); border-color: var(--border-hover); }

.login-btn.google { border-color: rgba(66,133,244,0.3); }
.login-btn.google:hover { background: rgba(66,133,244,0.08); border-color: rgba(66,133,244,0.6); }
.login-btn.kakao { border-color: rgba(254,229,0,0.3); }
.login-btn.kakao:hover { background: rgba(254,229,0,0.08); border-color: rgba(254,229,0,0.6); }
.login-btn.naver { border-color: rgba(3,199,90,0.3); }
.login-btn.naver:hover { background: rgba(3,199,90,0.08); border-color: rgba(3,199,90,0.6); }
.login-btn.mydata { border-color: rgba(92,252,218,0.3); }
.login-btn.mydata:hover { background: rgba(92,252,218,0.08); border-color: rgba(92,252,218,0.6); }

.login-btn-icon { font-size: 24px; }
.login-btn-info { flex: 1; }
.login-btn-name { font-size: 14px; font-weight: 700; }
.login-btn-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.login-btn-arrow { color: var(--text-muted); }

/* Step 2: Loading */
.discovery-loading {
  text-align: center;
  padding: 32px 0;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(124,92,252,0.15);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-steps { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }

.loading-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  transition: var(--transition);
}

.loading-step.done { color: var(--accent-green); }
.loading-step.active { color: var(--text-primary); }
.loading-step-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* Step 3: Results */
.discovery-results-title {
  text-align: center;
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 4px;
}
.discovery-results-sub { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

.discovered-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.discovered-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.discovered-item.selected { border-color: var(--accent-purple); background: rgba(124,92,252,0.08); }

.discovered-item:hover { border-color: var(--border-hover); }

.discovered-checkbox {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  font-size: 12px;
}

.discovered-item.selected .discovered-checkbox {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: white;
}

.discovered-emoji { font-size: 28px; }
.discovered-info { flex: 1; }
.discovered-name { font-size: 14px; font-weight: 700; }
.discovered-source { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.discovered-price { font-size: 15px; font-weight: 800; color: var(--accent-cyan); }

.btn-add-discovered {
  background: var(--gradient-primary);
  border: none;
  color: white;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  width: 100%;
}

.btn-add-discovered:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(124,92,252,0.4); }

/* ===== Profile Modal ===== */
.user-profile {
  cursor: pointer;
  transition: var(--transition);
  border-radius: 12px;
  padding: 8px;
  margin: -8px;
}

.user-profile:hover {
  background: rgba(124,92,252,0.1);
}

.profile-modal {
  max-width: 480px;
  max-height: 88vh;
  overflow: hidden;          /* 전체 모달은 숨김 */
  display: flex;
  flex-direction: column;
}
.profile-modal .modal-header {
  flex-shrink: 0;            /* 헤더 고정 - 스크롤 따라 내려가지 않음 */
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.profile-modal .modal-body {
  flex: 1;
  overflow-y: auto;          /* body만 스크롤 */
  padding: 20px;
}

.profile-hero {
  text-align: center;
  padding: 28px 20px 20px;
  background: linear-gradient(135deg, rgba(124,92,252,0.12), rgba(252,92,139,0.08));
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.profile-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: white;
  margin: 0 auto 12px;
  box-shadow: 0 0 20px rgba(124,92,252,0.4);
}

.profile-name-lg {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}

.profile-level-badge {
  display: inline-block;
  background: rgba(252,201,53,0.15);
  border: 1px solid rgba(252,201,53,0.3);
  color: var(--accent-gold);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.profile-email {
  font-size: 12px;
  color: var(--text-muted);
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.profile-stat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
  transition: var(--transition);
}
.profile-stat-box:hover {
  background: var(--bg-card);
  border-color: var(--accent-purple);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139,92,246,0.2);
}

.profile-stat-box.stat-active { border-color: rgba(92,252,218,0.3); }
.profile-stat-box.stat-unused { border-color: rgba(252,92,139,0.3); }
.profile-stat-box.stat-points { border-color: rgba(252,201,53,0.3); }

.profile-stat-num {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-primary);
}

.profile-stat-box.stat-active .profile-stat-num { color: var(--accent-cyan); }
.profile-stat-box.stat-unused .profile-stat-num { color: var(--accent-pink); }
.profile-stat-box.stat-points .profile-stat-num { color: var(--accent-gold); }

.profile-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}

.profile-info-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.profile-info-label { color: var(--text-muted); }
.profile-info-val { font-weight: 700; color: var(--text-primary); }

.profile-coupons-section {
  margin-bottom: 20px;
}

.profile-section-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

.mini-coupon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  margin-bottom: 6px;
}

.btn-profile-edit {
  width: 100%;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-profile-edit:hover { opacity: 0.85; transform: translateY(-1px); }



/* ===== Profile Tab Bar ===== */
.profile-tab-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 4px;
  border: 1px solid var(--border);
}

.profile-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.profile-tab.active {
  background: var(--accent-purple);
  color: white;
  box-shadow: 0 2px 8px rgba(124,92,252,0.4);
}

/* ===== Profile Edit Form ===== */
.profile-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-edit-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-edit-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.profile-edit-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.profile-edit-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124,92,252,0.15);
}

.btn-save-profile {
  width: 100%;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  margin-top: 4px;
}

.btn-save-profile:hover { opacity: 0.85; transform: translateY(-1px); }

.btn-cancel-profile {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  margin-top: 4px;
}

.btn-cancel-profile:hover { border-color: var(--text-secondary); color: var(--text-primary); }

/* ===== Notification Rows ===== */
.profile-notify-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notify-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.notify-row:last-child { border-bottom: none; }

.notify-row-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.notify-row-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.notify-row-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== Toggle Switch ===== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: white;
}


/* ============================================================
   SubDiet Phase 1 추가 스타일
